Class: Wikidotrb::Module::ClientUserMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/wikidotrb/module/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ClientUserMethods

Returns a new instance of ClientUserMethods.



16
17
18
# File 'lib/wikidotrb/module/client.rb', line 16

def initialize(client)
  @client = client
end

Instance Attribute Details

#client (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/wikidotrb/module/client.rb', line 14

def client
  @client
end

Instance Method Details

#get(name, raise_when_not_found: false) ⇒ User

Get a user object from a username

Parameters:

  • 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



24
25
26
# File 'lib/wikidotrb/module/client.rb', line 24

def get(name, raise_when_not_found: false)
  Wikidotrb::Module::User.from_name(@client, name, raise_when_not_found)
end

#get_bulk(names, raise_when_not_found: false) ⇒ Array<User>

Get user objects from a list of usernames

Parameters:

  • names (Array<String>)

    List of usernames

  • raise_when_not_found (Boolean) (defaults to: false)

    Whether to raise an exception when a user is not found

Returns:

  • (Array<User>)

    List of user objects



32
33
34
# File 'lib/wikidotrb/module/client.rb', line 32

def get_bulk(names, raise_when_not_found: false)
  Wikidotrb::Module::UserCollection.from_names(@client, names, raise_when_not_found)
end