Class: StarkitBanking::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/starkit_banking/api/environment.rb

Class Method Summary collapse

Class Method Details

.build(credentials) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/starkit_banking/api/environment.rb', line 3

def self.build(credentials)      
  if credentials.environment.try(:upcase) == 'UAT' 
    ::ApiBanking::Environment::YBL::UAT.new(
      credentials.decrypt_username,
      credentials.password,
      credentials.decrypt_client_id,
      credentials.decrypt_client_secret
    )
  elsif credentials.environment.try(:upcase) == 'PROD' 
    ::ApiBanking::Environment::YBL::PRD.new(
      credentials.decrypt_username,
      credentials.password,
      credentials.decrypt_client_id,
      credentials.decrypt_client_secret,
      credentials.client_certificate.path,
      credentials.client_private_key.path,
      credentials.decrypt_client_private_key_pwd
    )
  end
end