Class: Mindee::Product::BillOfLading::BillOfLadingV1Carrier

Inherits:
Mindee::Parsing::Standard::FeatureField show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb

Overview

The shipping company responsible for transporting the goods.

Instance Attribute Summary collapse

Attributes inherited from Mindee::Parsing::Standard::AbstractField

#bounding_box, #confidence, #page_id, #polygon

Instance Method Summary collapse

Methods inherited from Mindee::Parsing::Standard::FeatureField

#format_for_display

Methods inherited from Mindee::Parsing::Standard::AbstractField

array_confidence, array_sum, float_to_string

Constructor Details

#initialize(prediction, page_id) ⇒ BillOfLadingV1Carrier

Returns a new instance of BillOfLadingV1Carrier.

Parameters:

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


23
24
25
26
27
28
29
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb', line 23

def initialize(prediction, page_id)
  super(prediction, page_id)
  @name = prediction['name']
  @professional_number = prediction['professional_number']
  @scac = prediction['scac']
  @page_id = page_id
end

Instance Attribute Details

#nameString (readonly)

The name of the carrier.

Returns:

  • (String)


13
14
15
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb', line 13

def name
  @name
end

#professional_numberString (readonly)

The professional number of the carrier.

Returns:

  • (String)


16
17
18
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb', line 16

def professional_number
  @professional_number
end

#scacString (readonly)

The Standard Carrier Alpha Code (SCAC) of the carrier.

Returns:

  • (String)


19
20
21
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb', line 19

def scac
  @scac
end

Instance Method Details

#printable_valuesHash

Returns:

  • (Hash)


32
33
34
35
36
37
38
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb', line 32

def printable_values
  printable = {}
  printable[:name] = format_for_display(@name)
  printable[:professional_number] = format_for_display(@professional_number)
  printable[:scac] = format_for_display(@scac)
  printable
end

#to_sString

Returns:

  • (String)


41
42
43
44
45
46
47
48
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb', line 41

def to_s
  printable = printable_values
  out_str = String.new
  out_str << "\n  :Name: #{printable[:name]}"
  out_str << "\n  :Professional Number: #{printable[:professional_number]}"
  out_str << "\n  :SCAC: #{printable[:scac]}"
  out_str
end