module SantanderChile::ApiClient::Client::Authentication
Constants
- HEADERS
Attributes
token[RW]
username[RW]
Public Instance Methods
login(username:, password:, grant_type: "password")
click to toggle source
# File lib/santander_chile/api_client/client/authentication.rb, line 14 def login(username:, password:, grant_type: "password") self.username = username self.token = oauth_token( grant_type: grant_type, client_id: config.client_id, scope: "Completa", username: username, password: password, ) self.token end
Private Instance Methods
oauth_token(**body)
click to toggle source
# File lib/santander_chile/api_client/client/authentication.rb, line 28 def oauth_token(**body) response = connection(host: AUTH_BASE_URL).post( "oauth2/token", body: body, headers: HEADERS, login: true, ) return Token.new(response.body) end