Method: Megam::DiscountsCollection.json_create

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

.json_create(o) ⇒ Object



119
120
121
122
123
124
125
126
127
128
# File 'lib/megam/core/discounts_collection.rb', line 119

def self.json_create(o)
  collection = self.new()
  o["results"].each do |discounts_list|
    discounts_array = discounts_list.kind_of?(Array) ? discounts_list : [ discounts_list ]
    discounts_array.each do |discounts|
      collection.insert(discounts)
    end
  end
  collection
end