Class: RenrenAPI::HTTPAdapter
- Inherits:
-
Object
- Object
- RenrenAPI::HTTPAdapter
- Defined in:
- lib/renren-api/http_adapter.rb
Instance Method Summary collapse
- #get_friends ⇒ Object
- #get_info(uids, fields) ⇒ Object
-
#initialize(http, api_key, secret_key, session_key) ⇒ HTTPAdapter
constructor
A new instance of HTTPAdapter.
- #send_notification(receiver_ids, notification) ⇒ Object
Constructor Details
#initialize(http, api_key, secret_key, session_key) ⇒ HTTPAdapter
Returns a new instance of HTTPAdapter.
8 9 10 11 |
# File 'lib/renren-api/http_adapter.rb', line 8 def initialize(http, api_key, secret_key, session_key) @http, @api_key, @secret_key, @session_key = http, api_key, secret_key, session_key @signature_calculator = SignatureCalculator.new(@secret_key) end |
Instance Method Details
#get_friends ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/renren-api/http_adapter.rb', line 12 def get_friends params = { :api_key => @api_key, :method => "friends.getFriends", :call_id => current_time_in_millisecond, :v => "1.0", :session_key => @session_key, :format => "JSON" } request(params) end |
#get_info(uids, fields) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/renren-api/http_adapter.rb', line 23 def get_info(uids, fields) params = { :api_key => @api_key, :method => "users.getInfo", :call_id => current_time_in_millisecond, :v => "1.0", :session_key => @session_key, :fields => fields * ",", :uids => uids * ",", :format => "JSON" } request(params) end |
#send_notification(receiver_ids, notification) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/renren-api/http_adapter.rb', line 36 def send_notification(receiver_ids, notification) request( :api_key => @api_key, :method => "notifications.send", :call_id => current_time_in_millisecond, :v => "1.0", :session_key => @session_key, :format => "JSON", :to_ids => receiver_ids * ",", :notification => notification ) end |