Class: BridgeBankin::Authorization
- Inherits:
-
Object
- Object
- BridgeBankin::Authorization
- Extended by:
- BridgeBankin::API::Resource
- Defined in:
- lib/bridge_bankin/authorization.rb
Overview
User authentication & authorization
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
Class Method Summary collapse
-
.generate_token(email:, password:) ⇒ Authorization
Authenticate user with the corresponding credentials.
Instance Method Summary collapse
-
#initialize(access_token, expires_at) ⇒ Authorization
constructor
Initializes Authorization.
Constructor Details
#initialize(access_token, expires_at) ⇒ Authorization
Initializes Authorization
18 19 20 21 |
# 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 |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
10 11 12 |
# File 'lib/bridge_bankin/authorization.rb', line 10 def access_token @access_token end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
10 11 12 |
# File 'lib/bridge_bankin/authorization.rb', line 10 def expires_at @expires_at end |
Class Method Details
.generate_token(email:, password:) ⇒ Authorization
Authenticate user with the corresponding credentials
34 35 36 37 |
# 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 |