Sha256: ade0c6950843418f3b9bfb0a3ce9b4c5c5be51dc5ab0925cec11552d40b586e0

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module FriendlyShipping
  module Services
    class RL
      # Represents an R+L shipment document such as a BOL or shipping label.
      class ShipmentDocument
        # @return [String] the format of the document's binary data
        attr_reader :format

        # @return [String] the type of document
        attr_reader :document_type

        # @return [String] the document's binary data
        attr_reader :binary

        # @param format [String] the format of the document's binary data
        # @param document_type [String] the type of document
        # @param binary [String] the document's binary data
        def initialize(
          format:,
          document_type:,
          binary:
        )
          @format = format
          @document_type = document_type
          @binary = binary
        end

        # Returns true if format, document type, and binary data are all present.
        # Returns false if any of these values are missing.
        #
        # @return [Boolean]
        def valid?
          format.present? && document_type.present? && binary.present?
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
friendly_shipping-0.10.1 lib/friendly_shipping/services/rl/shipment_document.rb
friendly_shipping-0.10.0 lib/friendly_shipping/services/rl/shipment_document.rb
friendly_shipping-0.9.0 lib/friendly_shipping/services/rl/shipment_document.rb