Class: Whitehouse::Order

Inherits:
Object
  • Object
show all
Defined in:
lib/whitehouse/order.rb

Defined Under Namespace

Classes: Address, OrderItem

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Order

Returns a new instance of Order.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
# File 'lib/whitehouse/order.rb', line 10

def initialize
  defaults
  yield self if block_given?
end

Instance Attribute Details

#drop_shipObject

Returns the value of attribute drop_ship.



6
7
8
# File 'lib/whitehouse/order.rb', line 6

def drop_ship
  @drop_ship
end

#entry_idObject

Returns the value of attribute entry_id.



6
7
8
# File 'lib/whitehouse/order.rb', line 6

def entry_id
  @entry_id
end

#from_address=(value) ⇒ Object

Sets the attribute from_address

Parameters:

  • value

    the value to set the attribute from_address to.



6
7
8
# File 'lib/whitehouse/order.rb', line 6

def from_address=(value)
  @from_address = value
end

#from_address_valueObject

Returns the value of attribute from_address_value.



6
7
8
# File 'lib/whitehouse/order.rb', line 6

def from_address_value
  @from_address_value
end

#itemsObject (readonly)

Returns the value of attribute items.



8
9
10
# File 'lib/whitehouse/order.rb', line 8

def items
  @items
end

#order_attributes=(value) ⇒ Object

Sets the attribute order_attributes

Parameters:

  • value

    the value to set the attribute order_attributes to.



6
7
8
# File 'lib/whitehouse/order.rb', line 6

def order_attributes=(value)
  @order_attributes = value
end

#sequence_numberObject

Returns the value of attribute sequence_number.



6
7
8
# File 'lib/whitehouse/order.rb', line 6

def sequence_number
  @sequence_number
end

#to_address=(value) ⇒ Object

Sets the attribute to_address

Parameters:

  • value

    the value to set the attribute to_address to.



6
7
8
# File 'lib/whitehouse/order.rb', line 6

def to_address=(value)
  @to_address = value
end

Instance Method Details

#add_item(item) ⇒ Object



53
54
55
# File 'lib/whitehouse/order.rb', line 53

def add_item(item)
  @items << item
end

#to_jsonObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/whitehouse/order.rb', line 57

def to_json
  {"EntryID" => entry_id,
   "Orders" => [
     {"DropShipFlag" => drop_ship,
       "FromAddressValue" => from_address_value,
       "OrderAttributes" => order_attributes,
       # "Reference" => reference,
       # "Instructions" => instructions,
       "SequenceNumber" => sequence_number,
       "ShipToAddress" => to_address,
       # "ShipFromAddress" => from_address,
       "OrderItems" => order_items
    }
  ]
  }.to_json
end