Class: SmartlingApi::Authentication
- Inherits:
-
Object
- Object
- SmartlingApi::Authentication
- Defined in:
- lib/smartling_api/authentication.rb
Overview
Access to Smartling Authentication API
Instance Method Summary collapse
-
#access_token ⇒ String
Access to Smartling authentication api to retrieve OAuth access_token.
-
#initialize(smartling: smartling_client, configuration: SmartlingApi.configuration) ⇒ Authentication
constructor
A new instance of Authentication.
Constructor Details
#initialize(smartling: smartling_client, configuration: SmartlingApi.configuration) ⇒ Authentication
Returns a new instance of Authentication.
8 9 10 11 |
# File 'lib/smartling_api/authentication.rb', line 8 def initialize(smartling: smartling_client, configuration: SmartlingApi.configuration) @smartling = smartling.new @configuration = configuration end |
Instance Method Details
#access_token ⇒ String
Access to Smartling authentication api to retrieve OAuth access_token.
22 23 24 25 26 27 |
# File 'lib/smartling_api/authentication.rb', line 22 def access_token raise Errors::Credentials if configuration.invalid? data = smartling.authenticate(url: '/auth-api/v2/authenticate', body: { userIdentifier: user_id, userSecret: user_secret }) data.fetch("accessToken") end |