Class: Mindee::Product::BillOfLading::BillOfLadingV1Shipper

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

Overview

The party responsible for shipping 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) ⇒ BillOfLadingV1Shipper

Returns a new instance of BillOfLadingV1Shipper.

Parameters:

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


26
27
28
29
30
31
32
33
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb', line 26

def initialize(prediction, page_id)
  super(prediction, page_id)
  @address = prediction['address']
  @email = prediction['email']
  @name = prediction['name']
  @phone = prediction['phone']
  @page_id = page_id
end

Instance Attribute Details

#addressString (readonly)

The address of the shipper.

Returns:

  • (String)


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

def address
  @address
end

#emailString (readonly)

The email of the shipper.

Returns:

  • (String)


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

def email
  @email
end

#nameString (readonly)

The name of the shipper.

Returns:

  • (String)


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

def name
  @name
end

#phoneString (readonly)

The phone number of the shipper.

Returns:

  • (String)


22
23
24
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb', line 22

def phone
  @phone
end

Instance Method Details

#printable_valuesHash

Returns:

  • (Hash)


36
37
38
39
40
41
42
43
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb', line 36

def printable_values
  printable = {}
  printable[:address] = format_for_display(@address)
  printable[:email] = format_for_display(@email)
  printable[:name] = format_for_display(@name)
  printable[:phone] = format_for_display(@phone)
  printable
end

#to_sString

Returns:

  • (String)


46
47
48
49
50
51
52
53
54
# File 'lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb', line 46

def to_s
  printable = printable_values
  out_str = String.new
  out_str << "\n  :Address: #{printable[:address]}"
  out_str << "\n  :Email: #{printable[:email]}"
  out_str << "\n  :Name: #{printable[:name]}"
  out_str << "\n  :Phone: #{printable[:phone]}"
  out_str
end