lib/mws/orders/parser.rb in mws-orders-0.3.0 vs lib/mws/orders/parser.rb in mws-orders-0.3.1
- old
+ new
@@ -6,33 +6,34 @@
require 'mws/orders/service_status'
module MWS
module Orders
class Parser
- SERVICE_STATUS = /GetServiceStatus/
- ORDER = /GetOrder/
- ORDERS = /ListOrders/
- ORDER_ITEMS = /ListOrderItems/
+ include ::Peddler::Headers
def initialize(response, _encoding)
@response = response
end
def parse
node = find_result_node
case node.name
- when SERVICE_STATUS
+ when /GetServiceStatus/
ServiceStatus.new(node)
- when ORDER
+ when /GetOrder/
Orders.new(node).first
- when ORDERS
+ when /ListOrders/
Orders.new(node)
- when ORDER_ITEMS
+ when /ListOrderItems/
OrderItems.new(node)
else
raise NotImplementedError
end
+ end
+
+ def headers
+ @response.headers
end
private
def find_result_node