Class: FriendlyShipping::Services::RL::ShipmentDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/rl/shipment_document.rb

Overview

Represents an R+L shipment document such as a BOL or shipping label.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format:, document_type:, binary:) ⇒ ShipmentDocument

Returns a new instance of ShipmentDocument.

Parameters:

  • format (String)

    the format of the document's binary data

  • document_type (String)

    the type of document

  • binary (String)

    the document's binary data



20
21
22
23
24
25
26
27
28
# File 'lib/friendly_shipping/services/rl/shipment_document.rb', line 20

def initialize(
  format:,
  document_type:,
  binary:
)
  @format = format
  @document_type = document_type
  @binary = binary
end

Instance Attribute Details

#binaryString (readonly)

Returns the document's binary data.

Returns:

  • (String)

    the document's binary data



15
16
17
# File 'lib/friendly_shipping/services/rl/shipment_document.rb', line 15

def binary
  @binary
end

#document_typeString (readonly)

Returns the type of document.

Returns:

  • (String)

    the type of document



12
13
14
# File 'lib/friendly_shipping/services/rl/shipment_document.rb', line 12

def document_type
  @document_type
end

#formatString (readonly)

Returns the format of the document's binary data.

Returns:

  • (String)

    the format of the document's binary data



9
10
11
# File 'lib/friendly_shipping/services/rl/shipment_document.rb', line 9

def format
  @format
end

Instance Method Details

#valid?Boolean

Returns true if format, document type, and binary data are all present. Returns false if any of these values are missing.

Returns:

  • (Boolean)


34
35
36
# File 'lib/friendly_shipping/services/rl/shipment_document.rb', line 34

def valid?
  format.present? && document_type.present? && binary.present?
end