Method: Megam::PredefCloudCollection.json_create

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

.json_create(o) ⇒ Object

{ “json_claz”:“Megam::PredefCloudCollection”, “results”:[{ “id”:“NOD362554470640386048”, “name”:“ec2_rails”, “account_id”:“ACT362544229488001024”, “json_claz”:“Megam::PredefCloud”, “spec”:{ “type_name”:“sensor-type”, “groups”:“sens-group”, “image”:“sens-image”, “flavor”:“sens-flvr” }, “access”:{ “ssh_key”:“sens-ssh”, “identity_file”:“sens-identity-file”, “ssh_user”:“sens-sshuser” }, “ideal”:“”, “performance”:“” }] }



143
144
145
146
147
148
149
150
151
152
# File 'lib/megam/core/predefcloud_collection.rb', line 143

def self.json_create(o)
  collection = self.new()
  o["results"].each do |predefclouds_list|
    predefclouds_array = predefclouds_list.kind_of?(Array) ? predefclouds_list : [ predefclouds_list ]
    predefclouds_array.each do |predefclouds|
      collection.insert(predefclouds)
    end
  end
  collection
end