Method: Megam::Subscriptions.json_create

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

.json_create(o) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/megam/core/subscriptions.rb', line 110

def self.json_create(o)
    sbs = new({})
    sbs.id(o["id"]) if o.has_key?("id")
    sbs.(o["account_id"]) if o.has_key?("account_id")
    sbs.model(o["model"]) if o.has_key?("model")
    sbs.license(o["license"]) if o.has_key?("license")
    sbs.trial_ends(o["trial_ends"]) if o.has_key?("trial_ends")
    sbs.created_at(o["created_at"]) if o.has_key?("created_at")
    #success or error
    sbs.some_msg[:code] = o["code"] if o.has_key?("code")
    sbs.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
    sbs.some_msg[:msg]= o["msg"] if o.has_key?("msg")
    sbs.some_msg[:links] = o["links"] if o.has_key?("links")
    sbs
end