veryfi 0.1.0 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 972fb13315f5c1012a72fbfe8d2c9647c6bf84cd4f5647df3d520d28aed07e28
4
- data.tar.gz: a61e364851843f93804116308577155722ec30b6366e946eb4057025a4cc5b4d
3
+ metadata.gz: 2dfb0025549fca927a9ac0badcd5cb0aca467bb4bd67cd899b715a01499fbdbd
4
+ data.tar.gz: ad4805a5f6729fbad09d3d5b0c9f3454182dbcc8c010b9ad534bff9943c220bd
5
5
  SHA512:
6
- metadata.gz: 397640a0588d132fcd069665a32252653f57518fbc55d7e49c520ad61bede0a3f19c56594e3c5f33df9cd5ac313f0eaf16c540a60f26a993b7f660eba2f1adb2
7
- data.tar.gz: 15defaabd5b76bdc06ad95eb20c6336d26736a986e8c6a4d136f46a6406076aa49a9d2ed278f805d415db8482a8697bdfe0b72e8636216bb31e784265c242901
6
+ metadata.gz: 6cddf104265757d407e4523359fa6b0aa1a0674527b723cd4ce67b1dcdfb0707089edf7dccc591fc931aeb9e7f880438077760f51d497ba20221d17da7642140
7
+ data.tar.gz: 998431b237b95ef26ab665f79792a3ae7057fb0cfef5d6a31f8697010d1849f2257eda0bf5968995535d49aef7e0f4b3b1f170ab1ecddc14f4e0e9d945cee5bc
@@ -0,0 +1,26 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby
15
+ run: |
16
+ sudo apt install ruby-full=1:2.7+1
17
+ sudo gem install bundler:2.2
18
+ bundle _2.2.0_ install
19
+ sudo apt update
20
+ - name: Release Gem
21
+ uses: discourse/publish-rubygems-action@v2-beta
22
+ env:
23
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
24
+ RELEASE_COMMAND: bin/release
25
+ GIT_EMAIL: support@veryfi.com
26
+ GIT_NAME: Github Action
@@ -0,0 +1,19 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ env:
9
+ CI: true
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Set up Ruby
13
+ run: |
14
+ sudo apt install ruby-full=1:2.7+1
15
+ sudo gem install bundler:2.2
16
+ bundle _2.2.0_ install
17
+ sudo apt update
18
+ - name: Run CI scripts
19
+ run: bin/ci
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ _yardoc
18
18
  doc/
19
19
 
20
20
  .env
21
+ .idea/
data/.rubocop.yml CHANGED
@@ -2,10 +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/**/*
10
+ - vendor/**/*
11
+ - docs/**/*
9
12
  - veryfi.gemspec
10
13
 
11
14
  Style/Documentation:
@@ -22,6 +25,9 @@ Style/SymbolArray:
22
25
  Description: 'Use %i or %I for arrays of symbols.'
23
26
  Enabled: true
24
27
 
28
+ Style/StringConcatenation:
29
+ Enabled: false
30
+
25
31
  Style/StringLiterals:
26
32
  EnforcedStyle: double_quotes
27
33
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veryfi (0.0.0)
4
+ veryfi (0.1.4)
5
+ base64 (~> 0.1)
5
6
  faraday (~> 1.7)
6
7
  openssl (~> 2.2)
7
8
 
@@ -10,77 +11,96 @@ GEM
10
11
  specs:
11
12
  addressable (2.8.0)
12
13
  public_suffix (>= 2.0.2, < 5.0)
13
- ast (2.4.0)
14
- bundler-audit (0.6.1)
14
+ ast (2.4.2)
15
+ base64 (0.1.1)
16
+ bundler-audit (0.9.0)
15
17
  bundler (>= 1.2.0, < 3)
16
- thor (~> 0.18)
18
+ thor (~> 1.0)
17
19
  coderay (1.1.3)
18
20
  crack (0.4.5)
19
21
  rexml
20
- diff-lcs (1.3)
21
- faraday (1.7.1)
22
+ diff-lcs (1.4.4)
23
+ docile (1.4.0)
24
+ faraday (1.9.3)
22
25
  faraday-em_http (~> 1.0)
23
26
  faraday-em_synchrony (~> 1.0)
24
27
  faraday-excon (~> 1.1)
25
- faraday-httpclient (~> 1.0.1)
28
+ faraday-httpclient (~> 1.0)
29
+ faraday-multipart (~> 1.0)
26
30
  faraday-net_http (~> 1.0)
27
- faraday-net_http_persistent (~> 1.1)
31
+ faraday-net_http_persistent (~> 1.0)
28
32
  faraday-patron (~> 1.0)
29
33
  faraday-rack (~> 1.0)
30
- multipart-post (>= 1.2, < 3)
34
+ faraday-retry (~> 1.0)
31
35
  ruby2_keywords (>= 0.0.4)
32
36
  faraday-em_http (1.0.0)
33
37
  faraday-em_synchrony (1.0.0)
34
38
  faraday-excon (1.1.0)
35
39
  faraday-httpclient (1.0.1)
40
+ faraday-multipart (1.0.3)
41
+ multipart-post (>= 1.2, < 3)
36
42
  faraday-net_http (1.0.1)
37
43
  faraday-net_http_persistent (1.2.0)
38
44
  faraday-patron (1.0.0)
39
45
  faraday-rack (1.0.0)
46
+ faraday-retry (1.0.3)
40
47
  hashdiff (1.0.1)
41
- jaro_winkler (1.5.4)
48
+ ipaddr (1.2.3)
42
49
  method_source (1.0.0)
43
50
  multipart-post (2.1.1)
44
- openssl (2.2.0)
45
- parallel (1.19.1)
46
- parser (2.7.1.1)
47
- ast (~> 2.4.0)
51
+ openssl (2.2.1)
52
+ ipaddr
53
+ parallel (1.20.1)
54
+ parser (3.0.2.0)
55
+ ast (~> 2.4.1)
48
56
  pry (0.14.1)
49
57
  coderay (~> 1.1)
50
58
  method_source (~> 1.0)
51
59
  public_suffix (4.0.6)
52
60
  rainbow (3.0.0)
53
61
  rake (13.0.6)
62
+ regexp_parser (2.1.1)
54
63
  rexml (3.2.5)
55
- rspec (3.9.0)
56
- rspec-core (~> 3.9.0)
57
- rspec-expectations (~> 3.9.0)
58
- rspec-mocks (~> 3.9.0)
59
- rspec-core (3.9.1)
60
- rspec-support (~> 3.9.1)
61
- rspec-expectations (3.9.1)
64
+ rspec (3.10.0)
65
+ rspec-core (~> 3.10.0)
66
+ rspec-expectations (~> 3.10.0)
67
+ rspec-mocks (~> 3.10.0)
68
+ rspec-core (3.10.1)
69
+ rspec-support (~> 3.10.0)
70
+ rspec-expectations (3.10.1)
62
71
  diff-lcs (>= 1.2.0, < 2.0)
63
- rspec-support (~> 3.9.0)
72
+ rspec-support (~> 3.10.0)
64
73
  rspec-its (1.3.0)
65
74
  rspec-core (>= 3.0.0)
66
75
  rspec-expectations (>= 3.0.0)
67
- rspec-mocks (3.9.1)
76
+ rspec-mocks (3.10.2)
68
77
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.9.0)
70
- rspec-support (3.9.2)
71
- rubocop (0.82.0)
72
- jaro_winkler (~> 1.5.1)
78
+ rspec-support (~> 3.10.0)
79
+ rspec-support (3.10.2)
80
+ rubocop (0.93.1)
73
81
  parallel (~> 1.10)
74
- parser (>= 2.7.0.1)
82
+ parser (>= 2.7.1.5)
75
83
  rainbow (>= 2.2.2, < 4.0)
84
+ regexp_parser (>= 1.8)
76
85
  rexml
86
+ rubocop-ast (>= 0.6.0)
77
87
  ruby-progressbar (~> 1.7)
78
88
  unicode-display_width (>= 1.4.0, < 2.0)
79
- rubocop-rspec (1.38.1)
80
- rubocop (>= 0.68.1)
81
- ruby-progressbar (1.10.1)
89
+ rubocop-ast (1.11.0)
90
+ parser (>= 3.0.1.1)
91
+ rubocop-rspec (1.44.1)
92
+ rubocop (~> 0.87)
93
+ rubocop-ast (>= 0.7.1)
94
+ ruby-progressbar (1.11.0)
82
95
  ruby2_keywords (0.0.5)
83
- thor (0.20.3)
96
+ simplecov (0.21.2)
97
+ docile (~> 1.1)
98
+ simplecov-html (~> 0.11)
99
+ simplecov_json_formatter (~> 0.1)
100
+ simplecov-badge (2.0.2)
101
+ simplecov-html (0.12.3)
102
+ simplecov_json_formatter (0.1.3)
103
+ thor (1.1.0)
84
104
  unicode-display_width (1.7.0)
85
105
  vcr (6.0.0)
86
106
  webmock (3.14.0)
@@ -90,19 +110,23 @@ GEM
90
110
 
91
111
  PLATFORMS
92
112
  ruby
113
+ x86_64-darwin-19
114
+ x86_64-linux
93
115
 
94
116
  DEPENDENCIES
95
- bundler (~> 1.17)
96
- bundler-audit (~> 0.6)
117
+ bundler (~> 2.2)
118
+ bundler-audit (~> 0.9)
97
119
  pry (~> 0.14)
98
120
  rake (~> 13.0)
99
121
  rspec (~> 3.9)
100
122
  rspec-its (~> 1.3)
101
123
  rubocop (~> 0.82)
102
124
  rubocop-rspec (~> 1.38)
125
+ simplecov (~> 0.21)
126
+ simplecov-badge (~> 2.0)
103
127
  vcr (~> 6.0)
104
128
  veryfi!
105
129
  webmock (~> 3.14)
106
130
 
107
131
  BUNDLED WITH
108
- 1.17.2
132
+ 2.2.26
data/README.md CHANGED
@@ -2,51 +2,31 @@
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/veryfi/veryfi-ruby/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/veryfi/veryfi-ruby/actions/workflows/test.yml)
7
+
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
+
5
10
  ## Table of Contents
6
11
 
7
12
  - [Veryfi SDK for Ruby](#veryfi-sdk-for-ruby)
8
13
  - [Table of Contents](#table-of-contents)
14
+ - [Example](#example)
9
15
  - [Installation](#installation)
10
16
  - [Getting Started](#getting-started)
11
17
  - [Obtaining Client ID and user keys](#obtaining-client-id-and-user-keys)
12
18
  - [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
19
  - [Need help?](#need-help)
17
- - [Learn more at our blog](#learn-more-at-our-blog)
18
- - [Tutorial Video](#tutorial-video)
19
20
  - [For Developers](#for-developers)
20
21
  - [Install](#install)
21
22
  - [Quality tools](#quality-tools)
22
23
  - [Develop](#develop)
23
24
 
24
- **veryfi** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
25
+ **veryfi-ruby** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
25
26
 
26
- ## Installation
27
+ ## Example
27
28
 
28
- ```bash
29
- gem install veryfi
30
- ```
31
-
32
- Or add to your Gemfile:
33
- ```ruby
34
- gem 'veryfi', '>= 0.1.0'
35
- ```
36
-
37
- ## Getting Started
38
-
39
- ### Obtaining Client ID and user keys
40
-
41
- If you don't have an account with Veryfi, please go ahead and register here: [https://hub.veryfi.com/signup/api/](https://hub.veryfi.com/signup/api/)
42
-
43
- ### Ruby API Client Library
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
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:
50
30
 
51
31
  ```ruby
52
32
  require 'veryfi'
@@ -64,9 +44,9 @@ This submits a document for processing (3-5 seconds for a response)
64
44
  ```ruby
65
45
  params = {
66
46
  file_path: './test/receipt.jpg',
67
- auto_delete: 1,
68
- boost_mode: 1,
69
- async: 1,
47
+ auto_delete: true,
48
+ boost_mode: false,
49
+ async: false,
70
50
  external_id: '123456789',
71
51
  max_pages_to_process: 10,
72
52
  tags: ['tag1'],
@@ -85,16 +65,16 @@ puts response
85
65
 
86
66
  ```ruby
87
67
  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",
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',
93
73
  max_pages_to_process: 10,
94
- tags: ["tag1"],
74
+ tags: ['tag1'],
95
75
  categories: [
96
- "Advertising & Marketing",
97
- "Automotive"
76
+ 'Advertising & Marketing',
77
+ 'Automotive'
98
78
  ]
99
79
  }
100
80
 
@@ -103,7 +83,7 @@ response = veryfi_client.document.process_url(params)
103
83
  puts response
104
84
  ```
105
85
 
106
- ### Document Response Example
86
+ This will produce the following response:
107
87
 
108
88
  ```json
109
89
  {
@@ -240,65 +220,32 @@ puts response
240
220
  }
241
221
  ```
242
222
 
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)
223
+ ## Installation
263
224
 
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)
225
+ ```bash
226
+ gem install veryfi
227
+ ```
268
228
 
269
- # Tags
270
- # List all tags
271
- veryfi_client.tag.all
229
+ Or add to your Gemfile:
230
+ ```ruby
231
+ gem 'veryfi', '~> 0.1'
232
+ ```
272
233
 
273
- # Delete a tag by ID
274
- veryfi_client.tag.delete(id)
234
+ ## Getting Started
275
235
 
276
- # List all document tags
277
- veryfi_client.document_tag.all(document_id)
236
+ ### Obtaining Client ID and user keys
278
237
 
279
- # Add tag to document
280
- veryfi_client.document_tag.add(document_id, name: "tag_name")
238
+ If you don't have an account with Veryfi, please go ahead and register here: [https://hub.veryfi.com/signup/api/](https://hub.veryfi.com/signup/api/)
281
239
 
282
- # Delete tag by document id and tag id
283
- veryfi_client.document_tag.delete(document_id, id)
240
+ ### Ruby API Client Library
284
241
 
285
- # Delete all document tags
286
- veryfi_client.document_tag.delete_all(document_id)
287
- ```
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/)
288
243
 
289
244
  ## Need help?
290
245
 
291
246
  If you run into any issue or need help installing or using the library, please contact support@veryfi.com.
292
247
 
293
248
  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
249
 
303
250
  # For Developers
304
251
 
@@ -315,4 +262,12 @@ bin/setup
315
262
 
316
263
  ## Develop
317
264
 
318
- `bin/build` checks your specs and runs quality tools
265
+ `bin/ci` checks your specs and runs quality tools
266
+
267
+ ## Release
268
+
269
+ 1. Change version in `lib/veryfi/version.rb`
270
+ 2. Run bundle - this should update `Gemfile.lock`
271
+ 3. Commit changes and push to Github
272
+ 4. On Github go to `Actions` -> `Release` -> and click `Run workflow` to trigger release
273
+ 5. Workflow will publish gem to [Rubygems](https://rubygems.org/gems/veryfi) and also create a new tag in repository
data/bin/release ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env sh
2
+
3
+ set -e
4
+
5
+ gem build veryfi.gemspec
6
+
7
+ gem_version=$(ruby -r rubygems -e "puts Gem::Specification::load('$(ls *.gemspec)').version")
8
+
9
+ gem push veryfi-$gem_version.gem
10
+
11
+ git tag v$gem_version
12
+ git push --tags
Binary file
data/docs/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ _site
2
+ .sass-cache
3
+ .jekyll-cache
4
+ .jekyll-metadata
5
+ vendor
data/docs/404.html ADDED
@@ -0,0 +1,25 @@
1
+ ---
2
+ permalink: /404.html
3
+ layout: default
4
+ ---
5
+
6
+ <style type="text/css" media="screen">
7
+ .container {
8
+ margin: 10px auto;
9
+ max-width: 600px;
10
+ text-align: center;
11
+ }
12
+ h1 {
13
+ margin: 30px 0;
14
+ font-size: 4em;
15
+ line-height: 1;
16
+ letter-spacing: -1px;
17
+ }
18
+ </style>
19
+
20
+ <div class="container">
21
+ <h1>404</h1>
22
+
23
+ <p><strong>Page not found :(</strong></p>
24
+ <p>The requested page could not be found.</p>
25
+ </div>
data/docs/Gemfile ADDED
@@ -0,0 +1,30 @@
1
+ source "https://rubygems.org"
2
+ # Hello! This is where you manage which Jekyll version is used to run.
3
+ # When you want to use a different version, change it below, save the
4
+ # file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
5
+ #
6
+ # bundle exec jekyll serve
7
+ #
8
+ # This will help ensure the proper Jekyll version is running.
9
+ # Happy Jekylling!
10
+ gem "jekyll", "3.9.0"
11
+ # This is the default theme for new Jekyll sites. You may change this to anything you like.
12
+ gem "minima", "~> 2.5"
13
+ # If you want to use GitHub Pages, remove the "gem "jekyll"" above and
14
+ # uncomment the line below. To upgrade, run `bundle update github-pages`.
15
+ gem "github-pages", "~> 219", group: :jekyll_plugins
16
+ # If you have any plugins, put them here!
17
+ # group :jekyll_plugins do
18
+ # gem "jekyll-feed", "~> 0.12"
19
+ # end
20
+
21
+ # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
22
+ # and associated library.
23
+ platforms :mingw, :x64_mingw, :mswin, :jruby do
24
+ gem "tzinfo", "~> 1.2"
25
+ gem "tzinfo-data"
26
+ end
27
+
28
+ # Performance-booster for watching directories on Windows
29
+ gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
30
+