Class: Blastramp::Order
Instance Attribute Summary collapse
-
#bill_address ⇒ Object
Associations.
-
#order_items ⇒ Object
Associations.
-
#ship_address ⇒ Object
Associations.
Attributes inherited from Entity
Instance Method Summary collapse
-
#initialize ⇒ Order
constructor
A new instance of Order.
- #initialize_defaults ⇒ Object
-
#soap_data ⇒ Object
Returns OrderedHash with the properties of CurrentInvoice in the correct order, camelcased and ready to be sent via SOAP.
Methods inherited from Entity
has_properties, #inspect, properties, #update_properties
Constructor Details
Instance Attribute Details
#bill_address ⇒ Object
Associations
6 7 8 |
# File 'lib/blastramp/order.rb', line 6 def bill_address @bill_address end |
#order_items ⇒ Object
Associations
6 7 8 |
# File 'lib/blastramp/order.rb', line 6 def order_items @order_items end |
#ship_address ⇒ Object
Associations
6 7 8 |
# File 'lib/blastramp/order.rb', line 6 def ship_address @ship_address end |
Instance Method Details
#initialize_defaults ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/blastramp/order.rb', line 15 def initialize_defaults self.order_id = 0 # The order number. If it is to be determined by Blastramp then submit "TBD" self.po = 0 # Customer purchase order number self.order_date = Time.now.strftime("%m/%d/%Y") # The order date as dd/mm/yyyy self.start_date = Time.now.strftime("%m/%d/%Y") # The orders start date as dd/mm/yyyy. The earliest date the order is expected to be released to the warehouse self.expiry_date = (Time.now + 186400).strftime("%m/%d/%Y") # The orders expiry date as dd/mm/yyyy. The latest date the order would be released to the warehouse self.num_of_cartons = 0 #N umber of cartons expected in the order. Unknown (and default) is "0" self.weight = 0.0 # Estimated weight of the order. Unknown (and default) is "0.0" self.ship_method = nil # Description of the desired shipping method. More detail is better: if known submit carrier, service description and service code. A list of valid values to be used must be provided to Blastramp self.order_terms = "Terms Unknown" # Description of the order terms. Unknown (and default) "Terms Unknown" self.order_type = 'P' # P := Pick and Pack. C := Crossdock. self.order_currency = 'CAD' # IATA Currency of the order. Default is "CAD" self.order_tax = nil # Tax rate to be applied to the order. Default is the current Canada GST rate. self.warehouse_currency = 'CAD' # IATA used by the warehouse DC. Default is "CAD" self.warehouse_id = '0001' # The iOperate identifier for the DC handling the order. Default is "0001" self.note = nil # Other notes or instructions to be attached to the order self.season = nil # The season code to which the order would apply. All available code must be provided to Chrome52 end |
#soap_data ⇒ Object
Returns OrderedHash with the properties of CurrentInvoice in the correct order, camelcased and ready to be sent via SOAP
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/blastramp/order.rb', line 36 def soap_data data = ActiveSupport::OrderedHash.new data['orderid'] = order_id data['po'] = po data['orderDate'] = order_date data['startDate'] = start_date data['expiryDate'] = expiry_date data['numOfCartons'] = num_of_cartons data['weight'] = weight data['shipMethod'] = ship_method data['orderTerms'] = order_terms data['orderType'] = order_type data['orderCurrency'] = order_currency data['orderTax'] = order_tax data['warehouseCurrency'] = warehouse_currency data['warehouseid'] = warehouse_id data['note'] = note data['season'] = season data['shipAddress'] = ship_address.soap_data data['billAddress'] = bill_address.soap_data data['orderItems'] = [] order_items.each do |i| data['orderItems'] << {'OrderItem' => i.soap_data} end return data end |