Class: IngramMicro::SalesOrder
- Inherits:
-
Transmission
- Object
- Transmission
- IngramMicro::SalesOrder
- Defined in:
- lib/ingram_micro/transmissions/sales_order.rb
Constant Summary collapse
- TRANSMISSION_FILENAME =
'sales-order-submission'
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.
-
#purchase_order_information ⇒ Object
Returns the value of attribute purchase_order_information.
-
#sales_order_header ⇒ Object
Returns the value of attribute sales_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.
- #validate_options(options) ⇒ Object
- #xml_builder ⇒ Object
Methods inherited from Transmission
#add_transaction_info, #order_builder, #schema_valid?, #send_request, #submit_request
Constructor Details
#initialize(options = {}) ⇒ SalesOrder
Returns a new instance of SalesOrder.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 8 def initialize(={}) super() @transaction_name = 'sales-order-submission' @customer = [:customer] @sales_order_shipment_information = [:sales_order_shipment_information] @credit_card_information = [:credit_card_information] @sales_order_header = [:sales_order_header] @detail = [:detail] @business_name = [:business_name] @customer_id = [:customer_id] @carrier_name = [:carrier_name] @purchase_order_information = [:purchase_order_information] () end |
Instance Attribute Details
#business_name ⇒ Object
Returns the value of attribute business_name.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def business_name @business_name end |
#carrier_name ⇒ Object
Returns the value of attribute carrier_name.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def carrier_name @carrier_name end |
#credit_card_information ⇒ Object
Returns the value of attribute credit_card_information.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def credit_card_information @credit_card_information end |
#customer ⇒ Object
Returns the value of attribute customer.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def customer @customer end |
#customer_id ⇒ Object
Returns the value of attribute customer_id.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def customer_id @customer_id end |
#detail ⇒ Object
Returns the value of attribute detail.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def detail @detail end |
#purchase_order_information ⇒ Object
Returns the value of attribute purchase_order_information.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def purchase_order_information @purchase_order_information end |
#sales_order_header ⇒ Object
Returns the value of attribute sales_order_header.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def sales_order_header @sales_order_header end |
#sales_order_shipment_information ⇒ Object
Returns the value of attribute sales_order_shipment_information.
4 5 6 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 4 def sales_order_shipment_information @sales_order_shipment_information end |
Instance Method Details
#add_message_header(builder) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 34 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
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 44 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, sales_order_header: sales_order_header, credit_card_information: credit_card_information, purchase_order_information: purchase_order_information } sos = IngramMicro::SalesOrderSubmission.new() builder.send('sales-order-submission') do sos.build(builder) end sos.valid? end |
#validate_options(options) ⇒ Object
63 64 65 66 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 63 def () raise "use sales_order_shipment_information (IngramMicro::SalesOrderShipmentInformation" if [:shipment_information] raise "use sales_order_header (IngramMicro::SalesOrderHeader" if [:order_header] end |
#xml_builder ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/ingram_micro/transmissions/sales_order.rb', line 24 def xml_builder @builder ||= Nokogiri::XML::Builder.new do |builder| builder. do (builder) add_sales_order_submission(builder) add_transaction_info(builder) end end end |