Method: Datacash::Response::Base#initialize

Defined in:
lib/datacash/response/base.rb

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/datacash/response/base.rb', line 8

def initialize(attributes = {})
  self.class.keys.each do |key, options|
    next unless options.has_key?(:from)

    from = options[:from].to_sym
    if attributes.has_key?(from)
      attributes[key] = attributes.delete(from)
    end
  end
  super(attributes)
end