Method: Megam::Balances.json_create

Defined in:
lib/megam/core/balances.rb

.json_create(o) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/megam/core/balances.rb', line 124

def self.json_create(o)
  balances = new
  balances.id(o["id"]) if o.has_key?("id")
  balances.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
  balances.name(o["name"]) if o.has_key?("name")
  balances.credit(o["credit"]) if o.has_key?("credit")
  balances.created_at(o["created_at"]) if o.has_key?("created_at")
  balances.updated_at(o["updated_at"]) if o.has_key?("updated_at")
  #success or error
  balances.some_msg[:code] = o["code"] if o.has_key?("code")
  balances.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
  balances.some_msg[:msg]= o["msg"] if o.has_key?("msg")
  balances.some_msg[:links] = o["links"] if o.has_key?("links")
  balances
end