veryfi 1.0.1 → 2.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e76ca53e07b9d595cfb93471f80c3d50c30dbf825a70145455748da08360de06
4
- data.tar.gz: 32c8da0659268914dbd9f8cc409ee99108ce6f06020fd7cfc35ad4186db4f83e
3
+ metadata.gz: d280de38639eaaeb484040824fcf42c349c6b6390d864c5724fed22aec5a77c3
4
+ data.tar.gz: cb1d308624e3f46e1fbc68df6aa6d638b498d633ccd1040f3528b171b89b1b30
5
5
  SHA512:
6
- metadata.gz: 4d01d1effd328af56369a59d38b75189ce8e1627f3d20520e6f4306848dd33971745149c018708210702878aa48ffabaec156ebe1e170f154d6f5f6cde4c254d
7
- data.tar.gz: 1c4d1f124435ebdce031cfccf1f9fafaa415f07ec981f5aa1807ebee561d9d5f332bda90e29e696de21d3c98c02df116e38bec545ca66bf5c0dfd177ba7e46e3
6
+ metadata.gz: d893497e1423f04858a3c5195659fa8a9d49195877ae41b4c64eff05d9ea529ac9b5c9719953d1353d283e6a70194f06a967e072b50ff0738f8ed77b4db57d01
7
+ data.tar.gz: 88302d51b112d6ecfff260d9fd1508bf09c02478b0c267cd168f8fdd3f8a68d6b60c68dc5a2f6d901eaa9bf34ad1debfb309226f427cd296d22709edf59383a5
@@ -1,14 +1,15 @@
1
1
  name: Release
2
2
  on:
3
- release:
4
- types: [created]
3
+ workflow_dispatch:
4
+ branches:
5
+ - main
5
6
 
6
7
  jobs:
7
8
  publish:
8
9
  runs-on: ubuntu-latest
9
10
 
10
11
  steps:
11
- - uses: actions/checkout@v2
12
+ - uses: actions/checkout@v3
12
13
  - name: Set up Ruby
13
14
  uses: ruby/setup-ruby@v1
14
15
  with:
data/Gemfile.lock CHANGED
@@ -1,80 +1,76 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veryfi (1.0.1)
4
+ veryfi (2.0.0)
5
5
  base64 (~> 0.1)
6
- faraday (~> 1.7)
6
+ faraday (>= 1.7, < 3.0)
7
7
  openssl (>= 2.2, < 3.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.8.0)
13
- public_suffix (>= 2.0.2, < 5.0)
12
+ activesupport (6.1.7.8)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ addressable (2.8.6)
19
+ public_suffix (>= 2.0.2, < 6.0)
14
20
  ast (2.4.2)
15
- base64 (0.1.1)
21
+ base64 (0.2.0)
22
+ bigdecimal (3.1.8)
16
23
  bundler-audit (0.9.1)
17
24
  bundler (>= 1.2.0, < 3)
18
25
  thor (~> 1.0)
19
26
  coderay (1.1.3)
20
- crack (0.4.5)
27
+ concurrent-ruby (1.3.3)
28
+ crack (1.0.0)
29
+ bigdecimal
21
30
  rexml
22
- diff-lcs (1.5.0)
31
+ diff-lcs (1.5.1)
23
32
  docile (1.4.0)
24
- faraday (1.10.1)
25
- faraday-em_http (~> 1.0)
26
- faraday-em_synchrony (~> 1.0)
27
- faraday-excon (~> 1.1)
28
- faraday-httpclient (~> 1.0)
29
- faraday-multipart (~> 1.0)
30
- faraday-net_http (~> 1.0)
31
- faraday-net_http_persistent (~> 1.0)
32
- faraday-patron (~> 1.0)
33
- faraday-rack (~> 1.0)
34
- faraday-retry (~> 1.0)
33
+ faraday (2.8.1)
34
+ base64
35
+ faraday-net_http (>= 2.0, < 3.1)
35
36
  ruby2_keywords (>= 0.0.4)
36
- faraday-em_http (1.0.0)
37
- faraday-em_synchrony (1.0.0)
38
- faraday-excon (1.1.0)
39
- faraday-httpclient (1.0.1)
40
- faraday-multipart (1.0.4)
41
- multipart-post (~> 2)
42
- faraday-net_http (1.0.1)
43
- faraday-net_http_persistent (1.2.0)
44
- faraday-patron (1.0.0)
45
- faraday-rack (1.0.0)
46
- faraday-retry (1.0.3)
47
- hashdiff (1.0.1)
48
- method_source (1.0.0)
49
- multipart-post (2.2.3)
50
- openssl (3.0.0)
51
- parallel (1.22.1)
52
- parser (3.1.2.1)
37
+ faraday-net_http (3.0.2)
38
+ hashdiff (1.1.0)
39
+ i18n (1.14.5)
40
+ concurrent-ruby (~> 1.0)
41
+ method_source (1.1.0)
42
+ minitest (5.23.1)
43
+ openssl (3.0.2)
44
+ parallel (1.24.0)
45
+ parser (3.3.2.0)
53
46
  ast (~> 2.4.1)
54
- pry (0.14.1)
47
+ racc
48
+ pry (0.14.2)
55
49
  coderay (~> 1.1)
56
50
  method_source (~> 1.0)
57
- public_suffix (4.0.7)
51
+ public_suffix (5.0.5)
52
+ racc (1.8.0)
58
53
  rainbow (3.1.1)
59
- rake (13.0.6)
60
- regexp_parser (2.5.0)
61
- rexml (3.2.5)
62
- rspec (3.11.0)
63
- rspec-core (~> 3.11.0)
64
- rspec-expectations (~> 3.11.0)
65
- rspec-mocks (~> 3.11.0)
66
- rspec-core (3.11.0)
67
- rspec-support (~> 3.11.0)
68
- rspec-expectations (3.11.0)
54
+ rake (13.2.1)
55
+ regexp_parser (2.9.2)
56
+ rexml (3.2.9)
57
+ strscan
58
+ rspec (3.13.0)
59
+ rspec-core (~> 3.13.0)
60
+ rspec-expectations (~> 3.13.0)
61
+ rspec-mocks (~> 3.13.0)
62
+ rspec-core (3.13.0)
63
+ rspec-support (~> 3.13.0)
64
+ rspec-expectations (3.13.0)
69
65
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.11.0)
66
+ rspec-support (~> 3.13.0)
71
67
  rspec-its (1.3.0)
72
68
  rspec-core (>= 3.0.0)
73
69
  rspec-expectations (>= 3.0.0)
74
- rspec-mocks (3.11.1)
70
+ rspec-mocks (3.13.1)
75
71
  diff-lcs (>= 1.2.0, < 2.0)
76
- rspec-support (~> 3.11.0)
77
- rspec-support (3.11.0)
72
+ rspec-support (~> 3.13.0)
73
+ rspec-support (3.13.1)
78
74
  rubocop (0.93.1)
79
75
  parallel (~> 1.10)
80
76
  parser (>= 2.7.1.5)
@@ -84,38 +80,45 @@ GEM
84
80
  rubocop-ast (>= 0.6.0)
85
81
  ruby-progressbar (~> 1.7)
86
82
  unicode-display_width (>= 1.4.0, < 2.0)
87
- rubocop-ast (1.21.0)
88
- parser (>= 3.1.1.0)
83
+ rubocop-ast (1.30.0)
84
+ parser (>= 3.2.1.0)
89
85
  rubocop-rspec (1.44.1)
90
86
  rubocop (~> 0.87)
91
87
  rubocop-ast (>= 0.7.1)
92
- ruby-progressbar (1.11.0)
88
+ ruby-progressbar (1.13.0)
93
89
  ruby2_keywords (0.0.5)
94
- simplecov (0.21.2)
90
+ simplecov (0.22.0)
95
91
  docile (~> 1.1)
96
92
  simplecov-html (~> 0.11)
97
93
  simplecov_json_formatter (~> 0.1)
98
94
  simplecov-badge (2.0.2)
99
95
  simplecov-html (0.12.3)
100
96
  simplecov_json_formatter (0.1.4)
101
- thor (1.2.1)
97
+ strscan (3.1.0)
98
+ thor (1.3.1)
99
+ tzinfo (2.0.6)
100
+ concurrent-ruby (~> 1.0)
102
101
  unicode-display_width (1.8.0)
103
102
  vcr (6.1.0)
104
- webmock (3.17.1)
103
+ webmock (3.23.1)
105
104
  addressable (>= 2.8.0)
106
105
  crack (>= 0.3.2)
107
106
  hashdiff (>= 0.4.0, < 2.0.0)
107
+ zeitwerk (2.6.15)
108
108
 
109
109
  PLATFORMS
110
+ arm64-darwin-23
110
111
  ruby
111
112
  x86_64-darwin-19
112
113
  x86_64-linux
113
114
 
114
115
  DEPENDENCIES
116
+ activesupport (~> 6.0)
115
117
  bundler (~> 2.2)
116
118
  bundler-audit (~> 0.9)
117
119
  pry (~> 0.14)
118
120
  rake (~> 13.0)
121
+ rexml (~> 3.2.7)
119
122
  rspec (~> 3.9)
120
123
  rspec-its (~> 1.3)
121
124
  rubocop (~> 0.82)
@@ -127,4 +130,4 @@ DEPENDENCIES
127
130
  webmock (~> 3.14)
128
131
 
129
132
  BUNDLED WITH
130
- 2.2.33
133
+ 2.2.26
data/README.md CHANGED
@@ -1,15 +1,19 @@
1
1
  # Veryfi SDK for Ruby
2
2
 
3
- ![Veryfi Logo](https://cdn.veryfi.com/logos/veryfi-logo-wide-github.png)
3
+ <img src="https://user-images.githubusercontent.com/30125790/212157461-58bdc714-2f89-44c2-8e4d-d42bee74854e.png#gh-dark-mode-only" width="200">
4
+ <img src="https://user-images.githubusercontent.com/30125790/212157486-bfd08c5d-9337-4b78-be6f-230dc63838ba.png#gh-light-mode-only" width="200">
4
5
 
5
6
  [![Version](https://img.shields.io/gem/v/veryfi)](https://rubygems.org/gems/veryfi)
6
7
  [![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
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
+ **veryfi-ruby** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
11
+
12
+ [Documentation](https://veryfi.github.io/veryfi-ruby/)
13
+
10
14
  ## Table of Contents
11
15
 
12
- - [Veryfi SDK for Ruby](#veryfi-sdk-for-ruby)
16
+ - [Top](#veryfi-sdk-for-ruby)
13
17
  - [Table of Contents](#table-of-contents)
14
18
  - [Example](#example)
15
19
  - [Installation](#installation)
@@ -22,7 +26,6 @@
22
26
  - [Quality tools](#quality-tools)
23
27
  - [Develop](#develop)
24
28
 
25
- **veryfi-ruby** is a Ruby gem for communicating with the [Veryfi OCR API](https://veryfi.com/api/)
26
29
 
27
30
  ## Example
28
31
 
@@ -267,7 +270,7 @@ bin/setup
267
270
  ## Release
268
271
 
269
272
  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
273
+ 2. Run `bundle` - this should update `Gemfile.lock`
274
+ 3. Commit changes, push to a new Github branch, and merge
275
+ 4. On Github go to `Actions` -> `Release` -> and click `Run workflow` to trigger a new release
276
+ 5. Release workflow will publish gem to [Rubygems](https://rubygems.org/gems/veryfi)
Binary file
data/lib/veryfi/error.rb CHANGED
@@ -1,63 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
4
+
3
5
  module Veryfi
4
6
  class Error
5
7
  def self.from_response(status, response)
6
8
  if response.empty?
7
9
  VeryfiError.new(format("%<code>d", code: status))
8
10
  else
9
- get_error(status, response)
10
- end
11
- end
12
-
13
- def self.get_error(status, response)
14
- case status
15
- when 400 then BadRequest
16
- when 401 then UnauthorizedAccessToken
17
- when 404 then ResourceNotFound
18
- when 405 then UnexpectedHTTPMethod
19
- when 409 then AccessLimitReached
20
- when 500 then InternalError
21
- else VeryfiError.new(format("%<code>d, %<message>s", code: status, message: response["error"]))
22
- end
23
- end
24
- class BadRequest < StandardError
25
- def to_s
26
- "400, Bad Request"
27
- end
28
- end
29
-
30
- class UnauthorizedAccessToken < StandardError
31
- def to_s
32
- "401, Unauthorized Access Token"
33
- end
34
- end
35
-
36
- class ResourceNotFound < StandardError
37
- def to_s
38
- "404, Resource not found"
11
+ VeryfiError.new(format("%<code>d, %<message>s", code: status, message: response["error"]), response)
39
12
  end
40
13
  end
41
14
 
42
- class UnexpectedHTTPMethod < StandardError
43
- def to_s
44
- "405, Unexpected HTTP Method"
45
- end
46
- end
15
+ class VeryfiError < StandardError
16
+ attr_reader :message
47
17
 
48
- class AccessLimitReached < StandardError
49
- def to_s
50
- "409, Access Limit Reached"
18
+ def initialize(message = "An error occurred", response = {})
19
+ @message = if response.empty?
20
+ message
21
+ else
22
+ JSON.pretty_generate(response)
23
+ end
24
+ super(message)
51
25
  end
52
- end
53
26
 
54
- class InternalError < StandardError
55
27
  def to_s
56
- "500, Internal Server Error"
28
+ message
57
29
  end
58
30
  end
59
-
60
- class VeryfiError < StandardError
61
- end
62
31
  end
63
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Veryfi
4
- VERSION = "1.0.1"
4
+ VERSION = "2.0.0"
5
5
  end
data/veryfi.gemspec CHANGED
@@ -14,9 +14,52 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.homepage = "https://rubygems.org/gems/veryfi"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
- f.match(%r{^(test|spec|features)/})
19
- end
17
+ # Affected by git permissions issue
18
+ # spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ # f.match(%r{^(test|spec|features)/})
20
+ # end
21
+
22
+ spec.files = [
23
+ ".github/workflows/release.yml",
24
+ ".github/workflows/test.yml",
25
+ ".gitignore",
26
+ ".rspec",
27
+ ".rubocop.yml",
28
+ ".ruby-version",
29
+ ".semaphore/semaphore.yml",
30
+ "Gemfile",
31
+ "Gemfile.lock",
32
+ "README.md",
33
+ "bin/autospec",
34
+ "bin/bundle-audit",
35
+ "bin/ci",
36
+ "bin/console",
37
+ "bin/quality",
38
+ "bin/release",
39
+ "bin/rspec",
40
+ "bin/rubocop",
41
+ "bin/setup",
42
+ "coverage/coverage-badge.png",
43
+ "docs/.gitignore",
44
+ "docs/404.html",
45
+ "docs/_config.yml",
46
+ "docs/_includes/footer.html",
47
+ "docs/_includes/header.html",
48
+ "docs/index.markdown",
49
+ "lib/.keep",
50
+ "lib/veryfi.rb",
51
+ "lib/veryfi/api/document.rb",
52
+ "lib/veryfi/api/document_tag.rb",
53
+ "lib/veryfi/api/line_item.rb",
54
+ "lib/veryfi/api/tag.rb",
55
+ "lib/veryfi/client.rb",
56
+ "lib/veryfi/error.rb",
57
+ "lib/veryfi/request.rb",
58
+ "lib/veryfi/signature.rb",
59
+ "lib/veryfi/version.rb",
60
+ "veryfi.gemspec"
61
+ ]
62
+
20
63
  spec.bindir = "exe"
21
64
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
65
  spec.require_paths = ["lib"]
@@ -25,7 +68,7 @@ Gem::Specification.new do |spec|
25
68
  spec.add_dependency "base64", "~> 0.1"
26
69
  spec.add_dependency "openssl", ">= 2.2", "< 3.1"
27
70
 
28
- spec.add_dependency "faraday", "~> 1.7"
71
+ spec.add_dependency "faraday", ">= 1.7", "< 3.0"
29
72
 
30
73
  spec.add_development_dependency "bundler", "~> 2.2"
31
74
  spec.add_development_dependency "bundler-audit", "~> 0.9"
@@ -39,4 +82,6 @@ Gem::Specification.new do |spec|
39
82
  spec.add_development_dependency "simplecov-badge", "~> 2.0"
40
83
  spec.add_development_dependency "vcr", "~> 6.0"
41
84
  spec.add_development_dependency "webmock", "~> 3.14"
85
+ spec.add_development_dependency "rexml", "~> 3.2.7"
86
+ spec.add_development_dependency "activesupport", "~> 6.0"
42
87
  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: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Veryfi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-18 00:00:00.000000000 Z
11
+ date: 2024-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -48,16 +48,22 @@ dependencies:
48
48
  name: faraday
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '1.7'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '3.0'
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
- - - "~>"
61
+ - - ">="
59
62
  - !ruby/object:Gem::Version
60
63
  version: '1.7'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '3.0'
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: bundler
63
69
  requirement: !ruby/object:Gem::Requirement
@@ -226,6 +232,34 @@ dependencies:
226
232
  - - "~>"
227
233
  - !ruby/object:Gem::Version
228
234
  version: '3.14'
235
+ - !ruby/object:Gem::Dependency
236
+ name: rexml
237
+ requirement: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - "~>"
240
+ - !ruby/object:Gem::Version
241
+ version: 3.2.7
242
+ type: :development
243
+ prerelease: false
244
+ version_requirements: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - "~>"
247
+ - !ruby/object:Gem::Version
248
+ version: 3.2.7
249
+ - !ruby/object:Gem::Dependency
250
+ name: activesupport
251
+ requirement: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - "~>"
254
+ - !ruby/object:Gem::Version
255
+ version: '6.0'
256
+ type: :development
257
+ prerelease: false
258
+ version_requirements: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - "~>"
261
+ - !ruby/object:Gem::Version
262
+ version: '6.0'
229
263
  description:
230
264
  email:
231
265
  - support@veryfi.com