Class: FriendlyShipping::Services::RL::ShipmentInformation

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

Overview

Represents information for a specific shipment. This includes one or more documents, a PRO number, and a pickup request number.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pro_number:, pickup_request_number: nil, documents: []) ⇒ ShipmentInformation

Returns a new instance of ShipmentInformation.

Parameters:

  • pro_number (String)

    the shipment's PRO number

  • pickup_request_number (String) (defaults to: nil)

    the shipment's pickup request number

  • documents (Array<ShipmentDocument>) (defaults to: [])

    the shipment's documents (BOL, labels, etc)



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

def initialize(
  pro_number:,
  pickup_request_number: nil,
  documents: []
)
  @pro_number = pro_number
  @pickup_request_number = pickup_request_number
  @documents = documents
end

Instance Attribute Details

#documentsArray<ShipmentDocument> (readonly)

Returns the shipment's documents.

Returns:



16
17
18
# File 'lib/friendly_shipping/services/rl/shipment_information.rb', line 16

def documents
  @documents
end

#pickup_request_numberString (readonly)

Returns the shipment's pickup request number.

Returns:

  • (String)

    the shipment's pickup request number



13
14
15
# File 'lib/friendly_shipping/services/rl/shipment_information.rb', line 13

def pickup_request_number
  @pickup_request_number
end

#pro_numberString (readonly)

Returns the shipment's PRO number.

Returns:

  • (String)

    the shipment's PRO number



10
11
12
# File 'lib/friendly_shipping/services/rl/shipment_information.rb', line 10

def pro_number
  @pro_number
end

Instance Method Details

#valid?Boolean

Returns true if PRO number and pickup request number are present. Returns false if either of these values are missing.

Returns:

  • (Boolean)


35
36
37
# File 'lib/friendly_shipping/services/rl/shipment_information.rb', line 35

def valid?
  pro_number.present? && pickup_request_number.present?
end