Class: Polar::Client
- Inherits:
-
Object
- Object
- Polar::Client
- Defined in:
- lib/polar/client.rb
Instance Method Summary collapse
- #get_friends ⇒ Object
- #get_info(uids, fields) ⇒ Object
-
#initialize(api_key, secret_key, session_key) ⇒ Client
constructor
A new instance of Client.
- #set_status(status) ⇒ Object
Constructor Details
#initialize(api_key, secret_key, session_key) ⇒ Client
Returns a new instance of Client.
4 5 6 |
# File 'lib/polar/client.rb', line 4 def initialize(api_key, secret_key, session_key) @api_key, @secret_key, @session_key = api_key, secret_key, session_key end |
Instance Method Details
#get_friends ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/polar/client.rb', line 8 def get_friends params = { :method => "friends.getFriends", :v => "1.0" } Polar::Cursor.new(@api_key, @secret_key, @session_key, Polar::User, params) end |
#get_info(uids, fields) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/polar/client.rb', line 17 def get_info(uids, fields) params = { :method => "users.getInfo", :v => "1.0", :fields => fields * ",", :uids => uids * "," } user_info = request(params) if user_info.count == 1 return Polar::User.new(user_info.first) else friend_list = [] user_info.each { |current_user| friend_list << Polar::User.new(current_user) } return friend_list end end |