veryfi 0.1.2 → 0.1.3

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: c0b98174bc21d552218a407a17a0801218b4a93c76adbd6676d081e6c98eb9c7
4
- data.tar.gz: edf7a6c1f283eb3d2f4369554c72dd6fb627674b2dc752f1040f145537197946
3
+ metadata.gz: fa063aa14b6a540ea48bd02a484b211e5acc7e11bb4aaf59068f59e983f69ed5
4
+ data.tar.gz: 754e3dec09c3beb49939c34f133b24a27f3d45cf89d6adcf44601cb12e46a46c
5
5
  SHA512:
6
- metadata.gz: 21251717fe8fe9e0c424700ff1d1b0776f089cabe764fb55c3abf5509eb94014021bdaf64cbe8fbe1571f2840049b0c02367a655d5fa6f6887cd924cfdbb4363
7
- data.tar.gz: 603f846c3eb5376b2c21380c7b47a2544203fde58beb88a310e582643b58e38589c785551710b4d992feaf38625d55c77d3a95efd3f00751276f84382021d6b1
6
+ metadata.gz: '0869e3e754ce266a002f6d995b62102f94140b4203316f16b5436979a35b53eea42f18fdda25c978a3c213c7e4f131ce869c494b652bf18272b74b651429d07d'
7
+ data.tar.gz: 1428c37fdf6b6ca08dcd62d6aef36c6888297584caf0979b5e5650c5b25a5abde4bd8288e2122ca8cd9f902745ef27632309e0ef216407cf3b15290f19abeb08
@@ -22,5 +22,5 @@ jobs:
22
22
  env:
23
23
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
24
24
  RELEASE_COMMAND: bin/release
25
- GIT_EMAIL: slava@skdev.info
25
+ GIT_EMAIL: support@veryfi.com
26
26
  GIT_NAME: Github Action
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veryfi (0.1.2)
4
+ veryfi (0.1.3)
5
5
  base64 (~> 0.1)
6
6
  faraday (~> 1.7)
7
7
  openssl (~> 2.2)
data/README.md CHANGED
@@ -3,14 +3,15 @@
3
3
  ![Veryfi Logo](https://cdn.veryfi.com/logos/veryfi-logo-wide-github.png)
4
4
 
5
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)
6
+ [![Test](https://github.com/veryfi/veryfi-ruby/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/veryfi/veryfi-ruby/actions/workflows/test.yml)
7
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)
8
+ [![Coverage](https://raw.githubusercontent.com/veryfi/veryfi-ruby/main/coverage/coverage-badge.png)](https://raw.githubusercontent.com/veryfi/veryfi-ruby/main/coverage/coverage-badge.png)
9
9
 
10
10
  ## Table of Contents
11
11
 
12
12
  - [Veryfi SDK for Ruby](#veryfi-sdk-for-ruby)
13
13
  - [Table of Contents](#table-of-contents)
14
+ - [Example](#example)
14
15
  - [Installation](#installation)
15
16
  - [Getting Started](#getting-started)
16
17
  - [Obtaining Client ID and user keys](#obtaining-client-id-and-user-keys)
@@ -23,6 +24,202 @@
23
24
 
24
25
  **veryfi-ruby** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
25
26
 
27
+ ## Example
28
+
29
+ Below is a sample script using <a href="https://www.veryfi.com" target="_blank">**Veryfi**</a> for OCR and extracting data from a document:
30
+
31
+ ```ruby
32
+ require 'veryfi'
33
+
34
+ veryfi_client = Veryfi::Client.new(
35
+ client_id: 'your_client_id',
36
+ client_secret: 'your_client_secret',
37
+ username: 'your_username',
38
+ api_key: 'your_password'
39
+ )
40
+ ```
41
+
42
+ This submits a document for processing (3-5 seconds for a response)
43
+
44
+ ```ruby
45
+ params = {
46
+ file_path: './test/receipt.jpg',
47
+ auto_delete: true,
48
+ boost_mode: false,
49
+ async: false,
50
+ external_id: '123456789',
51
+ max_pages_to_process: 10,
52
+ tags: ['tag1'],
53
+ categories: [
54
+ 'Advertising & Marketing',
55
+ 'Automotive'
56
+ ]
57
+ }
58
+
59
+ response = veryfi_client.document.process(params)
60
+
61
+ puts response
62
+ ```
63
+
64
+ ...or with a URL
65
+
66
+ ```ruby
67
+ params = {
68
+ file_url: 'https://raw.githubusercontent.com/veryfi/veryfi-python/master/tests/assets/receipt_public.jpg',
69
+ auto_delete: true,
70
+ boost_mode: false,
71
+ async: false,
72
+ external_id: '123456789',
73
+ max_pages_to_process: 10,
74
+ tags: ['tag1'],
75
+ categories: [
76
+ 'Advertising & Marketing',
77
+ 'Automotive'
78
+ ]
79
+ }
80
+
81
+ response = veryfi_client.document.process_url(params)
82
+
83
+ puts response
84
+ ```
85
+
86
+ This will produce the following response:
87
+
88
+ ```json
89
+ {
90
+ "abn_number": "",
91
+ "account_number": "",
92
+ "bill_to_address": "2 Court Square\nNew York, NY 12210",
93
+ "bill_to_name": "John Smith",
94
+ "bill_to_vat_number": "",
95
+ "card_number": "",
96
+ "cashback": 0,
97
+ "category": "Repairs & Maintenance",
98
+ "created": "2021-06-28 19:20:02",
99
+ "currency_code": "USD",
100
+ "date": "2019-02-11 00:00:00",
101
+ "delivery_date": "",
102
+ "discount": 0,
103
+ "document_reference_number": "",
104
+ "document_title": "",
105
+ "document_type": "invoice",
106
+ "due_date": "2019-02-26",
107
+ "duplicate_of": 37055375,
108
+ "external_id": "",
109
+ "id": 37187909,
110
+ "img_file_name": "receipt.png",
111
+ "img_thumbnail_url": "https://scdn.veryfi.com/receipts/thumbnail.png",
112
+ "img_url": "https://scdn.veryfi.com/receipts/receipt.png",
113
+ "insurance": "",
114
+ "invoice_number": "US-001",
115
+ "is_duplicate": 1,
116
+ "line_items": [
117
+ {
118
+ "date": "",
119
+ "description": "Front and rear brake cables",
120
+ "discount": 0,
121
+ "id": 68004313,
122
+ "order": 0,
123
+ "price": 100,
124
+ "quantity": 1,
125
+ "reference": "",
126
+ "section": "",
127
+ "sku": "",
128
+ "tax": 0,
129
+ "tax_rate": 0,
130
+ "total": 100,
131
+ "type": "product",
132
+ "unit_of_measure": ""
133
+ },
134
+ {
135
+ "date": "",
136
+ "description": "New set of pedal arms",
137
+ "discount": 0,
138
+ "id": 68004315,
139
+ "order": 1,
140
+ "price": 15,
141
+ "quantity": 2,
142
+ "reference": "",
143
+ "section": "",
144
+ "sku": "",
145
+ "tax": 0,
146
+ "tax_rate": 0,
147
+ "total": 30,
148
+ "type": "product",
149
+ "unit_of_measure": ""
150
+ },
151
+ {
152
+ "date": "",
153
+ "description": "Labor 3hrs",
154
+ "discount": 0,
155
+ "id": 68004316,
156
+ "order": 2,
157
+ "price": 5,
158
+ "quantity": 3,
159
+ "reference": "",
160
+ "section": "",
161
+ "sku": "",
162
+ "tax": 0,
163
+ "tax_rate": 0,
164
+ "total": 15,
165
+ "type": "service",
166
+ "unit_of_measure": ""
167
+ }
168
+ ],
169
+ "notes": "",
170
+ "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",
171
+ "order_date": "",
172
+ "payment_display_name": "",
173
+ "payment_terms": "15 days",
174
+ "payment_type": "",
175
+ "phone_number": "",
176
+ "purchase_order_number": "2312/2019",
177
+ "rounding": 0,
178
+ "service_end_date": "",
179
+ "service_start_date": "",
180
+ "ship_date": "",
181
+ "ship_to_address": "3787 Pineview Drive\nCambridge, MA 12210",
182
+ "ship_to_name": "John Smith",
183
+ "shipping": 0,
184
+ "store_number": "",
185
+ "subtotal": 145,
186
+ "tax": 9.06,
187
+ "tax_lines": [
188
+ {
189
+ "base": 0,
190
+ "name": "Sales",
191
+ "order": 0,
192
+ "rate": 6.25,
193
+ "total": 9.06
194
+ }
195
+ ],
196
+ "tip": 0,
197
+ "total": 154.06,
198
+ "total_weight": "",
199
+ "tracking_number": "",
200
+ "updated": "2021-06-28 19:20:03",
201
+ "vat_number": "",
202
+ "vendor": {
203
+ "address": "1912 Harvest Lane\nNew York, NY 12210",
204
+ "category": "Car Repair",
205
+ "email": "",
206
+ "fax_number": "",
207
+ "name": "East Repair",
208
+ "phone_number": "",
209
+ "raw_name": "East Repair Inc.",
210
+ "vendor_logo": "https://cdn.veryfi.com/logos/tmp/560806841.png",
211
+ "vendor_reg_number": "",
212
+ "vendor_type": "Car Repair",
213
+ "web": ""
214
+ },
215
+ "vendor_account_number": "",
216
+ "vendor_bank_name": "",
217
+ "vendor_bank_number": "",
218
+ "vendor_bank_swift": "",
219
+ "vendor_iban": ""
220
+ }
221
+ ```
222
+
26
223
  ## Installation
27
224
 
28
225
  ```bash
@@ -42,7 +239,7 @@ If you don't have an account with Veryfi, please go ahead and register here: [ht
42
239
 
43
240
  ### Ruby API Client Library
44
241
 
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/)
242
+ The **veryfi-ruby** gem can be used to communicate with Veryfi API. All available functionality is described [in docs](https://veryfi.github.io/veryfi-ruby/)
46
243
 
47
244
  ## Need help?
48
245
 
data/bin/release CHANGED
@@ -7,3 +7,6 @@ gem build veryfi.gemspec
7
7
  gem_version=$(ruby -r rubygems -e "puts Gem::Specification::load('$(ls *.gemspec)').version")
8
8
 
9
9
  gem push veryfi-$gem_version.gem
10
+
11
+ git tag v$gem_version
12
+ git push --tags
Binary file
data/docs/_config.yml CHANGED
@@ -23,7 +23,7 @@ email: support@veryfi.com
23
23
  description: >- # this means to ignore newlines until "baseurl:"
24
24
  Veryfi is a Ruby gem for communicating with the Veryfi OCR API
25
25
  baseurl: "/veryfi-ruby" # the subpath of your site, e.g. /blog
26
- url: "https://skdev.info" # the base hostname & protocol for your site, e.g. http://example.com
26
+ url: "https://veryfi.github.io" # the base hostname & protocol for your site, e.g. http://example.com
27
27
  github_username: veryfi
28
28
  markdown: kramdown
29
29
  # Build settings
data/docs/index.markdown CHANGED
@@ -30,9 +30,9 @@ This submits a document for processing (3-5 seconds for a response)
30
30
  ```ruby
31
31
  params = {
32
32
  file_path: './test/receipt.jpg',
33
- auto_delete: 1,
34
- boost_mode: 1,
35
- async: 1,
33
+ auto_delete: true,
34
+ boost_mode: false,
35
+ async: false,
36
36
  external_id: '123456789',
37
37
  max_pages_to_process: 10,
38
38
  tags: ['tag1'],
@@ -52,9 +52,9 @@ puts response
52
52
  ```ruby
53
53
  params = {
54
54
  file_url: "https://raw.githubusercontent.com/veryfi/veryfi-python/master/tests/assets/receipt_public.jpg",
55
- auto_delete: 1,
56
- boost_mode: 1,
57
- async: 1,
55
+ auto_delete: true,
56
+ boost_mode: false,
57
+ async: false,
58
58
  external_id: "123456789",
59
59
  max_pages_to_process: 10,
60
60
  tags: ["tag1"],
@@ -90,7 +90,7 @@ module Veryfi
90
90
 
91
91
  def default_headers
92
92
  {
93
- "User-Agent": "Ruby Veryfi-Ruby/0.1.0",
93
+ "User-Agent": "Ruby Veryfi-Ruby/#{Veryfi::VERSION}",
94
94
  "Accept": "application/json",
95
95
  "Content-Type": "application/json",
96
96
  "Client-Id": client_id,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Veryfi
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: veryfi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veryfi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2021-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64