veryfi 0.0.0 → 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: 71ed0e3845f85312d16f9821240b9e04bb86bbeb0637a25970251543472d9edc
4
- data.tar.gz: 5daffbc243cc62df5bfbb4d18d72a5741850ddc59be6ba970f3f2f098db03f56
3
+ metadata.gz: fa063aa14b6a540ea48bd02a484b211e5acc7e11bb4aaf59068f59e983f69ed5
4
+ data.tar.gz: 754e3dec09c3beb49939c34f133b24a27f3d45cf89d6adcf44601cb12e46a46c
5
5
  SHA512:
6
- metadata.gz: ee64c026cd35bde32a2d116c5d2bfc9ee5e3581b3d096540b3c98688e6e94e161b2c7cf7cb342e862de7785dcb311864822e7563cebf4f6b0114535da2248d32
7
- data.tar.gz: fe14f1092b352c8b20a64fc61d92f5c450d9189abeeb0d325ab1acf1069732fb1a1d34eb6bb12ed54536eef1c1dd7eeec0922c13dcae8d09d8939b6fe93375d3
6
+ metadata.gz: '0869e3e754ce266a002f6d995b62102f94140b4203316f16b5436979a35b53eea42f18fdda25c978a3c213c7e4f131ce869c494b652bf18272b74b651429d07d'
7
+ data.tar.gz: 1428c37fdf6b6ca08dcd62d6aef36c6888297584caf0979b5e5650c5b25a5abde4bd8288e2122ca8cd9f902745ef27632309e0ef216407cf3b15290f19abeb08
@@ -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
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.7
18
+ # runs 'bundle install' and caches installed gems automatically
19
+ bundler-cache: true
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,22 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby_version: [2.6, 2.7]
11
+ env:
12
+ CI: true
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby_version }}
19
+ # runs 'bundle install' and caches installed gems automatically
20
+ bundler-cache: true
21
+ - name: Run CI scripts
22
+ run: bin/ci
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
 
@@ -60,6 +66,24 @@ Metrics/BlockLength:
60
66
  Naming/MemoizedInstanceVariableName:
61
67
  EnforcedStyleForLeadingUnderscores: required
62
68
 
69
+ RSpec/AnyInstance:
70
+ Enabled: false
71
+
72
+ RSpec/ExampleLength:
73
+ Max: 10
74
+
75
+ RSpec/DescribeClass:
76
+ Enabled: false
77
+
78
+ RSpec/MultipleExpectations:
79
+ Max: 5
80
+
81
+ RSpec/SharedExamples:
82
+ Enabled: false
83
+
84
+ Style/GuardClause:
85
+ Enabled: false
86
+
63
87
  Style/HashEachMethods:
64
88
  Enabled: true
65
89
 
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.3)
5
+ base64 (~> 0.1)
5
6
  faraday (~> 1.7)
6
7
  openssl (~> 2.2)
7
8
 
@@ -10,14 +11,16 @@ 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.0)
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)
22
+ diff-lcs (1.4.4)
23
+ docile (1.4.0)
21
24
  faraday (1.7.1)
22
25
  faraday-em_http (~> 1.0)
23
26
  faraday-em_synchrony (~> 1.0)
@@ -38,49 +41,60 @@ GEM
38
41
  faraday-patron (1.0.0)
39
42
  faraday-rack (1.0.0)
40
43
  hashdiff (1.0.1)
41
- jaro_winkler (1.5.4)
42
44
  method_source (1.0.0)
43
45
  multipart-post (2.1.1)
44
46
  openssl (2.2.0)
45
- parallel (1.19.1)
46
- parser (2.7.1.1)
47
- ast (~> 2.4.0)
47
+ parallel (1.20.1)
48
+ parser (3.0.2.0)
49
+ ast (~> 2.4.1)
48
50
  pry (0.14.1)
49
51
  coderay (~> 1.1)
50
52
  method_source (~> 1.0)
51
53
  public_suffix (4.0.6)
52
54
  rainbow (3.0.0)
53
55
  rake (13.0.6)
56
+ regexp_parser (2.1.1)
54
57
  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)
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)
62
65
  diff-lcs (>= 1.2.0, < 2.0)
63
- rspec-support (~> 3.9.0)
66
+ rspec-support (~> 3.10.0)
64
67
  rspec-its (1.3.0)
65
68
  rspec-core (>= 3.0.0)
66
69
  rspec-expectations (>= 3.0.0)
67
- rspec-mocks (3.9.1)
70
+ rspec-mocks (3.10.2)
68
71
  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)
72
+ rspec-support (~> 3.10.0)
73
+ rspec-support (3.10.2)
74
+ rubocop (0.93.1)
73
75
  parallel (~> 1.10)
74
- parser (>= 2.7.0.1)
76
+ parser (>= 2.7.1.5)
75
77
  rainbow (>= 2.2.2, < 4.0)
78
+ regexp_parser (>= 1.8)
76
79
  rexml
80
+ rubocop-ast (>= 0.6.0)
77
81
  ruby-progressbar (~> 1.7)
78
82
  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)
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)
82
89
  ruby2_keywords (0.0.5)
83
- 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)
84
98
  unicode-display_width (1.7.0)
85
99
  vcr (6.0.0)
86
100
  webmock (3.14.0)
@@ -89,20 +103,23 @@ GEM
89
103
  hashdiff (>= 0.4.0, < 2.0.0)
90
104
 
91
105
  PLATFORMS
92
- ruby
106
+ x86_64-darwin-19
107
+ x86_64-linux
93
108
 
94
109
  DEPENDENCIES
95
- bundler
96
- bundler-audit
97
- pry
98
- rake
99
- rspec
100
- rspec-its
101
- rubocop
102
- rubocop-rspec
103
- vcr
110
+ bundler (~> 2.2)
111
+ bundler-audit (~> 0.9)
112
+ pry (~> 0.14)
113
+ rake (~> 13.0)
114
+ rspec (~> 3.9)
115
+ rspec-its (~> 1.3)
116
+ rubocop (~> 0.82)
117
+ rubocop-rspec (~> 1.38)
118
+ simplecov (~> 0.21)
119
+ simplecov-badge (~> 2.0)
120
+ vcr (~> 6.0)
104
121
  veryfi!
105
- webmock
122
+ webmock (~> 3.14)
106
123
 
107
124
  BUNDLED WITH
108
- 1.17.2
125
+ 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
- - [Response](#response)
15
- - [Updating a document](#updating-a-document)
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
-
26
- ## Installation
27
-
28
- ```bash
29
- gem install veryfi
30
- ```
31
-
32
- Or add to your Gemfile:
33
- ```ruby
34
- gem 'veryfi'
35
- ```
36
-
37
- ## Getting Started
25
+ **veryfi-ruby** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
38
26
 
39
- ### Obtaining Client ID and user keys
27
+ ## Example
40
28
 
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'
@@ -57,15 +37,26 @@ veryfi_client = Veryfi::Client.new(
57
37
  username: 'your_username',
58
38
  api_key: 'your_password'
59
39
  )
60
-
61
- categories = ['Grocery', 'Utilities', 'Travel'];
62
- file_path = './test/receipt.png';
63
40
  ```
64
41
 
65
42
  This submits a document for processing (3-5 seconds for a response)
66
43
 
67
44
  ```ruby
68
- response = veryfi_client.process_document(file_path, categories)
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)
69
60
 
70
61
  puts response
71
62
  ```
@@ -73,12 +64,26 @@ puts response
73
64
  ...or with a URL
74
65
 
75
66
  ```ruby
76
- response = veryfi_client.process_document_url(url, external_id)
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)
77
82
 
78
83
  puts response
79
84
  ```
80
85
 
81
- ### Response
86
+ This will produce the following response:
82
87
 
83
88
  ```json
84
89
  {
@@ -215,25 +220,32 @@ puts response
215
220
  }
216
221
  ```
217
222
 
218
- ### Updating a document
223
+ ## Installation
219
224
 
225
+ ```bash
226
+ gem install veryfi
227
+ ```
228
+
229
+ Or add to your Gemfile:
220
230
  ```ruby
231
+ gem 'veryfi', '~> 0.1'
221
232
  ```
222
233
 
223
- ## Need help?
234
+ ## Getting Started
224
235
 
225
- If you run into any issue or need help installing or using the library, please contact support@veryfi.com.
236
+ ### Obtaining Client ID and user keys
226
237
 
227
- If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!
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/)
228
239
 
229
- ### [Learn more at our blog](https://www.veryfi.com/ruby/)
240
+ ### Ruby API Client Library
230
241
 
231
- ## Tutorial Video
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/)
232
243
 
233
- TBD
234
- <!-- [![Veryfi Tutorial]()]() -->
244
+ ## Need help?
235
245
 
236
- ---
246
+ If you run into any issue or need help installing or using the library, please contact support@veryfi.com.
247
+
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!
237
249
 
238
250
  # For Developers
239
251
 
@@ -250,4 +262,4 @@ bin/setup
250
262
 
251
263
  ## Develop
252
264
 
253
- `bin/build` checks your specs and runs quality tools
265
+ `bin/ci` checks your specs and runs quality tools
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