Class: Mindee::Product::BusinessCard::BusinessCardV1Document
- Inherits:
-
Mindee::Parsing::Common::Prediction
- Object
- Mindee::Parsing::Common::Prediction
- Mindee::Product::BusinessCard::BusinessCardV1Document
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/business_card/business_card_v1_document.rb
Overview
Business Card API version 1.0 document data.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address ⇒ Mindee::Parsing::Standard::StringField
readonly
The address of the person.
-
#company ⇒ Mindee::Parsing::Standard::StringField
readonly
The company the person works for.
-
#email ⇒ Mindee::Parsing::Standard::StringField
readonly
The email address of the person.
-
#fax_number ⇒ Mindee::Parsing::Standard::StringField
readonly
The Fax number of the person.
-
#firstname ⇒ Mindee::Parsing::Standard::StringField
readonly
The given name of the person.
-
#job_title ⇒ Mindee::Parsing::Standard::StringField
readonly
The job title of the person.
-
#lastname ⇒ Mindee::Parsing::Standard::StringField
readonly
The lastname of the person.
-
#mobile_number ⇒ Mindee::Parsing::Standard::StringField
readonly
The mobile number of the person.
-
#phone_number ⇒ Mindee::Parsing::Standard::StringField
readonly
The phone number of the person.
-
#social_media ⇒ Array<Mindee::Parsing::Standard::StringField>
readonly
The social media profiles of the person or company.
-
#website ⇒ Mindee::Parsing::Standard::StringField
readonly
The website of the person or company.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ BusinessCardV1Document
constructor
A new instance of BusinessCardV1Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ BusinessCardV1Document
Returns a new instance of BusinessCardV1Document.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 47 def initialize(prediction, page_id) super @address = Parsing::Standard::StringField.new( prediction['address'], page_id ) @company = Parsing::Standard::StringField.new( prediction['company'], page_id ) @email = Parsing::Standard::StringField.new(prediction['email'], page_id) @fax_number = Parsing::Standard::StringField.new( prediction['fax_number'], page_id ) @firstname = Parsing::Standard::StringField.new( prediction['firstname'], page_id ) @job_title = Parsing::Standard::StringField.new( prediction['job_title'], page_id ) @lastname = Parsing::Standard::StringField.new( prediction['lastname'], page_id ) @mobile_number = Parsing::Standard::StringField.new( prediction['mobile_number'], page_id ) @phone_number = Parsing::Standard::StringField.new( prediction['phone_number'], page_id ) @social_media = [] # : Array[Parsing::Standard::StringField] prediction['social_media'].each do |item| @social_media.push(Parsing::Standard::StringField.new(item, page_id)) end @website = Parsing::Standard::StringField.new( prediction['website'], page_id ) end |
Instance Attribute Details
#address ⇒ Mindee::Parsing::Standard::StringField (readonly)
The address of the person.
13 14 15 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 13 def address @address end |
#company ⇒ Mindee::Parsing::Standard::StringField (readonly)
The company the person works for.
16 17 18 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 16 def company @company end |
#email ⇒ Mindee::Parsing::Standard::StringField (readonly)
The email address of the person.
19 20 21 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 19 def email @email end |
#fax_number ⇒ Mindee::Parsing::Standard::StringField (readonly)
The Fax number of the person.
22 23 24 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 22 def fax_number @fax_number end |
#firstname ⇒ Mindee::Parsing::Standard::StringField (readonly)
The given name of the person.
25 26 27 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 25 def firstname @firstname end |
#job_title ⇒ Mindee::Parsing::Standard::StringField (readonly)
The job title of the person.
28 29 30 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 28 def job_title @job_title end |
#lastname ⇒ Mindee::Parsing::Standard::StringField (readonly)
The lastname of the person.
31 32 33 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 31 def lastname @lastname end |
#mobile_number ⇒ Mindee::Parsing::Standard::StringField (readonly)
The mobile number of the person.
34 35 36 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 34 def mobile_number @mobile_number end |
#phone_number ⇒ Mindee::Parsing::Standard::StringField (readonly)
The phone number of the person.
37 38 39 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 37 def phone_number @phone_number end |
#social_media ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
The social media profiles of the person or company.
40 41 42 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 40 def @social_media end |
#website ⇒ Mindee::Parsing::Standard::StringField (readonly)
The website of the person or company.
43 44 45 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 43 def website @website end |
Instance Method Details
#to_s ⇒ String
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/mindee/product/business_card/business_card_v1_document.rb', line 93 def to_s = @social_media.join("\n #{' ' * 14}") out_str = String.new out_str << "\n:Firstname: #{@firstname}".rstrip out_str << "\n:Lastname: #{@lastname}".rstrip out_str << "\n:Job Title: #{@job_title}".rstrip out_str << "\n:Company: #{@company}".rstrip out_str << "\n:Email: #{@email}".rstrip out_str << "\n:Phone Number: #{@phone_number}".rstrip out_str << "\n:Mobile Number: #{@mobile_number}".rstrip out_str << "\n:Fax Number: #{@fax_number}".rstrip out_str << "\n:Address: #{@address}".rstrip out_str << "\n:Website: #{@website}".rstrip out_str << "\n:Social Media: #{}".rstrip out_str[1..].to_s end |