Class: Klarna::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/klarna/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/klarna/configuration.rb', line 7

def initialize
  @country = :us
  @zone = :us
  @environment = :production
  @debugger = false

  @endpoints = {
    europe: {
      test: 'https://api.playground.klarna.com',
      production: 'https://api.klarna.com'
    },
    oceania: {
      test: 'https://api-oc.playground.klarna.com',
      production: 'https://api-oc.klarna.com'
    },
    us: {
      test: 'https://api-na.playground.klarna.com',
      production: 'https://api-na.klarna.com'
    }
  }
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



5
6
7
# File 'lib/klarna/configuration.rb', line 5

def api_key
  @api_key
end

#api_secretObject

Returns the value of attribute api_secret.



5
6
7
# File 'lib/klarna/configuration.rb', line 5

def api_secret
  @api_secret
end

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/klarna/configuration.rb', line 5

def country
  @country
end

#debuggerObject

Returns the value of attribute debugger.



5
6
7
# File 'lib/klarna/configuration.rb', line 5

def debugger
  @debugger
end

#environmentObject

Returns the value of attribute environment.



5
6
7
# File 'lib/klarna/configuration.rb', line 5

def environment
  @environment
end

#user_agentObject

Returns the value of attribute user_agent.



5
6
7
# File 'lib/klarna/configuration.rb', line 5

def user_agent
  @user_agent
end

#zoneObject

Returns the value of attribute zone.



5
6
7
# File 'lib/klarna/configuration.rb', line 5

def zone
  @zone
end

Instance Method Details

#endpointObject



29
30
31
# File 'lib/klarna/configuration.rb', line 29

def endpoint
  endpoints[zone.to_sym][environment.to_sym]
end