Sha256: 8582843ba1810edd38c8fa55c72abb216429f3000be5997aa5fd74a2df533a99
Contents?: true
Size: 920 Bytes
Versions: 4
Compression:
Stored size: 920 Bytes
Contents
require "ostruct" module SantanderChile module ApiClient class Client module Authentication attr_accessor :token, :username HEADERS = { "app" => "007", "canal" => "003", "nro_ser" => "", } 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 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 end end end end
Version data entries
4 entries across 4 versions & 1 rubygems