class BridgeBankin::Authorization

User authentication & authorization

Attributes

access_token[R]
expires_at[R]

Public Class Methods

generate_token(email:, password:) click to toggle source

Authenticate user with the corresponding credentials

@param [String] email the registered user email @param [String] password the registered user password

@return [Authorization] the authorization informations provided by the API

# File lib/bridge_bankin/authorization.rb, line 34
def generate_token(email:, password:)
  response = api_client.post("/v2/authenticate", email: email, password: password)
  new(response[:access_token], response[:expires_at])
end
new(access_token, expires_at) click to toggle source

Initializes Authorization

@param [String] access_token access token the access token provided by the API @param [Time] expires_at the expiration time for the provided access token

# File lib/bridge_bankin/authorization.rb, line 18
def initialize(access_token, expires_at)
  @access_token = access_token
  @expires_at = Time.parse(expires_at)
end