Method: Megam::Subscriptions.json_create

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

.json_create(o) ⇒ Object



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/megam/core/subscriptions.rb', line 128

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.assembly_id(o["assembly_id"]) if o.has_key?("assembly_id")
  cts.start_date(o["start_date"]) if o.has_key?("start_date")
  cts.end_date(o["end_date"]) if o.has_key?("end_date")

  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