Class: Wikidotrb::Module::User

Inherits:
AbstractUser show all
Defined in:
lib/wikidotrb/module/user.rb

Overview

Regular user object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, id: nil, name: nil, unix_name: nil, avatar_url: nil) ⇒ User

Returns a new instance of User.



77
78
79
# File 'lib/wikidotrb/module/user.rb', line 77

def initialize(client:, id: nil, name: nil, unix_name: nil, avatar_url: nil)
  super
end

Instance Attribute Details

#avatar_url

Returns the value of attribute avatar_url.



75
76
77
# File 'lib/wikidotrb/module/user.rb', line 75

def avatar_url
  @avatar_url
end

#client

Returns the value of attribute client.



75
76
77
# File 'lib/wikidotrb/module/user.rb', line 75

def client
  @client
end

#id

Returns the value of attribute id.



75
76
77
# File 'lib/wikidotrb/module/user.rb', line 75

def id
  @id
end

#ip

Returns the value of attribute ip.



75
76
77
# File 'lib/wikidotrb/module/user.rb', line 75

def ip
  @ip
end

#name

Returns the value of attribute name.



75
76
77
# File 'lib/wikidotrb/module/user.rb', line 75

def name
  @name
end

#unix_name

Returns the value of attribute unix_name.



75
76
77
# File 'lib/wikidotrb/module/user.rb', line 75

def unix_name
  @unix_name
end

Class Method Details

.from_name(client, name, raise_when_not_found = false) ⇒ User

Get a user object from a username

Parameters:

  • client (Client)

    The client

  • name (String)

    Username

  • raise_when_not_found (Boolean) (defaults to: false)

    Whether to raise an exception when the user is not found

Returns:

  • (User)

    User object



86
87
88
# File 'lib/wikidotrb/module/user.rb', line 86

def self.from_name(client, name, raise_when_not_found = false)
  UserCollection.from_names(client, [name], raise_when_not_found).first
end