Class: Printaura::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/printaura/product.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(brand, colors, image_id, mock_image_id, price, app_ids, title, product_id, sku, shopify) ⇒ Product

Returns a new instance of Product.



12
13
14
15
16
17
18
19
20
# File 'lib/printaura/product.rb', line 12

def initialize(brand, colors, image_id, mock_image_id, price, app_ids, title, product_id, sku, shopify)
  # lol :(
  store_images = {"0" => {"image_id" => image_id, "default" => "0"}, "1" => {"image_id" => mock_image_id, "default"=>"1"}}
  args = {brand_id: brand, colors: Base64.encode64(colors.to_json), front_print: image_id, front_mockup: mock_image_id, title: title, description: "", product_price: price, apps: Base64.encode64(app_ids.to_json), product_id: product_id, sku: sku, storeimages: Base64.encode64(store_images.to_json)}
  if shopify
    args = args.merge(shopify)
  end
  Api.addproduct(args)
end

Class Method Details

.allObject



5
6
7
8
9
10
# File 'lib/printaura/product.rb', line 5

def self.all
  # do i care?
  Api.viewproducts.each do |prod|
    puts prod
  end
end