class Newgistics::ResponseHandlers::PostShipment

Attributes

order[R]

Public Class Methods

new(order) click to toggle source
# File lib/newgistics/response_handlers/post_shipment.rb, line 6
def initialize(order)
  @order = order
end

Public Instance Methods

handle(response) click to toggle source
# File lib/newgistics/response_handlers/post_shipment.rb, line 10
def handle(response)
  PostErrors.new(order).handle(response)
  if order.errors.empty?
    handle_successful_response(response)
  end
end

Private Instance Methods

handle_successful_response(response) click to toggle source
# File lib/newgistics/response_handlers/post_shipment.rb, line 19
def handle_successful_response(response)
  xml = Nokogiri::XML(response.body)
  order.shipment_id = xml.css('shipment').first['id']
end