Class: IngramMicro::StandardResponse
- Inherits:
-
Transmission
- Object
- Transmission
- IngramMicro::StandardResponse
- Defined in:
- lib/ingram_micro/transmissions/standard_response.rb
Direct Known Subclasses
Constant Summary collapse
- TRANSMISSION_FILENAME =
'standard-response'
Constants inherited from Transmission
Instance Attribute Summary collapse
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#response_timestamp ⇒ Object
Returns the value of attribute response_timestamp.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
-
#status_description ⇒ Object
Returns the value of attribute status_description.
-
#transaction_name ⇒ Object
Returns the value of attribute transaction_name.
Attributes inherited from Transmission
Instance Method Summary collapse
- #add_message_header(builder) ⇒ Object
- #add_message_status(builder) ⇒ Object
-
#initialize(options = {}) ⇒ StandardResponse
constructor
A new instance of StandardResponse.
- #to_xml(opts = {}) ⇒ Object
- #xml_builder ⇒ Object
Methods inherited from Transmission
#add_transaction_info, #order_builder, #schema_valid?, #send_request, #submit_request
Constructor Details
#initialize(options = {}) ⇒ StandardResponse
Returns a new instance of StandardResponse.
7 8 9 10 11 12 13 14 15 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 7 def initialize(={}) super() @transaction_name = [:transaction_name] @status_code = [:status_code] @status_description = [:status_description] @comments = [:comments] @response_timestamp = [:response_timestamp] @filename = [:filename] end |
Instance Attribute Details
#comments ⇒ Object
Returns the value of attribute comments.
4 5 6 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 4 def comments @comments end |
#filename ⇒ Object
Returns the value of attribute filename.
4 5 6 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 4 def filename @filename end |
#response_timestamp ⇒ Object
Returns the value of attribute response_timestamp.
4 5 6 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 4 def @response_timestamp end |
#status_code ⇒ Object
Returns the value of attribute status_code.
4 5 6 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 4 def status_code @status_code end |
#status_description ⇒ Object
Returns the value of attribute status_description.
4 5 6 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 4 def status_description @status_description end |
#transaction_name ⇒ Object
Returns the value of attribute transaction_name.
4 5 6 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 4 def transaction_name @transaction_name end |
Instance Method Details
#add_message_header(builder) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 31 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_message_status(builder) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 41 def (builder) = IngramMicro::MessageStatus.new({ status_code: @status_code, status_description: @status_description, comments: @comments, response_timestamp: @response_timestamp, filename: @filename }) builder.send('message-status') do .build(builder) end end |
#to_xml(opts = {}) ⇒ Object
17 18 19 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 17 def to_xml(opts={}) xml_builder.to_xml end |
#xml_builder ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/ingram_micro/transmissions/standard_response.rb', line 21 def xml_builder @builder ||= Nokogiri::XML::Builder.new do |builder| builder. do (builder) (builder) add_transaction_info(builder) end end end |