Module: KazkomEpay::Configurator

Included in:
KazkomEpay
Defined in:
lib/kazkom_epay.rb

Constant Summary collapse

@@currency =
398

Instance Method Summary collapse

Instance Method Details

#configure(attrs = {}) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/kazkom_epay.rb', line 129

def configure(attrs = {})
  attrs.each do |k, v|
    self.send(:"#{k}=", v) if CONFIGURABLE_ATTRIBUTES.include?(k.to_sym)
  end
  yield self if block_given?

  if (blank = CONFIGURABLE_ATTRIBUTES.map { |att| [att, self.send(att)] }.select{|_, val| val.nil?}).count > 0
    blank_attribute_names = blank.map { |attr, _| attr }.join(", ")
    raise "Some required attributes left blank: #{blank_attribute_names}"
  end

  self
end

#configure_for_testObject



125
126
127
# File 'lib/kazkom_epay.rb', line 125

def configure_for_test
  configure(DEFAULTS)
end