Class: MWS::MerchantFulfillment::Parser
- Inherits:
-
Object
- Object
- MWS::MerchantFulfillment::Parser
- Includes:
- Peddler::Headers
- Defined in:
- lib/mws/merchant_fulfillment/parser.rb
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(response, _encoding) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
- #status_code ⇒ Object
Constructor Details
#initialize(response, _encoding) ⇒ Parser
Returns a new instance of Parser.
14 15 16 |
# File 'lib/mws/merchant_fulfillment/parser.rb', line 14 def initialize(response, _encoding) @response = response end |
Instance Method Details
#body ⇒ Object
45 46 47 |
# File 'lib/mws/merchant_fulfillment/parser.rb', line 45 def body @response.body end |
#headers ⇒ Object
37 38 39 |
# File 'lib/mws/merchant_fulfillment/parser.rb', line 37 def headers @response.headers end |
#parse ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mws/merchant_fulfillment/parser.rb', line 18 def parse node = find_result_node case node.name when /GetServiceStatus/ ServiceStatus.new(node) when /GetEligibleShippingServices/ ShippingServices.new(node) when /CreateShipment/ shipment_node = node.children.find { |node| node.name == 'Shipment' } Shipment.new(shipment_node) when /CancelShipment/ shipment_node = node.children.find { |node| node.name == 'Shipment' } Shipment.new(shipment_node) else raise NotImplementedError end end |
#status_code ⇒ Object
41 42 43 |
# File 'lib/mws/merchant_fulfillment/parser.rb', line 41 def status_code @response.status end |