Class: Mindee::Product::US::UsMail::UsMailV2SenderAddress

Inherits:
Mindee::Parsing::Standard::FeatureField show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb

Overview

The address of the sender.

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) ⇒ UsMailV2SenderAddress

Returns a new instance of UsMailV2SenderAddress.

Parameters:

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


30
31
32
33
34
35
36
37
38
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 30

def initialize(prediction, page_id)
  super(prediction, page_id)
  @city = prediction['city']
  @complete = prediction['complete']
  @postal_code = prediction['postal_code']
  @state = prediction['state']
  @street = prediction['street']
  @page_id = page_id
end

Instance Attribute Details

#cityString (readonly)

The city of the sender’s address.

Returns:

  • (String)


14
15
16
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 14

def city
  @city
end

#completeString (readonly)

The complete address of the sender.

Returns:

  • (String)


17
18
19
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 17

def complete
  @complete
end

#postal_codeString (readonly)

The postal code of the sender’s address.

Returns:

  • (String)


20
21
22
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 20

def postal_code
  @postal_code
end

#stateString (readonly)

Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.

Returns:

  • (String)


23
24
25
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 23

def state
  @state
end

#streetString (readonly)

The street of the sender’s address.

Returns:

  • (String)


26
27
28
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 26

def street
  @street
end

Instance Method Details

#printable_valuesHash

Returns:

  • (Hash)


41
42
43
44
45
46
47
48
49
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 41

def printable_values
  printable = {}
  printable[:city] = format_for_display(@city)
  printable[:complete] = format_for_display(@complete)
  printable[:postal_code] = format_for_display(@postal_code)
  printable[:state] = format_for_display(@state)
  printable[:street] = format_for_display(@street)
  printable
end

#to_sString

Returns:

  • (String)


52
53
54
55
56
57
58
59
60
61
# File 'lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb', line 52

def to_s
  printable = printable_values
  out_str = String.new
  out_str << "\n  :City: #{printable[:city]}"
  out_str << "\n  :Complete Address: #{printable[:complete]}"
  out_str << "\n  :Postal Code: #{printable[:postal_code]}"
  out_str << "\n  :State: #{printable[:state]}"
  out_str << "\n  :Street: #{printable[:street]}"
  out_str
end