Class: Ibanity::IsabelConnect::RefreshToken

Inherits:
OAuthResource
  • Object
show all
Defined in:
lib/ibanity/api/isabel_connect/refresh_token.rb

Class Method Summary collapse

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(authorization_code:, redirect_uri:, idempotency_key: nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ibanity/api/isabel_connect/refresh_token.rb', line 4

def self.create(authorization_code:, redirect_uri:, idempotency_key: nil)
  warn "WARNING: Ibanity::IsabelConnect::RefreshToken.create is deprecated, please use Ibanity::IsabelConnect::Token.create instead"
  uri = Ibanity.isabel_connect_api_schema["oAuth2"]["refreshTokens"]["create"]
  arguments = [
    ["grant_type", "authorization_code"],
    ["code", authorization_code],
    ["client_id", Ibanity.client.isabel_connect_client_id],
    ["client_secret", Ibanity.client.isabel_connect_client_secret],
    ["redirect_uri", redirect_uri]
  ]
  payload = URI.encode_www_form(arguments)
  create_by_uri(uri: uri, payload: payload, idempotency_key: idempotency_key)
end

.delete(token:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ibanity/api/isabel_connect/refresh_token.rb', line 18

def self.delete(token:)
  warn "WARNING: Ibanity::IsabelConnect::RefreshToken.delete is deprecated, please use Ibanity::IsabelConnect::Token.delete instead"
  uri = Ibanity.isabel_connect_api_schema["oAuth2"]["refreshTokens"]["revoke"]
  arguments = [
    ["token", token],
    ["client_id", Ibanity.client.isabel_connect_client_id],
    ["client_secret", Ibanity.client.isabel_connect_client_secret]
  ]
  payload = URI.encode_www_form(arguments)
  create_by_uri(uri: uri, payload: payload)
end