Class: Mindee::Product::US::UsMail::UsMailV3Document
- Inherits:
-
Mindee::Parsing::Common::Prediction
- Object
- Mindee::Parsing::Common::Prediction
- Mindee::Product::US::UsMail::UsMailV3Document
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/us/us_mail/us_mail_v3_document.rb
Overview
US Mail API version 3.0 document data.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#is_return_to_sender ⇒ Mindee::Parsing::Standard::BooleanField
readonly
Whether the mailing is marked as return to sender.
-
#recipient_addresses ⇒ Array<Mindee::Product::US::UsMail::UsMailV3RecipientAddress>
readonly
The addresses of the recipients.
-
#recipient_names ⇒ Array<Mindee::Parsing::Standard::StringField>
readonly
The names of the recipients.
-
#sender_address ⇒ Mindee::Product::US::UsMail::UsMailV3SenderAddress
readonly
The address of the sender.
-
#sender_name ⇒ Mindee::Parsing::Standard::StringField
readonly
The name of the sender.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ UsMailV3Document
constructor
A new instance of UsMailV3Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ UsMailV3Document
Returns a new instance of UsMailV3Document.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mindee/product/us/us_mail/us_mail_v3_document.rb', line 32 def initialize(prediction, page_id) super() @is_return_to_sender = BooleanField.new(prediction['is_return_to_sender'], page_id) @recipient_addresses = [] prediction['recipient_addresses'].each do |item| @recipient_addresses.push(UsMailV3RecipientAddress.new(item, page_id)) end @recipient_names = [] prediction['recipient_names'].each do |item| @recipient_names.push(StringField.new(item, page_id)) end @sender_address = UsMailV3SenderAddress.new(prediction['sender_address'], page_id) @sender_name = StringField.new(prediction['sender_name'], page_id) end |
Instance Attribute Details
#is_return_to_sender ⇒ Mindee::Parsing::Standard::BooleanField (readonly)
Whether the mailing is marked as return to sender.
16 17 18 |
# File 'lib/mindee/product/us/us_mail/us_mail_v3_document.rb', line 16 def is_return_to_sender @is_return_to_sender end |
#recipient_addresses ⇒ Array<Mindee::Product::US::UsMail::UsMailV3RecipientAddress> (readonly)
The addresses of the recipients.
19 20 21 |
# File 'lib/mindee/product/us/us_mail/us_mail_v3_document.rb', line 19 def recipient_addresses @recipient_addresses end |
#recipient_names ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
The names of the recipients.
22 23 24 |
# File 'lib/mindee/product/us/us_mail/us_mail_v3_document.rb', line 22 def recipient_names @recipient_names end |
#sender_address ⇒ Mindee::Product::US::UsMail::UsMailV3SenderAddress (readonly)
The address of the sender.
25 26 27 |
# File 'lib/mindee/product/us/us_mail/us_mail_v3_document.rb', line 25 def sender_address @sender_address end |
#sender_name ⇒ Mindee::Parsing::Standard::StringField (readonly)
The name of the sender.
28 29 30 |
# File 'lib/mindee/product/us/us_mail/us_mail_v3_document.rb', line 28 def sender_name @sender_name end |
Instance Method Details
#to_s ⇒ String
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mindee/product/us/us_mail/us_mail_v3_document.rb', line 48 def to_s sender_address = @sender_address.to_s recipient_names = @recipient_names.join("\n #{' ' * 17}") recipient_addresses = recipient_addresses_to_s out_str = String.new out_str << "\n:Sender Name: #{@sender_name}".rstrip out_str << "\n:Sender Address:" out_str << sender_address out_str << "\n:Recipient Names: #{recipient_names}".rstrip out_str << "\n:Recipient Addresses:" out_str << recipient_addresses out_str << "\n:Return to Sender: #{@is_return_to_sender}".rstrip out_str[1..].to_s end |