Class: Mindee::Product::BillOfLading::BillOfLadingV1Document
- Inherits:
-
Mindee::Parsing::Common::Prediction
- Object
- Mindee::Parsing::Common::Prediction
- Mindee::Product::BillOfLading::BillOfLadingV1Document
- 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
Instance Attribute Summary collapse
-
#bill_of_lading_number ⇒ Mindee::Parsing::Standard::StringField
readonly
A unique identifier assigned to a Bill of Lading document.
-
#carrier ⇒ Mindee::Product::BillOfLading::BillOfLadingV1Carrier
readonly
The shipping company responsible for transporting the goods.
-
#carrier_items ⇒ Array<Mindee::Product::BillOfLading::BillOfLadingV1CarrierItem>
readonly
The goods being shipped.
-
#consignee ⇒ Mindee::Product::BillOfLading::BillOfLadingV1Consignee
readonly
The party to whom the goods are being shipped.
-
#date_of_issue ⇒ Mindee::Parsing::Standard::DateField
readonly
The date when the bill of lading is issued.
-
#departure_date ⇒ Mindee::Parsing::Standard::DateField
readonly
The date when the vessel departs from the port of loading.
-
#notify_party ⇒ Mindee::Product::BillOfLading::BillOfLadingV1NotifyParty
readonly
The party to be notified of the arrival of the goods.
-
#place_of_delivery ⇒ Mindee::Parsing::Standard::StringField
readonly
The place where the goods are to be delivered.
-
#port_of_discharge ⇒ Mindee::Parsing::Standard::StringField
readonly
The port where the goods are unloaded from the vessel.
-
#port_of_loading ⇒ Mindee::Parsing::Standard::StringField
readonly
The port where the goods are loaded onto the vessel.
-
#shipper ⇒ Mindee::Product::BillOfLading::BillOfLadingV1Shipper
readonly
The party responsible for shipping the goods.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ BillOfLadingV1Document
constructor
A new instance of BillOfLadingV1Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ BillOfLadingV1Document
Returns a new instance of BillOfLadingV1Document.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# 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 = StringField.new(prediction['bill_of_lading_number'], page_id) @carrier = BillOfLadingV1Carrier.new(prediction['carrier'], page_id) @carrier_items = [] prediction['carrier_items'].each do |item| @carrier_items.push(BillOfLadingV1CarrierItem.new(item, page_id)) end @consignee = BillOfLadingV1Consignee.new(prediction['consignee'], page_id) @date_of_issue = DateField.new(prediction['date_of_issue'], page_id) @departure_date = DateField.new(prediction['departure_date'], page_id) @notify_party = BillOfLadingV1NotifyParty.new(prediction['notify_party'], page_id) @place_of_delivery = StringField.new(prediction['place_of_delivery'], page_id) @port_of_discharge = StringField.new(prediction['port_of_discharge'], page_id) @port_of_loading = StringField.new(prediction['port_of_loading'], page_id) @shipper = BillOfLadingV1Shipper.new(prediction['shipper'], page_id) end |
Instance Attribute Details
#bill_of_lading_number ⇒ Mindee::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 |
#carrier ⇒ Mindee::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_items ⇒ Array<Mindee::Product::BillOfLading::BillOfLadingV1CarrierItem> (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 |
#consignee ⇒ Mindee::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_issue ⇒ Mindee::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_date ⇒ Mindee::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_party ⇒ Mindee::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_delivery ⇒ Mindee::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_discharge ⇒ Mindee::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_loading ⇒ Mindee::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 |
#shipper ⇒ Mindee::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_s ⇒ String
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 71 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 |