Module: Readmill::Client::Users

Included in:
Readmill::Client
Defined in:
lib/readmill/client/users.rb

Overview

Public: This module will bring all of the methods from the user section of the API.

Instance Method Summary collapse

Instance Method Details

#user(id, opts = {}) ⇒ Object

Public: Get a specific user from readmill.

id - The id of a user to get from readmill. opts - A Hash of options used to modify the results. All of the values

of this Hash will be forwarded to the API as parameters
(default: {}).

Returns a Hashie::Mash.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/readmill/client/users.rb', line 16

def user(id, opts={})
  if opts[:followers] && opts[:followings]
    raise ArgumentError,
      'You can pass either followers or followings, but not both.'
  end

  if opts.delete(:followers)
    get("users/#{id}/followers", opts).items
  elsif opts.delete(:followings)
    get("users/#{id}/followings", opts).items
  else
    get("users/#{id}", opts)
  end
end