Module: EasyshipRatesRubyApi::Helpers::Authorization
- Included in:
- Client
- Defined in:
- lib/easyship/rates/ruby/api/helpers/authorization.rb
Constant Summary collapse
- DEFAULT_OAUTH_OPTIONS =
{ staging_api_host: 'https://rates-staging.goeasyship.com', production_api_host: 'https://rates.goeasyship.com', token_url: '/oauth2/token' }
Instance Method Summary collapse
Instance Method Details
#access_token ⇒ Object
19 20 21 |
# File 'lib/easyship/rates/ruby/api/helpers/authorization.rb', line 19 def access_token @access_token end |
#client ⇒ Object
11 12 13 |
# File 'lib/easyship/rates/ruby/api/helpers/authorization.rb', line 11 def client @client ||= ::OAuth2::Client.new(@client_uid, @client_secret, ) end |
#get_token(params = {}) ⇒ Object
15 16 17 |
# File 'lib/easyship/rates/ruby/api/helpers/authorization.rb', line 15 def get_token(params = {}) @access_token ||= (params.delete(:access_token) || client.assertion.get_token(build_param(params))) end |