Module: EcwidGateway::Config

Included in:
EcwidGateway
Defined in:
lib/ecwid_gateway/config.rb

Constant Summary collapse

DEFAULT_API_DOMAIN =

Defaultapi domain

'http://127.0.0.1:80'
DEFAULT_STORE_ID =

Defailt api token

nil
VALID_OPTIONS_KEYS =

Valid options keys

[
  :store_id,
  :api_domain,
  :order_secure_auth_key,
  :sso_secure_auth_key
]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



21
22
23
# File 'lib/ecwid_gateway/config.rb', line 21

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



25
26
27
28
# File 'lib/ecwid_gateway/config.rb', line 25

def configure
  yield self
  self
end

#optionsHash

Create a hash of options and their values

Returns:

  • (Hash)


33
34
35
36
37
# File 'lib/ecwid_gateway/config.rb', line 33

def options
  options = {}
  VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}
  options
end

#resetself

Reset config

Returns:

  • (self)


42
43
44
45
46
# File 'lib/ecwid_gateway/config.rb', line 42

def reset
  self.store_id   = DEFAULT_STORE_ID
  self.api_domain = DEFAULT_API_DOMAIN
  self
end