Class: Odnoklassniki::Client
- Inherits:
-
Object
- Object
- Odnoklassniki::Client
- Defined in:
- lib/odnoklassniki/client.rb
Instance Method Summary collapse
- #get(method, params = {}, &block) ⇒ Object
-
#initialize(attrs = {}) ⇒ Client
constructor
A new instance of Client.
- #post(method, params = {}, &block) ⇒ Object
- #refresh_token! ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 |
# File 'lib/odnoklassniki/client.rb', line 6 def initialize(attrs= {}) attrs = Odnoklassniki..merge(attrs) Config::VALID_OPTIONS_KEYS.each do |key| instance_variable_set("@#{key}".to_sym, attrs[key]) end @refreshed = false end |
Instance Method Details
#get(method, params = {}, &block) ⇒ Object
14 15 16 |
# File 'lib/odnoklassniki/client.rb', line 14 def get(method, params={}, &block) request_method(:get, method, params, block) end |
#post(method, params = {}, &block) ⇒ Object
18 19 20 |
# File 'lib/odnoklassniki/client.rb', line 18 def post(method, params={}, &block) request_method(:post, method, params, block) end |
#refresh_token! ⇒ Object
22 23 24 25 26 27 |
# File 'lib/odnoklassniki/client.rb', line 22 def refresh_token! @refreshed = true data = request.post('/oauth/token.do', refresh_credentials) @request = nil @access_token = data['access_token'] end |