Module: SolidusShipwire::Variant

Includes:
Proxy
Defined in:
app/models/variant_decorator.rb

Instance Method Summary collapse

Methods included from Proxy

#create_on_shipwire, #find_on_shipwire, #find_or_create_on_shipwire_api, #in_shipwire, prepended, #update_on_shipwire

Instance Method Details

#to_shipwireObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/variant_decorator.rb', line 9

def to_shipwire
  {
    sku: sku,
    classification: "baseProduct",
    description: name,
    countryOfOrigin: "US",
    category: "FURNITURE_&_APPLIANCES",
    batteryConfiguration: 'NOBATTERY',
    values: {
      costValue: self.price,
    #  wholesaleValue: 2,
      retailValue: self.price,
      costCurrency: "USD",
    #  wholesaleCurrency: "USD",
      retailCurrency: "USD"
    },
    dimensions: {
      length: 1,
      width: 10,
      height: 1,
      weight: 1
    }
  }
end

#to_shipwire_object(hash) ⇒ Object



34
35
36
# File 'app/models/variant_decorator.rb', line 34

def to_shipwire_object(hash)
  ShipwireObject.new(hash["id"], self, hash)
end

#update_stocks_from_shipwireObject



5
6
7
# File 'app/models/variant_decorator.rb', line 5

def update_stocks_from_shipwire
  Shipwire::Stock.new.list( sku: self.sku)
end