Class: IngramMicro::SalesOrder
- Inherits:
-
Transmission
- Object
- Transmission
- IngramMicro::SalesOrder
- Defined in:
- lib/ingram_micro/transmissions/sales_order.rb
Constant Summary
Constants inherited from Transmission
Instance Attribute Summary collapse
-
#business_name ⇒ Object
Returns the value of attribute business_name.
-
#carrier_name ⇒ Object
Returns the value of attribute carrier_name.
-
#credit_card_information ⇒ Object
Returns the value of attribute credit_card_information.
-
#customer ⇒ Object
Returns the value of attribute customer.
-
#customer_id ⇒ Object
Returns the value of attribute customer_id.
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#order_header ⇒ Object
Returns the value of attribute order_header.
-
#sales_order_shipment_information ⇒ Object
Returns the value of attribute sales_order_shipment_information.
Attributes inherited from Transmission
Instance Method Summary collapse
- #add_message_header(builder) ⇒ Object
- #add_sales_order_submission(builder) ⇒ Object
-
#initialize(options = {}) ⇒ SalesOrder
constructor
A new instance of SalesOrder.
- #order_builder ⇒ Object
Methods inherited from Transmission
#add_transaction_info, #schema_valid?, #send_request, #submit_request
Constructor Details
#initialize(options = {}) ⇒ SalesOrder
Returns a new instance of SalesOrder.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 6 def initialize(={}) super() @transaction_name = 'sales-order-submission' @customer = [:customer] @sales_order_shipment_information = [:sales_order_shipment_information] @credit_card_information = [:credit_card_information] @order_header = [:order_header] @detail = [:detail] @business_name = [:business_name] @customer_id = [:customer_id] @carrier_name = [:carrier_name] end |
Instance Attribute Details
#business_name ⇒ Object
Returns the value of attribute business_name.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def business_name @business_name end |
#carrier_name ⇒ Object
Returns the value of attribute carrier_name.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def carrier_name @carrier_name end |
#credit_card_information ⇒ Object
Returns the value of attribute credit_card_information.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def credit_card_information @credit_card_information end |
#customer ⇒ Object
Returns the value of attribute customer.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def customer @customer end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def customer_id @customer_id end |
#detail ⇒ Object
Returns the value of attribute detail.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def detail @detail end |
#order_header ⇒ Object
Returns the value of attribute order_header.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def order_header @order_header end |
#sales_order_shipment_information ⇒ Object
Returns the value of attribute sales_order_shipment_information.
2 3 4 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 2 def sales_order_shipment_information @sales_order_shipment_information end |
Instance Method Details
#add_message_header(builder) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 29 def (builder) = IngramMicro::MessageHeaderPW.new({ partner_name: IngramMicro.configuration.partner_name, transaction_name: transaction_name}) builder.send('message-header') do .build(builder) end .valid? end |
#add_sales_order_submission(builder) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 39 def add_sales_order_submission(builder) = { detail: detail, business_name: @business_name, customer_id: @customer_id, carrier_name: @carrier_name, customer: customer, sales_order_shipment_information: sales_order_shipment_information, order_header: order_header, credit_card_information: credit_card_information } sos = IngramMicro::SalesOrderSubmission.new() builder.send('sales-order-submission') do sos.build(builder) end sos.valid? end |
#order_builder ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 19 def order_builder @builder ||= Nokogiri::XML::Builder.new do |builder| builder. do (builder) add_sales_order_submission(builder) add_transaction_info(builder) end end end |