veryfi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f9b8eb1da3e397a8e3617948e9acd94be3dd9e1f7268a18e0134420333d81fd
4
- data.tar.gz: a1b2b1148cab118ab3419791eff6715112f92b61826ed4ff87da3c53a8f12d6f
3
+ metadata.gz: c0b98174bc21d552218a407a17a0801218b4a93c76adbd6676d081e6c98eb9c7
4
+ data.tar.gz: edf7a6c1f283eb3d2f4369554c72dd6fb627674b2dc752f1040f145537197946
5
5
  SHA512:
6
- metadata.gz: c2dcdabbd1583b03cb765928a5fca44faf28495d9acaa2b3e48da4af4355da42cde6eebadfc8b78bc5082c3cc5b3822722a07e3b26b4c47e8aa604402a7e687b
7
- data.tar.gz: 18af20f0f236126b1a202e9dd09f144949d9773bfd275733e9f1457b6661ca2f1c231bdfa4927614dc391c8978ffa5a685dd058cdc44c98f9864c3d76ce33f35
6
+ metadata.gz: 21251717fe8fe9e0c424700ff1d1b0776f089cabe764fb55c3abf5509eb94014021bdaf64cbe8fbe1571f2840049b0c02367a655d5fa6f6887cd924cfdbb4363
7
+ data.tar.gz: 603f846c3eb5376b2c21380c7b47a2544203fde58beb88a310e582643b58e38589c785551710b4d992feaf38625d55c77d3a95efd3f00751276f84382021d6b1
@@ -8,6 +8,8 @@ jobs:
8
8
  strategy:
9
9
  matrix:
10
10
  ruby_version: [2.6, 2.7]
11
+ env:
12
+ CI: true
11
13
  steps:
12
14
  - uses: actions/checkout@v2
13
15
  - name: Set up Ruby
data/.rubocop.yml CHANGED
@@ -2,11 +2,13 @@ require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
4
  DisplayCopNames: true
5
+ NewCops: enable
5
6
  Exclude:
6
7
  - bin/**/*
7
8
  - tmp/**/*
8
9
  - .bundle/**/*
9
10
  - vendor/**/*
11
+ - docs/**/*
10
12
  - veryfi.gemspec
11
13
 
12
14
  Style/Documentation:
@@ -23,6 +25,9 @@ Style/SymbolArray:
23
25
  Description: 'Use %i or %I for arrays of symbols.'
24
26
  Enabled: true
25
27
 
28
+ Style/StringConcatenation:
29
+ Enabled: false
30
+
26
31
  Style/StringLiterals:
27
32
  EnforcedStyle: double_quotes
28
33
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veryfi (0.1.1)
4
+ veryfi (0.1.2)
5
5
  base64 (~> 0.1)
6
6
  faraday (~> 1.7)
7
7
  openssl (~> 2.2)
@@ -11,15 +11,16 @@ GEM
11
11
  specs:
12
12
  addressable (2.8.0)
13
13
  public_suffix (>= 2.0.2, < 5.0)
14
- ast (2.4.0)
14
+ ast (2.4.2)
15
15
  base64 (0.1.0)
16
- bundler-audit (0.6.1)
16
+ bundler-audit (0.9.0)
17
17
  bundler (>= 1.2.0, < 3)
18
- thor (~> 0.18)
18
+ thor (~> 1.0)
19
19
  coderay (1.1.3)
20
20
  crack (0.4.5)
21
21
  rexml
22
- diff-lcs (1.3)
22
+ diff-lcs (1.4.4)
23
+ docile (1.4.0)
23
24
  faraday (1.7.1)
24
25
  faraday-em_http (~> 1.0)
25
26
  faraday-em_synchrony (~> 1.0)
@@ -40,49 +41,60 @@ GEM
40
41
  faraday-patron (1.0.0)
41
42
  faraday-rack (1.0.0)
42
43
  hashdiff (1.0.1)
43
- jaro_winkler (1.5.4)
44
44
  method_source (1.0.0)
45
45
  multipart-post (2.1.1)
46
46
  openssl (2.2.0)
47
- parallel (1.19.1)
48
- parser (2.7.1.1)
49
- ast (~> 2.4.0)
47
+ parallel (1.20.1)
48
+ parser (3.0.2.0)
49
+ ast (~> 2.4.1)
50
50
  pry (0.14.1)
51
51
  coderay (~> 1.1)
52
52
  method_source (~> 1.0)
53
53
  public_suffix (4.0.6)
54
54
  rainbow (3.0.0)
55
55
  rake (13.0.6)
56
+ regexp_parser (2.1.1)
56
57
  rexml (3.2.5)
57
- rspec (3.9.0)
58
- rspec-core (~> 3.9.0)
59
- rspec-expectations (~> 3.9.0)
60
- rspec-mocks (~> 3.9.0)
61
- rspec-core (3.9.1)
62
- rspec-support (~> 3.9.1)
63
- rspec-expectations (3.9.1)
58
+ rspec (3.10.0)
59
+ rspec-core (~> 3.10.0)
60
+ rspec-expectations (~> 3.10.0)
61
+ rspec-mocks (~> 3.10.0)
62
+ rspec-core (3.10.1)
63
+ rspec-support (~> 3.10.0)
64
+ rspec-expectations (3.10.1)
64
65
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.9.0)
66
+ rspec-support (~> 3.10.0)
66
67
  rspec-its (1.3.0)
67
68
  rspec-core (>= 3.0.0)
68
69
  rspec-expectations (>= 3.0.0)
69
- rspec-mocks (3.9.1)
70
+ rspec-mocks (3.10.2)
70
71
  diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.9.0)
72
- rspec-support (3.9.2)
73
- rubocop (0.82.0)
74
- jaro_winkler (~> 1.5.1)
72
+ rspec-support (~> 3.10.0)
73
+ rspec-support (3.10.2)
74
+ rubocop (0.93.1)
75
75
  parallel (~> 1.10)
76
- parser (>= 2.7.0.1)
76
+ parser (>= 2.7.1.5)
77
77
  rainbow (>= 2.2.2, < 4.0)
78
+ regexp_parser (>= 1.8)
78
79
  rexml
80
+ rubocop-ast (>= 0.6.0)
79
81
  ruby-progressbar (~> 1.7)
80
82
  unicode-display_width (>= 1.4.0, < 2.0)
81
- rubocop-rspec (1.38.1)
82
- rubocop (>= 0.68.1)
83
- ruby-progressbar (1.10.1)
83
+ rubocop-ast (1.11.0)
84
+ parser (>= 3.0.1.1)
85
+ rubocop-rspec (1.44.1)
86
+ rubocop (~> 0.87)
87
+ rubocop-ast (>= 0.7.1)
88
+ ruby-progressbar (1.11.0)
84
89
  ruby2_keywords (0.0.5)
85
- thor (0.20.3)
90
+ simplecov (0.21.2)
91
+ docile (~> 1.1)
92
+ simplecov-html (~> 0.11)
93
+ simplecov_json_formatter (~> 0.1)
94
+ simplecov-badge (2.0.2)
95
+ simplecov-html (0.12.3)
96
+ simplecov_json_formatter (0.1.3)
97
+ thor (1.1.0)
86
98
  unicode-display_width (1.7.0)
87
99
  vcr (6.0.0)
88
100
  webmock (3.14.0)
@@ -91,20 +103,23 @@ GEM
91
103
  hashdiff (>= 0.4.0, < 2.0.0)
92
104
 
93
105
  PLATFORMS
94
- ruby
106
+ x86_64-darwin-19
107
+ x86_64-linux
95
108
 
96
109
  DEPENDENCIES
97
- bundler (~> 1.17)
98
- bundler-audit (~> 0.6)
110
+ bundler (~> 2.2)
111
+ bundler-audit (~> 0.9)
99
112
  pry (~> 0.14)
100
113
  rake (~> 13.0)
101
114
  rspec (~> 3.9)
102
115
  rspec-its (~> 1.3)
103
116
  rubocop (~> 0.82)
104
117
  rubocop-rspec (~> 1.38)
118
+ simplecov (~> 0.21)
119
+ simplecov-badge (~> 2.0)
105
120
  vcr (~> 6.0)
106
121
  veryfi!
107
122
  webmock (~> 3.14)
108
123
 
109
124
  BUNDLED WITH
110
- 1.17.2
125
+ 2.2.26
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ![Veryfi Logo](https://cdn.veryfi.com/logos/veryfi-logo-wide-github.png)
4
4
 
5
+ [![Version](https://img.shields.io/gem/v/veryfi)](https://rubygems.org/gems/veryfi)
6
+ [![Test](https://github.com/slavakisel/veryfi-ruby/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/slavakisel/veryfi-ruby/actions/workflows/test.yml)
7
+
8
+ [![Coverage](https://raw.githubusercontent.com/slavakisel/veryfi-ruby/main/coverage/coverage-badge.png)](https://raw.githubusercontent.com/slavakisel/veryfi-ruby/main/coverage/coverage-badge.png)
9
+
5
10
  ## Table of Contents
6
11
 
7
12
  - [Veryfi SDK for Ruby](#veryfi-sdk-for-ruby)
@@ -10,18 +15,13 @@
10
15
  - [Getting Started](#getting-started)
11
16
  - [Obtaining Client ID and user keys](#obtaining-client-id-and-user-keys)
12
17
  - [Ruby API Client Library](#ruby-api-client-library)
13
- - [Extracting Data](#extracting-data)
14
- - [Document Response Example](#document-response-example)
15
- - [Other methods](#other-methods)
16
18
  - [Need help?](#need-help)
17
- - [Learn more at our blog](#learn-more-at-our-blog)
18
- - [Tutorial Video](#tutorial-video)
19
19
  - [For Developers](#for-developers)
20
20
  - [Install](#install)
21
21
  - [Quality tools](#quality-tools)
22
22
  - [Develop](#develop)
23
23
 
24
- **veryfi** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
24
+ **veryfi-ruby** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
25
25
 
26
26
  ## Installation
27
27
 
@@ -31,7 +31,7 @@ gem install veryfi
31
31
 
32
32
  Or add to your Gemfile:
33
33
  ```ruby
34
- gem 'veryfi', '>= 0.1.0'
34
+ gem 'veryfi', '~> 0.1'
35
35
  ```
36
36
 
37
37
  ## Getting Started
@@ -42,263 +42,13 @@ If you don't have an account with Veryfi, please go ahead and register here: [ht
42
42
 
43
43
  ### Ruby API Client Library
44
44
 
45
- The **veryfi** gem can be used to communicate with Veryfi API. All available functionality is described here: <https://veryfi.github.io/veryfi-ruby/Client.html>
46
-
47
- Below is a sample script using **Veryfi** for OCR and extracting data from a document:
48
-
49
- ### Extracting Data
50
-
51
- ```ruby
52
- require 'veryfi'
53
-
54
- veryfi_client = Veryfi::Client.new(
55
- client_id: 'your_client_id',
56
- client_secret: 'your_client_secret',
57
- username: 'your_username',
58
- api_key: 'your_password'
59
- )
60
- ```
61
-
62
- This submits a document for processing (3-5 seconds for a response)
63
-
64
- ```ruby
65
- params = {
66
- file_path: './test/receipt.jpg',
67
- auto_delete: 1,
68
- boost_mode: 1,
69
- async: 1,
70
- external_id: '123456789',
71
- max_pages_to_process: 10,
72
- tags: ['tag1'],
73
- categories: [
74
- 'Advertising & Marketing',
75
- 'Automotive'
76
- ]
77
- }
78
-
79
- response = veryfi_client.document.process(params)
80
-
81
- puts response
82
- ```
83
-
84
- ...or with a URL
85
-
86
- ```ruby
87
- params = {
88
- file_url: "https://raw.githubusercontent.com/veryfi/veryfi-python/master/tests/assets/receipt_public.jpg",
89
- auto_delete: 1,
90
- boost_mode: 1,
91
- async: 1,
92
- external_id: "123456789",
93
- max_pages_to_process: 10,
94
- tags: ["tag1"],
95
- categories: [
96
- "Advertising & Marketing",
97
- "Automotive"
98
- ]
99
- }
100
-
101
- response = veryfi_client.document.process_url(params)
102
-
103
- puts response
104
- ```
105
-
106
- ### Document Response Example
107
-
108
- ```json
109
- {
110
- "abn_number": "",
111
- "account_number": "",
112
- "bill_to_address": "2 Court Square\nNew York, NY 12210",
113
- "bill_to_name": "John Smith",
114
- "bill_to_vat_number": "",
115
- "card_number": "",
116
- "cashback": 0,
117
- "category": "Repairs & Maintenance",
118
- "created": "2021-06-28 19:20:02",
119
- "currency_code": "USD",
120
- "date": "2019-02-11 00:00:00",
121
- "delivery_date": "",
122
- "discount": 0,
123
- "document_reference_number": "",
124
- "document_title": "",
125
- "document_type": "invoice",
126
- "due_date": "2019-02-26",
127
- "duplicate_of": 37055375,
128
- "external_id": "",
129
- "id": 37187909,
130
- "img_file_name": "receipt.png",
131
- "img_thumbnail_url": "https://scdn.veryfi.com/receipts/thumbnail.png",
132
- "img_url": "https://scdn.veryfi.com/receipts/receipt.png",
133
- "insurance": "",
134
- "invoice_number": "US-001",
135
- "is_duplicate": 1,
136
- "line_items": [
137
- {
138
- "date": "",
139
- "description": "Front and rear brake cables",
140
- "discount": 0,
141
- "id": 68004313,
142
- "order": 0,
143
- "price": 100,
144
- "quantity": 1,
145
- "reference": "",
146
- "section": "",
147
- "sku": "",
148
- "tax": 0,
149
- "tax_rate": 0,
150
- "total": 100,
151
- "type": "product",
152
- "unit_of_measure": ""
153
- },
154
- {
155
- "date": "",
156
- "description": "New set of pedal arms",
157
- "discount": 0,
158
- "id": 68004315,
159
- "order": 1,
160
- "price": 15,
161
- "quantity": 2,
162
- "reference": "",
163
- "section": "",
164
- "sku": "",
165
- "tax": 0,
166
- "tax_rate": 0,
167
- "total": 30,
168
- "type": "product",
169
- "unit_of_measure": ""
170
- },
171
- {
172
- "date": "",
173
- "description": "Labor 3hrs",
174
- "discount": 0,
175
- "id": 68004316,
176
- "order": 2,
177
- "price": 5,
178
- "quantity": 3,
179
- "reference": "",
180
- "section": "",
181
- "sku": "",
182
- "tax": 0,
183
- "tax_rate": 0,
184
- "total": 15,
185
- "type": "service",
186
- "unit_of_measure": ""
187
- }
188
- ],
189
- "notes": "",
190
- "ocr_text": "\n\fEast Repair Inc.\n1912 Harvest Lane\nNew York, NY 12210\n\nBILL TO\t\tSHIP TO\tRECEIPT #\tUS-001\nJohn Smith\t\tJohn Smith\tRECEIPT DATE\t11/02/2019\n2 Court Square\t3787 Pineview Drive\n\tP.O.#\t2312/2019\nNew York, NY 12210\tCambridge, MA 12210\n\tDUE DATE\t26/02/2019\nReceipt Total\t\t\t$154.06\n\nQTY DESCRIPTION\t\t\tUNIT PRICE\tAMOUNT\n1\tFront and rear brake cables\t\t100.00\t100.00\n2\tNew set of pedal arms\t\t\t15.00\t30.00\n3\tLabor 3hrs\t\t\t\t5.00\t15.00\n\n\tSubtotal\t145.00\n\tSales Tax 6.25%\t9.06\n\nTERMS & CONDITIONS\nPayment is due within 15 days\nPlease make checks payable to: East Repair\n\tJohn Smith\n\tInc.\n",
191
- "order_date": "",
192
- "payment_display_name": "",
193
- "payment_terms": "15 days",
194
- "payment_type": "",
195
- "phone_number": "",
196
- "purchase_order_number": "2312/2019",
197
- "rounding": 0,
198
- "service_end_date": "",
199
- "service_start_date": "",
200
- "ship_date": "",
201
- "ship_to_address": "3787 Pineview Drive\nCambridge, MA 12210",
202
- "ship_to_name": "John Smith",
203
- "shipping": 0,
204
- "store_number": "",
205
- "subtotal": 145,
206
- "tax": 9.06,
207
- "tax_lines": [
208
- {
209
- "base": 0,
210
- "name": "Sales",
211
- "order": 0,
212
- "rate": 6.25,
213
- "total": 9.06
214
- }
215
- ],
216
- "tip": 0,
217
- "total": 154.06,
218
- "total_weight": "",
219
- "tracking_number": "",
220
- "updated": "2021-06-28 19:20:03",
221
- "vat_number": "",
222
- "vendor": {
223
- "address": "1912 Harvest Lane\nNew York, NY 12210",
224
- "category": "Car Repair",
225
- "email": "",
226
- "fax_number": "",
227
- "name": "East Repair",
228
- "phone_number": "",
229
- "raw_name": "East Repair Inc.",
230
- "vendor_logo": "https://cdn.veryfi.com/logos/tmp/560806841.png",
231
- "vendor_reg_number": "",
232
- "vendor_type": "Car Repair",
233
- "web": ""
234
- },
235
- "vendor_account_number": "",
236
- "vendor_bank_name": "",
237
- "vendor_bank_number": "",
238
- "vendor_bank_swift": "",
239
- "vendor_iban": ""
240
- }
241
- ```
242
-
243
- ### Other methods
244
-
245
- ```ruby
246
- # Update document
247
- veryfi_client.document.update(document_id, params)
248
-
249
- # Delete document by ID
250
- veryfi_client.document.delete(document_id)
251
-
252
- # Get document by ID
253
- veryfi_client.document.get(document_id)
254
-
255
- # List all documents
256
- veryfi_client.document.all
257
-
258
- # Get document line items
259
- veryfi_client.line_items.all(document_id)
260
-
261
- # Get line item by document id and line item id
262
- veryfi_client.line_items.get(document_id, id)
263
-
264
- # Create/update/delete document line item
265
- veryfi_client.line_items.create(document_id, params)
266
- veryfi_client.line_items.update(document_id, params)
267
- veryfi_client.line_items.delete(document_id, params)
268
-
269
- # Tags
270
- # List all tags
271
- veryfi_client.tag.all
272
-
273
- # Delete a tag by ID
274
- veryfi_client.tag.delete(id)
275
-
276
- # List all document tags
277
- veryfi_client.document_tag.all(document_id)
278
-
279
- # Add tag to document
280
- veryfi_client.document_tag.add(document_id, name: "tag_name")
281
-
282
- # Delete tag by document id and tag id
283
- veryfi_client.document_tag.delete(document_id, id)
284
-
285
- # Delete all document tags
286
- veryfi_client.document_tag.delete_all(document_id)
287
- ```
45
+ The **veryfi-ruby** gem can be used to communicate with Veryfi API. All available functionality is described [in docs](https://skdev.info/veryfi-ruby/)
288
46
 
289
47
  ## Need help?
290
48
 
291
49
  If you run into any issue or need help installing or using the library, please contact support@veryfi.com.
292
50
 
293
51
  If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!
294
- ### [Learn more at our blog](https://www.veryfi.com/ruby/)
295
-
296
- ## Tutorial Video
297
-
298
- TBD
299
- <!-- [![Veryfi Tutorial]()]() -->
300
-
301
- ---
302
52
 
303
53
  # For Developers
304
54