class Fintecture::Authentication
Public Class Methods
get_access_token(auth_code = nil)
click to toggle source
# File lib/fintecture/authentication.rb, line 19 def get_access_token(auth_code = nil) body = access_token_data auth_code Fintecture::Faraday::Authentication::Connection.post url: access_token_url, req_body: body end
refresh_token(refresh_token)
click to toggle source
# File lib/fintecture/authentication.rb, line 25 def refresh_token(refresh_token) body = refresh_token_data refresh_token Fintecture::Faraday::Authentication::Connection.post url: refresh_token_url, req_body: body end
Private Class Methods
access_token_data(auth_code)
click to toggle source
# File lib/fintecture/authentication.rb, line 49 def access_token_data(auth_code) data = { scope: 'PIS', app_id: Fintecture.app_id, grant_type: 'client_credentials' } if auth_code data = { scope: 'AIS', code: auth_code, grant_type: 'authorization_code' } end data end
access_token_url()
click to toggle source
# File lib/fintecture/authentication.rb, line 41 def access_token_url "#{base_url}#{Fintecture::Api::Endpoints::Authentication::OAUTH_ACCESS_TOKEN}" end
base_url()
click to toggle source
# File lib/fintecture/authentication.rb, line 33 def base_url Fintecture::Api::BaseUrl::FINTECTURE_OAUTH_URL[Fintecture.environment.to_sym] end
refresh_token_data(refresh_token)
click to toggle source
# File lib/fintecture/authentication.rb, line 67 def refresh_token_data(refresh_token) { grant_type: 'refresh_token', refresh_token: refresh_token } end
refresh_token_url()
click to toggle source
# File lib/fintecture/authentication.rb, line 45 def refresh_token_url "#{base_url}#{Fintecture::Api::Endpoints::Authentication::OAUTH_REFRESH_TOKEN}" end