Method: Megam::Billings.json_create

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

.json_create(o) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/megam/core/billings.rb', line 172

def self.json_create(o)
  cts = new
  cts.id(o["id"]) if o.has_key?("id")
  cts.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
  cts.line1(o["line1"]) if o.has_key?("line1")
  cts.line2(o["line2"]) if o.has_key?("line2")
  cts.country_code(o["country_code"]) if o.has_key?("country_code")
  cts.postal_code(o["postal_code"]) if o.has_key?("postal_code")
  cts.state(o["state"]) if o.has_key?("state")
  cts.phone(o["phone"]) if o.has_key?("phone")
  cts.bill_type(o["bill_type"]) if o.has_key?("bill_type")

  cts.created_at(o["created_at"]) if o.has_key?("created_at")
  #success or error
  cts.some_msg[:code] = o["code"] if o.has_key?("code")
  cts.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
  cts.some_msg[:msg]= o["msg"] if o.has_key?("msg")
  cts.some_msg[:links] = o["links"] if o.has_key?("links")
  cts
end