Module: Payture::Api::V1::Configuration

Included in:
Payture::Api::V1
Defined in:
lib/payture/api/v1/configuration.rb

Constant Summary collapse

DOMAIN =
'payture.com'
DEFAULT_API_TYPE =

api, apim, vwapi

'api'
DEFAULT_HOST =

sandbox, secure

'sandbox'
DEFAULT_KEY =
'MerchantKey'
DEFAULT_PASSWORD =
nil
DEFAULT_USER_AGENT =
"Payture API V1 Ruby Gem #{Payture::Api::V1::VERSION}".freeze
VALID_OPTIONS_KEYS =
[
  :api_type,
  :host,
  :key,
  :password,
  :user_agent
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



24
25
26
# File 'lib/payture/api/v1/configuration.rb', line 24

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



36
37
38
# File 'lib/payture/api/v1/configuration.rb', line 36

def configure
  yield self
end

#optionsObject



40
41
42
# File 'lib/payture/api/v1/configuration.rb', line 40

def options
  Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]
end

#resetObject



28
29
30
31
32
33
34
# File 'lib/payture/api/v1/configuration.rb', line 28

def reset
  self.api_type = DEFAULT_API_TYPE
  self.host = DEFAULT_HOST
  self.key = DEFAULT_KEY
  self.password = DEFAULT_PASSWORD
  self.user_agent = DEFAULT_USER_AGENT
end