Class: FriendlyShipping::Services::UpsFreight::ParseShipmentDocument
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::UpsFreight::ParseShipmentDocument
- Defined in:
- lib/friendly_shipping/services/ups_freight/parse_shipment_document.rb
Constant Summary collapse
- REVERSE_DOCUMENT_TYPES =
LabelDocumentOptions::DOCUMENT_TYPES.map(&:reverse_each).to_h(&:to_a)
Class Method Summary collapse
Class Method Details
.call(image_data:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/friendly_shipping/services/ups_freight/parse_shipment_document.rb', line 9 def self.call(image_data:) format_code = image_data.dig("Type", "Code") graphic_image_b64 = image_data["GraphicImage"] ShipmentDocument.new( format: image_data.dig("Format", "Code").downcase.to_sym, binary: Base64.decode64(graphic_image_b64), document_type: REVERSE_DOCUMENT_TYPES.fetch(format_code) ) end |