Sha256: 6f09e96ae44c2ebd2a31a85646d2581c447023403672aaca3081385498538f92
Contents?: true
Size: 727 Bytes
Versions: 1
Compression:
Stored size: 727 Bytes
Contents
# frozen_string_literal: true require 'friendly_shipping/services/ups_freight/shipment_document' module FriendlyShipping module Services class UpsFreight class ParseShipmentDocument REVERSE_DOCUMENT_TYPES = LabelDocumentOptions::DOCUMENT_TYPES.map(&:reverse_each).to_h(&:to_a) 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 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
friendly_shipping-0.9.0 | lib/friendly_shipping/services/ups_freight/parse_shipment_document.rb |