mindee 4.7.1 β†’ 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +6 -6
  4. data/Rakefile +1 -0
  5. data/lib/mindee/errors/mindee_http_error_v2.rb +23 -4
  6. data/lib/mindee/errors/mindee_http_unknown_error_v2.rb +18 -0
  7. data/lib/mindee/http/endpoint.rb +1 -0
  8. data/lib/mindee/input/sources/local_input_source.rb +9 -1
  9. data/lib/mindee/parsing/v2/error_item.rb +21 -0
  10. data/lib/mindee/parsing/v2/error_response.rb +18 -3
  11. data/lib/mindee/parsing/v2/inference_result.rb +4 -0
  12. data/lib/mindee/parsing/v2/rag_metadata.rb +17 -0
  13. data/lib/mindee/product.rb +0 -1
  14. data/lib/mindee/version.rb +1 -1
  15. data/mindee.gemspec +1 -0
  16. data/sig/mindee/errors/mindee_http_error_v2.rbs +4 -1
  17. data/sig/mindee/errors/mindee_http_unknown_error_v2.rbs +9 -0
  18. data/sig/mindee/http/endpoint.rbs +1 -0
  19. data/sig/mindee/input/sources/local_input_source.rbs +1 -1
  20. data/sig/mindee/parsing/v2/error_item.rbs +13 -0
  21. data/sig/mindee/parsing/v2/error_response.rbs +3 -0
  22. data/sig/mindee/parsing/v2/inference_result.rbs +1 -0
  23. data/sig/mindee/parsing/v2/rag_metadata.rbs +13 -0
  24. metadata +22 -47
  25. data/docs/advanced_file_operations.md +0 -109
  26. data/docs/code_samples/us_mail_v2_async.txt +0 -24
  27. data/docs/getting_started.md +0 -257
  28. data/docs/global_products/barcode_reader_v1.md +0 -125
  29. data/docs/global_products/bill_of_lading_v1.md +0 -276
  30. data/docs/global_products/business_card_v1.md +0 -194
  31. data/docs/global_products/cropper_v1.md +0 -123
  32. data/docs/global_products/delivery_notes_v1.md +0 -168
  33. data/docs/global_products/driver_license_v1.md +0 -212
  34. data/docs/global_products/expense_receipts_v5.md +0 -415
  35. data/docs/global_products/financial_document_v1.md +0 -615
  36. data/docs/global_products/international_id_v2.md +0 -264
  37. data/docs/global_products/invoice_splitter_v1.md +0 -127
  38. data/docs/global_products/invoices_v4.md +0 -576
  39. data/docs/global_products/multi_receipts_detector_v1.md +0 -131
  40. data/docs/global_products/nutrition_facts_v1.md +0 -399
  41. data/docs/global_products/passport_v1.md +0 -207
  42. data/docs/global_products/resume_v1.md +0 -384
  43. data/docs/global_products/universal.md +0 -113
  44. data/docs/global_products.md +0 -6
  45. data/docs/loading_a_document.md +0 -330
  46. data/docs/localized_products/bank_account_details_v2.md +0 -158
  47. data/docs/localized_products/bank_check_v1.md +0 -205
  48. data/docs/localized_products/bank_statement_fr_v2.md +0 -269
  49. data/docs/localized_products/carte_grise_v1.md +0 -475
  50. data/docs/localized_products/energy_bill_fra_v1.md +0 -342
  51. data/docs/localized_products/french_healthcard_v1.md +0 -142
  52. data/docs/localized_products/idcard_fr_v2.md +0 -284
  53. data/docs/localized_products/ind_passport_v1.md +0 -307
  54. data/docs/localized_products/payslip_fra_v3.md +0 -344
  55. data/docs/localized_products/us_healthcare_cards_v1.md +0 -258
  56. data/docs/localized_products/us_mail_v3.md +0 -152
  57. data/docs/localized_products.md +0 -6
  58. data/lib/mindee/product/us/us_mail/us_mail_v2.rb +0 -47
  59. data/lib/mindee/product/us/us_mail/us_mail_v2_document.rb +0 -105
  60. data/lib/mindee/product/us/us_mail/us_mail_v2_page.rb +0 -38
  61. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +0 -105
  62. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_addresses.rb +0 -63
  63. data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +0 -66
  64. data/sig/mindee/product/us/us_mail/us_mail_v2.rbs +0 -13
  65. data/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs +0 -20
  66. data/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs +0 -17
  67. data/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs +0 -22
  68. data/sig/mindee/product/us/us_mail/us_mail_v2_recipient_addresses.rbs +0 -15
  69. data/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs +0 -18
@@ -1,152 +0,0 @@
1
- ---
2
- title: US US Mail
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-us-us-mail-ocr
5
- parentDoc: 67b49e29a2cd6f08d69a40d8
6
- ---
7
- The Ruby Client Library supports the [US Mail API](https://platform.mindee.com/mindee/us_mail).
8
-
9
-
10
- > πŸ“ Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `us_mail` |
15
- > | Recommended Version | `v3.0` |
16
- > | Supports Polling/Webhooks | βœ”οΈ Yes |
17
- > | Support Synchronous HTTP Calls | ❌ No |
18
- > | Geography | πŸ‡ΊπŸ‡Έ United States |
19
-
20
- > πŸ” Polling Limitations
21
- >
22
- > | Setting | Parameter name | Default Value |
23
- > | ------------------------------- | ----------------------- | ------------- |
24
- > | Initial Delay Before Polling | `initial_delay_seconds` | 2 seconds |
25
- > | Default Delay Between Calls | `delay_sec` | 1.5 seconds |
26
- > | Polling Attempts Before Timeout | `max_retries` | 80 retries |
27
-
28
-
29
- The [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/us_mail/default_sample.jpg) can be used for testing purposes.
30
- ![US Mail sample](https://github.com/mindee/client-lib-test-data/blob/main/products/us_mail/default_sample.jpg?raw=true)
31
-
32
- # Quick-Start
33
- ```rb
34
- #
35
- # Install the Ruby client library by running:
36
- # gem install mindee
37
- #
38
-
39
- require 'mindee'
40
-
41
- # Init a new client
42
- mindee_client = Mindee::Client.new(api_key: 'my-api-key')
43
-
44
- # Load a file from disk
45
- input_source = mindee_client.source_from_path('/path/to/the/file.ext')
46
-
47
- # Parse the file
48
- result = mindee_client.parse(
49
- input_source,
50
- Mindee::Product::US::UsMail::UsMailV3
51
- )
52
-
53
- # Print a full summary of the parsed data in RST format
54
- puts result.document
55
-
56
- # Print the document-level parsed data
57
- # puts result.document.inference.prediction
58
- ```
59
- # Field Types
60
- ## Standard Fields
61
- These fields are generic and used in several products.
62
-
63
- ### Basic Field
64
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
65
- A typical `Field` object will have the following attributes:
66
-
67
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
68
- * **confidence** (Float, nil): the confidence score of the field prediction.
69
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
70
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
71
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
72
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
73
-
74
-
75
- Aside from the previous attributes, all basic fields have access to a `to_s` method that can be used to print their value as a string.
76
-
77
- ### String Field
78
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
79
-
80
- ## Specific Fields
81
- Fields which are specific to this product; they are not used in any other product.
82
-
83
- ### Sender Address Field
84
- The address of the sender.
85
-
86
- A `UsMailV3SenderAddress` implements the following attributes:
87
-
88
- * `city` (String): The city of the sender's address.
89
- * `complete` (String): The complete address of the sender.
90
- * `postal_code` (String): The postal code of the sender's address.
91
- * `state` (String): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
92
- * `street` (String): The street of the sender's address.
93
- Fields which are specific to this product; they are not used in any other product.
94
-
95
- ### Recipient Addresses Field
96
- The addresses of the recipients.
97
-
98
- A `UsMailV3RecipientAddress` implements the following attributes:
99
-
100
- * `city` (String): The city of the recipient's address.
101
- * `complete` (String): The complete address of the recipient.
102
- * `is_address_change` (bool): Indicates if the recipient's address is a change of address.
103
- * `postal_code` (String): The postal code of the recipient's address.
104
- * `private_mailbox_number` (String): The private mailbox number of the recipient's address.
105
- * `state` (String): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
106
- * `street` (String): The street of the recipient's address.
107
- * `unit` (String): The unit number of the recipient's address.
108
-
109
- # Attributes
110
- The following fields are extracted for US Mail V3:
111
-
112
- ## Return to Sender
113
- **is_return_to_sender** ([BooleanField](#boolean-field)): Whether the mailing is marked as return to sender.
114
-
115
- ```rb
116
- puts result.document.inference.prediction.is_return_to_sender.value
117
- ```
118
-
119
- ## Recipient Addresses
120
- **recipient_addresses** (Array<[UsMailV3RecipientAddress](#recipient-addresses-field)>): The addresses of the recipients.
121
-
122
- ```rb
123
- result.document.inference.prediction.recipient_addresses do |recipient_addresses_elem|
124
- puts recipient_addresses_elem.value
125
- end
126
- ```
127
-
128
- ## Recipient Names
129
- **recipient_names** (Array<[StringField](#string-field)>): The names of the recipients.
130
-
131
- ```rb
132
- result.document.inference.prediction.recipient_names do |recipient_names_elem|
133
- puts recipient_names_elem.value
134
- end
135
- ```
136
-
137
- ## Sender Address
138
- **sender_address** ([UsMailV3SenderAddress](#sender-address-field)): The address of the sender.
139
-
140
- ```rb
141
- puts result.document.inference.prediction.sender_address.value
142
- ```
143
-
144
- ## Sender Name
145
- **sender_name** ([StringField](#string-field)): The name of the sender.
146
-
147
- ```rb
148
- puts result.document.inference.prediction.sender_name.value
149
- ```
150
-
151
- # Questions?
152
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,6 +0,0 @@
1
- ---
2
- title: Localized Products
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-localized-products
5
- parentDoc: 6294d97ee723f1008d2ab28e
6
- ---
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'us_mail_v2_document'
5
- require_relative 'us_mail_v2_page'
6
-
7
- module Mindee
8
- module Product
9
- module US
10
- # US Mail module.
11
- module UsMail
12
- # US Mail API version 2 inference prediction.
13
- class UsMailV2 < Mindee::Parsing::Common::Inference
14
- @endpoint_name = 'us_mail'
15
- @endpoint_version = '2'
16
- @has_async = true
17
- @has_sync = false
18
-
19
- # @param prediction [Hash]
20
- def initialize(prediction)
21
- super
22
- @prediction = UsMailV2Document.new(prediction['prediction'], nil)
23
- @pages = []
24
- prediction['pages'].each do |page|
25
- @pages.push(UsMailV2Page.new(page))
26
- end
27
- end
28
-
29
- class << self
30
- # Name of the endpoint for this product.
31
- # @return [String]
32
- attr_reader :endpoint_name
33
- # Version for this product.
34
- # @return [String]
35
- attr_reader :endpoint_version
36
- # Whether this product has access to an asynchronous endpoint.
37
- # @return [bool]
38
- attr_reader :has_async
39
- # Whether this product has access to synchronous endpoint.
40
- # @return [bool]
41
- attr_reader :has_sync
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,105 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'us_mail_v2_sender_address'
5
- require_relative 'us_mail_v2_recipient_addresses'
6
-
7
- module Mindee
8
- module Product
9
- module US
10
- module UsMail
11
- # US Mail API version 2.0 document data.
12
- class UsMailV2Document < Mindee::Parsing::Common::Prediction
13
- include Mindee::Parsing::Standard
14
- # The addresses of the recipients.
15
- # @return [Mindee::Product::US::UsMail::UsMailV2RecipientAddresses]
16
- attr_reader :recipient_addresses
17
- # The names of the recipients.
18
- # @return [Array<Mindee::Parsing::Standard::StringField>]
19
- attr_reader :recipient_names
20
- # The address of the sender.
21
- # @return [Mindee::Product::US::UsMail::UsMailV2SenderAddress]
22
- attr_reader :sender_address
23
- # The name of the sender.
24
- # @return [Mindee::Parsing::Standard::StringField]
25
- attr_reader :sender_name
26
-
27
- # @param prediction [Hash]
28
- # @param page_id [Integer, nil]
29
- def initialize(prediction, page_id)
30
- super
31
- @recipient_addresses = Product::US::UsMail::UsMailV2RecipientAddresses.new(
32
- prediction['recipient_addresses'], page_id
33
- )
34
- @recipient_names = [] # : Array[Parsing::Standard::StringField]
35
- prediction['recipient_names'].each do |item|
36
- @recipient_names.push(Parsing::Standard::StringField.new(item, page_id))
37
- end
38
- @sender_address = Product::US::UsMail::UsMailV2SenderAddress.new(
39
- prediction['sender_address'],
40
- page_id
41
- )
42
- @sender_name = Parsing::Standard::StringField.new(
43
- prediction['sender_name'],
44
- page_id
45
- )
46
- end
47
-
48
- # @return [String]
49
- def to_s
50
- sender_address = @sender_address.to_s
51
- recipient_names = @recipient_names.join("\n #{' ' * 17}")
52
- recipient_addresses = recipient_addresses_to_s
53
- out_str = String.new
54
- out_str << "\n:Sender Name: #{@sender_name}".rstrip
55
- out_str << "\n:Sender Address:"
56
- out_str << sender_address
57
- out_str << "\n:Recipient Names: #{recipient_names}".rstrip
58
- out_str << "\n:Recipient Addresses:"
59
- out_str << recipient_addresses
60
- out_str[1..].to_s
61
- end
62
-
63
- private
64
-
65
- # @param char [String]
66
- # @return [String]
67
- def recipient_addresses_separator(char)
68
- out_str = String.new
69
- out_str << ' '
70
- out_str << "+#{char * 17}"
71
- out_str << "+#{char * 37}"
72
- out_str << "+#{char * 19}"
73
- out_str << "+#{char * 13}"
74
- out_str << "+#{char * 24}"
75
- out_str << "+#{char * 7}"
76
- out_str << "+#{char * 27}"
77
- out_str << '+'
78
- out_str
79
- end
80
-
81
- # @return [String]
82
- def recipient_addresses_to_s
83
- return '' if @recipient_addresses.empty?
84
-
85
- line_items = @recipient_addresses.map(&:to_table_line).join("\n#{recipient_addresses_separator('-')}\n ")
86
- out_str = String.new
87
- out_str << "\n#{recipient_addresses_separator('-')}"
88
- out_str << "\n |"
89
- out_str << ' City |'
90
- out_str << ' Complete Address |'
91
- out_str << ' Is Address Change |'
92
- out_str << ' Postal Code |'
93
- out_str << ' Private Mailbox Number |'
94
- out_str << ' State |'
95
- out_str << ' Street |'
96
- out_str << "\n#{recipient_addresses_separator('=')}"
97
- out_str << "\n #{line_items}"
98
- out_str << "\n#{recipient_addresses_separator('-')}"
99
- out_str
100
- end
101
- end
102
- end
103
- end
104
- end
105
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
- require_relative 'us_mail_v2_document'
5
-
6
- module Mindee
7
- module Product
8
- module US
9
- module UsMail
10
- # US Mail API version 2.0 page data.
11
- class UsMailV2Page < Mindee::Parsing::Common::Page
12
- # @param prediction [Hash]
13
- def initialize(prediction)
14
- super
15
- @prediction = if prediction['prediction'].empty?
16
- nil
17
- else
18
- UsMailV2PagePrediction.new(
19
- prediction['prediction'],
20
- prediction['id']
21
- )
22
- end
23
- end
24
- end
25
-
26
- # US Mail V2 page prediction.
27
- class UsMailV2PagePrediction < UsMailV2Document
28
- # @return [String]
29
- def to_s
30
- out_str = String.new
31
- out_str << "\n#{super}"
32
- out_str
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,105 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
-
5
- module Mindee
6
- module Product
7
- module US
8
- module UsMail
9
- # The addresses of the recipients.
10
- class UsMailV2RecipientAddress < Mindee::Parsing::Standard::FeatureField
11
- include Mindee::Parsing::Standard
12
- # The city of the recipient's address.
13
- # @return [String]
14
- attr_reader :city
15
- # The complete address of the recipient.
16
- # @return [String]
17
- attr_reader :complete
18
- # Indicates if the recipient's address is a change of address.
19
- # @return [bool]
20
- attr_reader :is_address_change
21
- # The postal code of the recipient's address.
22
- # @return [String]
23
- attr_reader :postal_code
24
- # The private mailbox number of the recipient's address.
25
- # @return [String]
26
- attr_reader :private_mailbox_number
27
- # Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
28
- # @return [String]
29
- attr_reader :state
30
- # The street of the recipient's address.
31
- # @return [String]
32
- attr_reader :street
33
-
34
- # @param prediction [Hash]
35
- # @param page_id [Integer, nil]
36
- def initialize(prediction, page_id)
37
- super
38
- @city = prediction['city']
39
- @complete = prediction['complete']
40
- @is_address_change = prediction['is_address_change']
41
- @postal_code = prediction['postal_code']
42
- @private_mailbox_number = prediction['private_mailbox_number']
43
- @state = prediction['state']
44
- @street = prediction['street']
45
- @page_id = page_id
46
- end
47
-
48
- # @return [Hash]
49
- def printable_values
50
- printable = {}
51
- printable[:city] = format_for_display(@city)
52
- printable[:complete] = format_for_display(@complete)
53
- printable[:is_address_change] = format_for_display(@is_address_change)
54
- printable[:postal_code] = format_for_display(@postal_code)
55
- printable[:private_mailbox_number] = format_for_display(@private_mailbox_number)
56
- printable[:state] = format_for_display(@state)
57
- printable[:street] = format_for_display(@street)
58
- printable
59
- end
60
-
61
- # @return [Hash]
62
- def table_printable_values
63
- printable = {}
64
- printable[:city] = format_for_display(@city, 15)
65
- printable[:complete] = format_for_display(@complete, 35)
66
- printable[:is_address_change] = format_for_display(@is_address_change, nil)
67
- printable[:postal_code] = format_for_display(@postal_code, nil)
68
- printable[:private_mailbox_number] = format_for_display(@private_mailbox_number, nil)
69
- printable[:state] = format_for_display(@state, nil)
70
- printable[:street] = format_for_display(@street, 25)
71
- printable
72
- end
73
-
74
- # @return [String]
75
- def to_table_line
76
- printable = table_printable_values
77
- out_str = String.new
78
- out_str << format('| %- 16s', printable[:city])
79
- out_str << format('| %- 36s', printable[:complete])
80
- out_str << format('| %- 18s', printable[:is_address_change])
81
- out_str << format('| %- 12s', printable[:postal_code])
82
- out_str << format('| %- 23s', printable[:private_mailbox_number])
83
- out_str << format('| %- 6s', printable[:state])
84
- out_str << format('| %- 26s', printable[:street])
85
- out_str << '|'
86
- end
87
-
88
- # @return [String]
89
- def to_s
90
- printable = printable_values
91
- out_str = String.new
92
- out_str << "\n :City: #{printable[:city]}"
93
- out_str << "\n :Complete Address: #{printable[:complete]}"
94
- out_str << "\n :Is Address Change: #{printable[:is_address_change]}"
95
- out_str << "\n :Postal Code: #{printable[:postal_code]}"
96
- out_str << "\n :Private Mailbox Number: #{printable[:private_mailbox_number]}"
97
- out_str << "\n :State: #{printable[:state]}"
98
- out_str << "\n :Street: #{printable[:street]}"
99
- out_str
100
- end
101
- end
102
- end
103
- end
104
- end
105
- end
@@ -1,63 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'us_mail_v2_sender_address'
4
- require_relative 'us_mail_v2_recipient_address'
5
-
6
- module Mindee
7
- module Product
8
- module US
9
- module UsMail
10
- # The addresses of the recipients.
11
- class UsMailV2RecipientAddresses < Array
12
- # Entries.
13
- # @return [Array<UsMailV2RecipientAddress>]
14
- attr_reader :entries
15
-
16
- # @param prediction [Array]
17
- # @param page_id [Integer, nil]
18
- def initialize(prediction, page_id)
19
- entries = prediction.map do |entry|
20
- UsMail::UsMailV2RecipientAddress.new(entry, page_id)
21
- end
22
- super(entries)
23
- end
24
-
25
- # Creates a line of rST table-compliant string separators.
26
- # @param char [String] Character to use as a separator.
27
- # @return [String]
28
- def self.line_items_separator(char)
29
- out_str = String.new
30
- out_str << "+#{char * 17}"
31
- out_str << "+#{char * 37}"
32
- out_str << "+#{char * 19}"
33
- out_str << "+#{char * 13}"
34
- out_str << "+#{char * 24}"
35
- out_str << "+#{char * 7}"
36
- out_str << "+#{char * 27}"
37
- out_str
38
- end
39
-
40
- # @return [String]
41
- def to_s
42
- return '' if empty?
43
-
44
- lines = map do |entry|
45
- "\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
46
- end.join
47
- out_str = String.new
48
- out_str << "\n#{self.class.line_items_separator('-')}\n "
49
- out_str << ' | City '
50
- out_str << ' | Complete Address '
51
- out_str << ' | Is Address Change'
52
- out_str << ' | Postal Code'
53
- out_str << ' | Private Mailbox Number'
54
- out_str << ' | State'
55
- out_str << ' | Street '
56
- out_str << " |\n#{self.class.line_items_separator('=')}"
57
- out_str + lines
58
- end
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../../parsing'
4
-
5
- module Mindee
6
- module Product
7
- module US
8
- module UsMail
9
- # The address of the sender.
10
- class UsMailV2SenderAddress < Mindee::Parsing::Standard::FeatureField
11
- include Mindee::Parsing::Standard
12
- # The city of the sender's address.
13
- # @return [String]
14
- attr_reader :city
15
- # The complete address of the sender.
16
- # @return [String]
17
- attr_reader :complete
18
- # The postal code of the sender's address.
19
- # @return [String]
20
- attr_reader :postal_code
21
- # Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
22
- # @return [String]
23
- attr_reader :state
24
- # The street of the sender's address.
25
- # @return [String]
26
- attr_reader :street
27
-
28
- # @param prediction [Hash]
29
- # @param page_id [Integer, nil]
30
- def initialize(prediction, page_id)
31
- super
32
- @city = prediction['city']
33
- @complete = prediction['complete']
34
- @postal_code = prediction['postal_code']
35
- @state = prediction['state']
36
- @street = prediction['street']
37
- @page_id = page_id
38
- end
39
-
40
- # @return [Hash]
41
- def printable_values
42
- printable = {}
43
- printable[:city] = format_for_display(@city)
44
- printable[:complete] = format_for_display(@complete)
45
- printable[:postal_code] = format_for_display(@postal_code)
46
- printable[:state] = format_for_display(@state)
47
- printable[:street] = format_for_display(@street)
48
- printable
49
- end
50
-
51
- # @return [String]
52
- def to_s
53
- printable = printable_values
54
- out_str = String.new
55
- out_str << "\n :City: #{printable[:city]}"
56
- out_str << "\n :Complete Address: #{printable[:complete]}"
57
- out_str << "\n :Postal Code: #{printable[:postal_code]}"
58
- out_str << "\n :State: #{printable[:state]}"
59
- out_str << "\n :Street: #{printable[:street]}"
60
- out_str
61
- end
62
- end
63
- end
64
- end
65
- end
66
- end
@@ -1,13 +0,0 @@
1
- # lib/mindee/product/../us_mail/us_mail_v2.rb
2
-
3
- module Mindee
4
- module Product
5
- module US
6
- module UsMail
7
- class UsMailV2 < Parsing::Common::Inference
8
- def initialize: (Hash[String | Symbol, untyped]) -> void
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,20 +0,0 @@
1
- # lib/mindee/product/../us_mail/us_mail_v2_document.rb
2
-
3
- module Mindee
4
- module Product
5
- module US
6
- module UsMail
7
- class UsMailV2Document < Parsing::Common::Prediction
8
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
9
- def recipient_addresses: -> (Product::US::UsMail::UsMailV2RecipientAddresses)
10
- def recipient_names: -> (Array[Parsing::Standard::StringField])
11
- def sender_address: -> (Product::US::UsMail::UsMailV2SenderAddress)
12
- def sender_name: -> (Parsing::Standard::StringField)
13
- def recipient_addresses_separator: (String) -> String
14
- def recipient_addresses_to_s: -> String
15
- def to_s: -> String
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- # lib/mindee/product/../us_mail/us_mail_v2_page.rb
2
-
3
- module Mindee
4
- module Product
5
- module US
6
- module UsMail
7
- class UsMailV2Page < Parsing::Common::Page
8
- def initialize: (Hash[String | Symbol, untyped]) -> void
9
- end
10
- class UsMailV2PagePrediction < UsMailV2Document
11
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
12
- def to_s: -> String
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,22 +0,0 @@
1
- module Mindee
2
- module Product
3
- module US
4
- module UsMail
5
- class UsMailV2RecipientAddress < Parsing::Standard::FeatureField
6
- def initialize: (Hash[String | Symbol, untyped], Integer?) -> void
7
- def city: -> String
8
- def complete: -> String
9
- def is_address_change: -> bool
10
- def postal_code: -> String
11
- def private_mailbox_number: -> String
12
- def state: -> String
13
- def street: -> String
14
- def printable_values: -> Hash[String | Symbol, untyped]
15
- def table_printable_values: -> Hash[String | Symbol, untyped]
16
- def to_table_line: -> String
17
- def to_s: -> String
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Mindee
4
- module Product
5
- module US
6
- module UsMail
7
- class UsMailV2RecipientAddresses < Array[UsMailV2RecipientAddress]
8
- def initialize: (Array[untyped], Integer?) -> void
9
- def self.line_items_separator: (String) -> String
10
- def to_s: -> String
11
- end
12
- end
13
- end
14
- end
15
- end