Module: Gentle::Documents::Request::HashConverter

Included in:
ShipmentOrder
Defined in:
lib/gentle/documents/request/hash_converter.rb

Instance Method Summary collapse

Instance Method Details

#bill_to_hashObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/gentle/documents/request/hash_converter.rb', line 40

def bill_to_hash
  {
    'Company'    => bill_address.company,
    'Contact'    => full_name,
    'Address1'   => bill_address.address1,
    'Address2'   => bill_address.address2,
    'City'       => bill_address.city,
    'State'      => bill_address.state.name,
    'PostalCode' => bill_address.zipcode,
    'Country'    => bill_address.country.name
  }
end

#line_item_hash(item) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/gentle/documents/request/hash_converter.rb', line 16

def line_item_hash(item)
  {
    'ItemNumber'      => item.sku,
    'Line'            => item.id,
    'QuantityOrdered' => item.quantity,
    'QuantityToShip'  => item.quantity,
    'UOM'             => 'EA',
    'Price'           => item.price
  }
end

#part_line_item_hash(part) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/gentle/documents/request/hash_converter.rb', line 5

def part_line_item_hash(part)
  {
    'ItemNumber'      => part.variant.sku,
    'Line'            => part.variant.id,
    'QuantityOrdered' => part.line_item.quantity,
    'QuantityToShip'  => part.line_item.quantity,
    'UOM'             => 'EA',
    'Price'           => part.variant.price
  }
end

#ship_to_hashObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/gentle/documents/request/hash_converter.rb', line 27

def ship_to_hash
  {
    'Company'    => ship_address.company,
    'Contact'    => full_name,
    'Address1'   => ship_address.address1,
    'Address2'   => ship_address.address2,
    'City'       => ship_address.city,
    'State'      => ship_address.state.name,
    'PostalCode' => ship_address.zipcode,
    'Country'    => ship_address.country.name
  }
end