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.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/klarna/configuration.rb', line 5

def initialize
  @country = :us
  @environment = :production
  @endpoints = Hash.new(
    test: "https://api.playground.klarna.com",
    production: "https://api.klarna.com"
  )
  # US has a different host
  @endpoints[:us] = {
    test: "https://api-na.playground.klarna.com",
    production: "https://api-na.klarna.com"
  }
  @version = :v1
  @debugger = false #$stdout
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/klarna/configuration.rb', line 3

def api_key
  @api_key
end

#api_secretObject

Returns the value of attribute api_secret.



3
4
5
# File 'lib/klarna/configuration.rb', line 3

def api_secret
  @api_secret
end

#countryObject

Returns the value of attribute country.



3
4
5
# File 'lib/klarna/configuration.rb', line 3

def country
  @country
end

#debuggerObject

Returns the value of attribute debugger.



3
4
5
# File 'lib/klarna/configuration.rb', line 3

def debugger
  @debugger
end

#environmentObject

Returns the value of attribute environment.



3
4
5
# File 'lib/klarna/configuration.rb', line 3

def environment
  @environment
end

#user_agentObject

Returns the value of attribute user_agent.



3
4
5
# File 'lib/klarna/configuration.rb', line 3

def user_agent
  @user_agent
end

#versionObject

Returns the value of attribute version.



3
4
5
# File 'lib/klarna/configuration.rb', line 3

def version
  @version
end

Instance Method Details

#endpointObject



21
22
23
# File 'lib/klarna/configuration.rb', line 21

def endpoint
  @endpoints[@country.to_sym][@environment.to_sym]
end