Class: Fintecture::AisClient

Inherits:
Object
  • Object
show all
Defined in:
lib/fintecture/ais_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ AisClient

Returns a new instance of AisClient.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fintecture/ais_client.rb', line 16

def initialize(config)
  @app_id = config[:app_id]
  @app_secret = config[:app_secret]
  @private_key = config[:private_key]

  environment = config[:environment].downcase
  unless environment.include?(environment)
    raise "#{environment} not a valid environment, options are [#{environment.join(', ')}]"
  end

  @environment = environment
end

Instance Attribute Details

#app_idObject (readonly)

Getters



30
31
32
# File 'lib/fintecture/ais_client.rb', line 30

def app_id
  @app_id
end

#app_secretObject (readonly)

Getters



30
31
32
# File 'lib/fintecture/ais_client.rb', line 30

def app_secret
  @app_secret
end

#environmentObject (readonly)

Getters



30
31
32
# File 'lib/fintecture/ais_client.rb', line 30

def environment
  @environment
end

#private_keyObject (readonly)

Getters



30
31
32
# File 'lib/fintecture/ais_client.rb', line 30

def private_key
  @private_key
end

#refresh_tokenObject (readonly)

Getters



30
31
32
# File 'lib/fintecture/ais_client.rb', line 30

def refresh_token
  @refresh_token
end

#tokenObject (readonly)

Getters



30
31
32
# File 'lib/fintecture/ais_client.rb', line 30

def token
  @token
end

#token_expires_inObject (readonly)

Getters



30
31
32
# File 'lib/fintecture/ais_client.rb', line 30

def token_expires_in
  @token_expires_in
end

Instance Method Details

#account_holders(customer_id:, remove_nulls: nil) ⇒ Object



69
70
71
72
73
# File 'lib/fintecture/ais_client.rb', line 69

def (customer_id:, remove_nulls: nil)
  res = Fintecture::Ais::AccountHolders.get self, customer_id, remove_nulls

  JSON.parse res.body
end

#accounts(customer_id:, account_id: nil, remove_nulls: nil, withBalances: nil) ⇒ Object



57
58
59
60
61
# File 'lib/fintecture/ais_client.rb', line 57

def accounts(customer_id:, account_id: nil, remove_nulls: nil, withBalances: nil)
  res = Fintecture::Ais::Accounts.get self, customer_id, , remove_nulls, withBalances

  JSON.parse res.body
end

#authorize(provider_id:, redirect_uri:, app_id_auth: false, state: nil, x_psu_id: nil, x_psu_ip_address: nil) ⇒ Object



81
82
83
84
85
86
# File 'lib/fintecture/ais_client.rb', line 81

def authorize(provider_id:, redirect_uri:, app_id_auth: false, state: nil, x_psu_id: nil, x_psu_ip_address: nil)
  res = Fintecture::Ais::Authorize.get self, app_id_auth, provider_id, redirect_uri, state, x_psu_id,
                                       x_psu_ip_address

  JSON.parse res.body
end

#authorize_decoupled(provider_id:, polling_id:, app_id_auth: false) ⇒ Object



88
89
90
91
92
# File 'lib/fintecture/ais_client.rb', line 88

def authorize_decoupled(provider_id:, polling_id:, app_id_auth: false)
  res = Fintecture::Ais::AuthorizeDecoupled.get self, app_id_auth, provider_id, polling_id

  JSON.parse res.body
end

#connect(state, redirect_uri, scope = nil) ⇒ Object

Methodes



33
34
35
36
37
# File 'lib/fintecture/ais_client.rb', line 33

def connect(state, redirect_uri, scope = nil)
  res = Fintecture::Ais::Connect.generate self, state, redirect_uri, scope

  JSON.parse res.body
end

#delete_customer(customer_id:) ⇒ Object



75
76
77
78
79
# File 'lib/fintecture/ais_client.rb', line 75

def delete_customer(customer_id:)
  res = Fintecture::Ais::DeleteCustomer.delete self, customer_id

  JSON.parse res.body
end

#generate_refresh_token(refresh_token = nil) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/fintecture/ais_client.rb', line 49

def generate_refresh_token(refresh_token = nil)
  res = Fintecture::Authentication.refresh_token self, (refresh_token || @refresh_token)
  body = JSON.parse res.body
  @token = body['access_token']

  body
end

#generate_token(auth_code) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/fintecture/ais_client.rb', line 39

def generate_token(auth_code)
  res = Fintecture::Authentication.get_access_token self, auth_code
  body = JSON.parse res.body
  @token = body['access_token']
  @token_expires_in = body['expires_in']
  @refresh_token = body['refresh_token']

  body
end

#transactions(customer_id:, account_id:, remove_nulls: nil, convert_dates: nil, filters: nil) ⇒ Object



63
64
65
66
67
# File 'lib/fintecture/ais_client.rb', line 63

def transactions(customer_id:, account_id:, remove_nulls: nil, convert_dates: nil, filters: nil)
  res = Fintecture::Ais::Transactions.get self, customer_id, , remove_nulls, convert_dates, filters

  JSON.parse res.body
end