Method: Megam::Backups.json_create

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

.json_create(o) ⇒ Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/megam/core/backups.rb', line 176

def self.json_create(o)
    sps = new({})
    sps.id(o["id"]) if o.has_key?("id")
    sps.(o["account_id"]) if o.has_key?("account_id")
    sps.asm_id(o["asm_id"]) if o.has_key?("asm_id")
    sps.org_id(o["org_id"]) if o.has_key?("org_id") #this will be an array? can hash store array?
    sps.tosca_type(o['tosca_type']) if o.key?('tosca_type')
    sps.inputs(o['inputs']) if o.key?('inputs')
    sps.outputs(o['outputs']) if o.key?('outputs')
    sps.name(o["name"]) if o.has_key?("name")
    sps.status(o["status"]) if o.has_key?("status")
    sps.image_id(o["image_id"]) if o.has_key?("image_id")
    sps.created_at(o["created_at"]) if o.has_key?("created_at")
    sps.labels(o["labels"]) if o.key?("labels")
    sps.some_msg[:code] = o["code"] if o.has_key?("code")
    sps.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
    sps.some_msg[:msg]= o["msg"] if o.has_key?("msg")
    sps.some_msg[:links] = o["links"] if o.has_key?("links")
    sps
end