Class: Mindee::Product::US::UsMail::UsMailV2RecipientAddress
- Inherits:
-
Mindee::Parsing::Standard::FeatureField
- Object
- Mindee::Parsing::Standard::AbstractField
- Mindee::Parsing::Standard::FeatureField
- Mindee::Product::US::UsMail::UsMailV2RecipientAddress
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb
Overview
The addresses of the recipients.
Instance Attribute Summary collapse
-
#city ⇒ String
readonly
The city of the recipient’s address.
-
#complete ⇒ String
readonly
The complete address of the recipient.
-
#is_address_change ⇒ Boolean
readonly
Indicates if the recipient’s address is a change of address.
-
#postal_code ⇒ String
readonly
The postal code of the recipient’s address.
-
#private_mailbox_number ⇒ String
readonly
The private mailbox number of the recipient’s address.
-
#state ⇒ String
readonly
Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
-
#street ⇒ String
readonly
The street of the recipient’s address.
Attributes inherited from Mindee::Parsing::Standard::AbstractField
#bounding_box, #confidence, #page_id, #polygon
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ UsMailV2RecipientAddress
constructor
A new instance of UsMailV2RecipientAddress.
- #printable_values ⇒ Hash
- #table_printable_values ⇒ Hash
- #to_s ⇒ String
- #to_table_line ⇒ String
Methods inherited from Mindee::Parsing::Standard::FeatureField
Methods inherited from Mindee::Parsing::Standard::AbstractField
array_confidence, array_sum, float_to_string
Constructor Details
#initialize(prediction, page_id) ⇒ UsMailV2RecipientAddress
Returns a new instance of UsMailV2RecipientAddress.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 36 def initialize(prediction, page_id) super(prediction, page_id) @city = prediction['city'] @complete = prediction['complete'] @is_address_change = prediction['is_address_change'] @postal_code = prediction['postal_code'] @private_mailbox_number = prediction['private_mailbox_number'] @state = prediction['state'] @street = prediction['street'] @page_id = page_id end |
Instance Attribute Details
#city ⇒ String (readonly)
The city of the recipient’s address.
14 15 16 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 14 def city @city end |
#complete ⇒ String (readonly)
The complete address of the recipient.
17 18 19 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 17 def complete @complete end |
#is_address_change ⇒ Boolean (readonly)
Indicates if the recipient’s address is a change of address.
20 21 22 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 20 def is_address_change @is_address_change end |
#postal_code ⇒ String (readonly)
The postal code of the recipient’s address.
23 24 25 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 23 def postal_code @postal_code end |
#private_mailbox_number ⇒ String (readonly)
The private mailbox number of the recipient’s address.
26 27 28 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 26 def private_mailbox_number @private_mailbox_number end |
#state ⇒ String (readonly)
Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
29 30 31 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 29 def state @state end |
#street ⇒ String (readonly)
The street of the recipient’s address.
32 33 34 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 32 def street @street end |
Instance Method Details
#printable_values ⇒ Hash
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 49 def printable_values printable = {} printable[:city] = format_for_display(@city) printable[:complete] = format_for_display(@complete) printable[:is_address_change] = format_for_display(@is_address_change) printable[:postal_code] = format_for_display(@postal_code) printable[:private_mailbox_number] = format_for_display(@private_mailbox_number) printable[:state] = format_for_display(@state) printable[:street] = format_for_display(@street) printable end |
#table_printable_values ⇒ Hash
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 62 def table_printable_values printable = {} printable[:city] = format_for_display(@city, 15) printable[:complete] = format_for_display(@complete, 35) printable[:is_address_change] = format_for_display(@is_address_change, nil) printable[:postal_code] = format_for_display(@postal_code, nil) printable[:private_mailbox_number] = format_for_display(@private_mailbox_number, nil) printable[:state] = format_for_display(@state, nil) printable[:street] = format_for_display(@street, 25) printable end |
#to_s ⇒ String
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 89 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 :Is Address Change: #{printable[:is_address_change]}" out_str << "\n :Postal Code: #{printable[:postal_code]}" out_str << "\n :Private Mailbox Number: #{printable[:private_mailbox_number]}" out_str << "\n :State: #{printable[:state]}" out_str << "\n :Street: #{printable[:street]}" out_str end |
#to_table_line ⇒ String
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb', line 75 def to_table_line printable = table_printable_values out_str = String.new out_str << format('| %- 16s', printable[:city]) out_str << format('| %- 36s', printable[:complete]) out_str << format('| %- 18s', printable[:is_address_change]) out_str << format('| %- 12s', printable[:postal_code]) out_str << format('| %- 23s', printable[:private_mailbox_number]) out_str << format('| %- 6s', printable[:state]) out_str << format('| %- 26s', printable[:street]) out_str << '|' end |