Module: OmniKassa

Defined in:
lib/omni_kassa.rb,
lib/omni_kassa/version.rb,
lib/omni_kassa/request.rb,
lib/omni_kassa/response.rb

Defined Under Namespace

Classes: ConfigError, OmniKassaError, Request, Response, VERSION

Constant Summary collapse

REQUEST_SETTINGS =
:merchant_id, :currency_code, :transaction_reference,
:customer_language, :key_version
SETTINGS =
REQUEST_SETTINGS + [:secret_key, :url]

Class Method Summary collapse

Class Method Details

.config(settings) ⇒ Object


9
10
11
12
13
14
15
16
# File 'lib/omni_kassa.rb', line 9

def self.config(settings)
  for setting in SETTINGS
    value = settings[setting.to_sym]
    raise ConfigError, "config setting '#{setting}' missing" if value.nil?

    class_variable_set '@@' + setting.to_s, value
  end
end

.request_settingsObject


18
19
20
21
22
# File 'lib/omni_kassa.rb', line 18

def self.request_settings
  Hash[REQUEST_SETTINGS.map do |setting|
    [setting.to_s, class_variable_get('@@' + setting.to_s)]
  end]
end

.secret_keyObject


24
25
26
# File 'lib/omni_kassa.rb', line 24

def self.secret_key
  @@secret_key
end

.urlObject


28
29
30
# File 'lib/omni_kassa.rb', line 28

def self.url
  @@url
end