Class: AliexpressAPI::AccessToken

Inherits:
Base
  • Object
show all
Defined in:
lib/aliexpress_api/resources/token.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Methods inherited from Base

#[], #[]=, activate_session, app_key, app_secret, #as_json, connection, #initialize, #respond_to_missing?, service_endpoint, session, session=, #to_hash, #to_json

Methods included from ThreadsafeAttributes

included

Constructor Details

This class inherits a constructor from AliexpressAPI::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AliexpressAPI::Base

Class Method Details

.refresh(refresh_token) ⇒ Object

Raises:



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/aliexpress_api/resources/token.rb', line 6

def refresh(refresh_token)
  params = {
    client_id: app_key,
    client_secret: app_secret,
    refresh_token: refresh_token,
    grant_type: 'refresh_token'
  }
  response = connection.post('https://oauth.aliexpress.com/token', params: params)
  raise ResultError, response if response['error_code'].present?

  response
end