Permalink
Browse files

Simplified the UPS label recovery service to be more consistent with …

…how labels are returned from the ShipAccept service.
  • Loading branch information...
1 parent 11a6908 commit 64c621f4ea90bf2667d6cbba6d3cc5f1e60ada84 @laserlemon laserlemon committed with Jun 21, 2010
Showing with 6 additions and 12 deletions.
  1. +6 −12 lib/shippinglogic/ups/label.rb
@@ -7,22 +7,11 @@ def self.path
"/LabelRecovery"
end
- class Details
- attr_accessor :format, :content
-
- def initialize(response)
- return unless details = response.fetch(:label_results, {})[:label_image]
-
- self.format = label[:label_image_format][:code]
- self.content = label[:graphic_image]
- end
- end
-
attribute :tracking_number, :string
private
def target
- @target ||= Details.new(request(build_request))
+ @target ||= parse_response(request(build_request))
end
# Just building some XML to send off to USP using our various options
@@ -51,6 +40,11 @@ def build_request
b.TrackingNumber tracking_number
end
end
+
+ def parse_response(response)
+ return unless details = response.fetch(:label_results, {})[:label_image]
+ Base64.decode64(details[:graphic_image])
+ end
end
end
end

0 comments on commit 64c621f

Please sign in to comment.