Class: Ibanity::IsabelConnect::Token
- Inherits:
-
OAuthResource
- Object
- OpenStruct
- OAuthResource
- Ibanity::IsabelConnect::Token
- Defined in:
- lib/ibanity/api/isabel_connect/token.rb
Class Method Summary collapse
- .create(refresh_token: nil, authorization_code: nil, redirect_uri: nil, idempotency_key: nil) ⇒ Object
- .delete(refresh_token:) ⇒ Object
Methods inherited from OAuthResource
create_by_uri, find_by_uri, #initialize
Constructor Details
This class inherits a constructor from Ibanity::OAuthResource
Class Method Details
.create(refresh_token: nil, authorization_code: nil, redirect_uri: nil, idempotency_key: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ibanity/api/isabel_connect/token.rb', line 4 def self.create(refresh_token: nil, authorization_code: nil, redirect_uri: nil, idempotency_key: nil) uri = Ibanity.isabel_connect_api_schema["oAuth2"]["token"] arguments = if refresh_token [ ["grant_type", "refresh_token"], ["refresh_token", refresh_token] ] elsif [ ["grant_type", "authorization_code"], ["code", ], ["redirect_uri", redirect_uri] ] end create_by_uri( uri: uri, payload: URI.encode_www_form(arguments), idempotency_key: idempotency_key, headers: self.headers ) end |
.delete(refresh_token:) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/ibanity/api/isabel_connect/token.rb', line 27 def self.delete(refresh_token:) uri = Ibanity.isabel_connect_api_schema["oAuth2"]["revoke"] arguments = [ ["token", refresh_token] ] payload = URI.encode_www_form(arguments) create_by_uri(uri: uri, payload: payload, headers: self.headers) end |