class APIStruct

Attributes

raw[R]

Public Class Methods

new(atts = {}) click to toggle source
Calls superclass method
# File lib/ey_services_api/api_struct.rb, line 4
def initialize(atts = {})
  #converting all keys of atts to Symbols
  @raw = atts
  atts = Hash[atts.map {|k,v| [k.to_sym, v]}]
  super(*atts.values_at(*self.members.map(&:to_sym)))
end

Public Instance Methods

to_hash() click to toggle source
# File lib/ey_services_api/api_struct.rb, line 11
def to_hash
  Hash[members.map(&:to_sym).zip(entries)]
end

Protected Instance Methods

update_from_hash(atts) click to toggle source
# File lib/ey_services_api/api_struct.rb, line 16
def update_from_hash(atts)
  atts.each do |k, v|
    self.send("#{k}=", v)
  end
end