Class: Mindee::Product::BillOfLading::BillOfLadingV1Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb

Overview

Bill of Lading API version 1.1 document data.

Direct Known Subclasses

BillOfLadingV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ BillOfLadingV1Document

Returns a new instance of BillOfLadingV1Document.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 52

def initialize(prediction, page_id)
  super
  @bill_of_lading_number = Parsing::Standard::StringField.new(
    prediction['bill_of_lading_number'],
    page_id
  )
  @carrier = Product::BillOfLading::BillOfLadingV1Carrier.new(
    prediction['carrier'],
    page_id
  )
  @carrier_items = Product::BillOfLading::BillOfLadingV1CarrierItems.new(prediction['carrier_items'], page_id)
  @consignee = Product::BillOfLading::BillOfLadingV1Consignee.new(
    prediction['consignee'],
    page_id
  )
  @date_of_issue = Parsing::Standard::DateField.new(
    prediction['date_of_issue'],
    page_id
  )
  @departure_date = Parsing::Standard::DateField.new(
    prediction['departure_date'],
    page_id
  )
  @notify_party = Product::BillOfLading::BillOfLadingV1NotifyParty.new(
    prediction['notify_party'],
    page_id
  )
  @place_of_delivery = Parsing::Standard::StringField.new(
    prediction['place_of_delivery'],
    page_id
  )
  @port_of_discharge = Parsing::Standard::StringField.new(
    prediction['port_of_discharge'],
    page_id
  )
  @port_of_loading = Parsing::Standard::StringField.new(
    prediction['port_of_loading'],
    page_id
  )
  @shipper = Product::BillOfLading::BillOfLadingV1Shipper.new(
    prediction['shipper'],
    page_id
  )
end

Instance Attribute Details

#bill_of_lading_numberMindee::Parsing::Standard::StringField (readonly)

A unique identifier assigned to a Bill of Lading document.



18
19
20
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 18

def bill_of_lading_number
  @bill_of_lading_number
end

#carrierMindee::Product::BillOfLading::BillOfLadingV1Carrier (readonly)

The shipping company responsible for transporting the goods.



21
22
23
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 21

def carrier
  @carrier
end

#carrier_itemsMindee::Product::BillOfLading::BillOfLadingV1CarrierItems (readonly)

The goods being shipped.



24
25
26
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 24

def carrier_items
  @carrier_items
end

#consigneeMindee::Product::BillOfLading::BillOfLadingV1Consignee (readonly)

The party to whom the goods are being shipped.



27
28
29
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 27

def consignee
  @consignee
end

#date_of_issueMindee::Parsing::Standard::DateField (readonly)

The date when the bill of lading is issued.



30
31
32
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 30

def date_of_issue
  @date_of_issue
end

#departure_dateMindee::Parsing::Standard::DateField (readonly)

The date when the vessel departs from the port of loading.



33
34
35
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 33

def departure_date
  @departure_date
end

#notify_partyMindee::Product::BillOfLading::BillOfLadingV1NotifyParty (readonly)

The party to be notified of the arrival of the goods.



36
37
38
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 36

def notify_party
  @notify_party
end

#place_of_deliveryMindee::Parsing::Standard::StringField (readonly)

The place where the goods are to be delivered.



39
40
41
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 39

def place_of_delivery
  @place_of_delivery
end

#port_of_dischargeMindee::Parsing::Standard::StringField (readonly)

The port where the goods are unloaded from the vessel.



42
43
44
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 42

def port_of_discharge
  @port_of_discharge
end

#port_of_loadingMindee::Parsing::Standard::StringField (readonly)

The port where the goods are loaded onto the vessel.



45
46
47
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 45

def port_of_loading
  @port_of_loading
end

#shipperMindee::Product::BillOfLading::BillOfLadingV1Shipper (readonly)

The party responsible for shipping the goods.



48
49
50
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 48

def shipper
  @shipper
end

Instance Method Details

#to_sString

Returns:

  • (String)


98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb', line 98

def to_s
  shipper = @shipper.to_s
  consignee = @consignee.to_s
  notify_party = @notify_party.to_s
  carrier = @carrier.to_s
  carrier_items = carrier_items_to_s
  out_str = String.new
  out_str << "\n:Bill of Lading Number: #{@bill_of_lading_number}".rstrip
  out_str << "\n:Shipper:"
  out_str << shipper
  out_str << "\n:Consignee:"
  out_str << consignee
  out_str << "\n:Notify Party:"
  out_str << notify_party
  out_str << "\n:Carrier:"
  out_str << carrier
  out_str << "\n:Items:"
  out_str << carrier_items
  out_str << "\n:Port of Loading: #{@port_of_loading}".rstrip
  out_str << "\n:Port of Discharge: #{@port_of_discharge}".rstrip
  out_str << "\n:Place of Delivery: #{@place_of_delivery}".rstrip
  out_str << "\n:Date of issue: #{@date_of_issue}".rstrip
  out_str << "\n:Departure Date: #{@departure_date}".rstrip
  out_str[1..].to_s
end