onfido 0.0.4 → 0.1.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 +4 -4
- data/.gitignore +15 -158
- data/.rspec +0 -1
- data/.rubocop.yml +43 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +0 -6
- data/README.md +9 -16
- data/Rakefile +0 -1
- data/lib/onfido.rb +1 -1
- data/lib/onfido/address.rb +1 -1
- data/lib/onfido/applicant.rb +4 -1
- data/lib/onfido/check.rb +4 -3
- data/lib/onfido/configuration.rb +1 -2
- data/lib/onfido/errors/connection_error.rb +1 -1
- data/lib/onfido/errors/onfido_error.rb +28 -0
- data/lib/onfido/errors/request_error.rb +1 -28
- data/lib/onfido/resource.rb +15 -18
- data/lib/onfido/version.rb +1 -1
- data/onfido.gemspec +8 -4
- data/spec/integrations/applicant_spec.rb +19 -18
- data/spec/integrations/check_spec.rb +1 -6
- data/spec/integrations/document_spec.rb +6 -5
- data/spec/integrations/exceptions_spec.rb +13 -55
- data/spec/integrations/report_spec.rb +1 -1
- data/spec/onfido/connection_error_spec.rb +18 -0
- data/spec/onfido/request_error_spec.rb +16 -21
- data/spec/onfido/resource_spec.rb +8 -10
- data/spec/onfido_spec.rb +23 -23
- data/spec/spec_helper.rb +3 -1
- data/spec/support/fake_onfido_api.rb +2 -2
- data/spec/support/fixtures/document.json +1 -1
- metadata +65 -4
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f348aa18fa199997614263dda1be6a615a48191
|
|
4
|
+
data.tar.gz: 8e8d3b9cefb576187b9c49666492958f8793a533
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 69bda930664b166633e1454a7a48828d59a90c66ac9fc38b66bcbd0e4bfa52628660114e192cfa9b056986418fa05d191977617dc37718c7b3eb2adb8e0f84ec
|
|
7
|
+
data.tar.gz: 8623820a91b599ef02c7508e311275e8cd71163e2c72770811c77cb79e5aa1ae4a838cd3c900a9fcd31e6990bce58835f639d2b7a8e9f4d310b52a88d1d3d9cd
|
data/.gitignore
CHANGED
|
@@ -1,161 +1,18 @@
|
|
|
1
|
-
# Created by https://www.gitignore.io
|
|
2
|
-
|
|
3
|
-
### Emacs ###
|
|
4
|
-
# -*- mode: gitignore; -*-
|
|
5
|
-
*~
|
|
6
|
-
\#*\#
|
|
7
|
-
/.emacs.desktop
|
|
8
|
-
/.emacs.desktop.lock
|
|
9
|
-
*.elc
|
|
10
|
-
auto-save-list
|
|
11
|
-
tramp
|
|
12
|
-
.\#*
|
|
13
|
-
|
|
14
|
-
# Org-mode
|
|
15
|
-
.org-id-locations
|
|
16
|
-
*_archive
|
|
17
|
-
|
|
18
|
-
# flymake-mode
|
|
19
|
-
*_flymake.*
|
|
20
|
-
|
|
21
|
-
# eshell files
|
|
22
|
-
/eshell/history
|
|
23
|
-
/eshell/lastdir
|
|
24
|
-
|
|
25
|
-
# elpa packages
|
|
26
|
-
/elpa/
|
|
27
|
-
|
|
28
|
-
# reftex files
|
|
29
|
-
*.rel
|
|
30
|
-
|
|
31
|
-
# AUCTeX auto folder
|
|
32
|
-
/auto/
|
|
33
|
-
|
|
34
|
-
# cask packages
|
|
35
|
-
.cask/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### OSX ###
|
|
39
|
-
.DS_Store
|
|
40
|
-
.AppleDouble
|
|
41
|
-
.LSOverride
|
|
42
|
-
|
|
43
|
-
# Icon must end with two \r
|
|
44
|
-
Icon
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
# Thumbnails
|
|
48
|
-
._*
|
|
49
|
-
|
|
50
|
-
# Files that might appear in the root of a volume
|
|
51
|
-
.DocumentRevisions-V100
|
|
52
|
-
.fseventsd
|
|
53
|
-
.Spotlight-V100
|
|
54
|
-
.TemporaryItems
|
|
55
|
-
.Trashes
|
|
56
|
-
.VolumeIcon.icns
|
|
57
|
-
|
|
58
|
-
# Directories potentially created on remote AFP share
|
|
59
|
-
.AppleDB
|
|
60
|
-
.AppleDesktop
|
|
61
|
-
Network Trash Folder
|
|
62
|
-
Temporary Items
|
|
63
|
-
.apdisk
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Linux ###
|
|
67
|
-
*~
|
|
68
|
-
|
|
69
|
-
# KDE directory preferences
|
|
70
|
-
.directory
|
|
71
|
-
|
|
72
|
-
# Linux trash folder which might appear on any partition or disk
|
|
73
|
-
.Trash-*
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### RubyMine ###
|
|
77
|
-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
|
|
78
|
-
|
|
79
|
-
*.iml
|
|
80
|
-
|
|
81
|
-
## Directory-based project format:
|
|
82
|
-
.idea/
|
|
83
|
-
# if you remove the above rule, at least ignore the following:
|
|
84
|
-
|
|
85
|
-
# User-specific stuff:
|
|
86
|
-
# .idea/workspace.xml
|
|
87
|
-
# .idea/tasks.xml
|
|
88
|
-
# .idea/dictionaries
|
|
89
|
-
|
|
90
|
-
# Sensitive or high-churn files:
|
|
91
|
-
# .idea/dataSources.ids
|
|
92
|
-
# .idea/dataSources.xml
|
|
93
|
-
# .idea/sqlDataSources.xml
|
|
94
|
-
# .idea/dynamic.xml
|
|
95
|
-
# .idea/uiDesigner.xml
|
|
96
|
-
|
|
97
|
-
# Gradle:
|
|
98
|
-
# .idea/gradle.xml
|
|
99
|
-
# .idea/libraries
|
|
100
|
-
|
|
101
|
-
# Mongo Explorer plugin:
|
|
102
|
-
# .idea/mongoSettings.xml
|
|
103
|
-
|
|
104
|
-
## File-based project format:
|
|
105
|
-
*.ipr
|
|
106
|
-
*.iws
|
|
107
|
-
|
|
108
|
-
## Plugin-specific files:
|
|
109
|
-
|
|
110
|
-
# IntelliJ
|
|
111
|
-
/out/
|
|
112
|
-
|
|
113
|
-
# mpeltonen/sbt-idea plugin
|
|
114
|
-
.idea_modules/
|
|
115
|
-
|
|
116
|
-
# JIRA plugin
|
|
117
|
-
atlassian-ide-plugin.xml
|
|
118
|
-
|
|
119
|
-
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
120
|
-
com_crashlytics_export_strings.xml
|
|
121
|
-
crashlytics.properties
|
|
122
|
-
crashlytics-build.properties
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### Ruby ###
|
|
126
1
|
*.gem
|
|
127
2
|
*.rbc
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/spec/reports/
|
|
133
|
-
/test/tmp/
|
|
134
|
-
/test/version_tmp/
|
|
135
|
-
/tmp/
|
|
136
|
-
|
|
137
|
-
## Specific to RubyMotion:
|
|
138
|
-
.dat*
|
|
139
|
-
.repl_history
|
|
140
|
-
build/
|
|
141
|
-
|
|
142
|
-
## Documentation cache and generated files:
|
|
143
|
-
/.yardoc/
|
|
144
|
-
/_yardoc/
|
|
145
|
-
/doc/
|
|
146
|
-
/rdoc/
|
|
147
|
-
|
|
148
|
-
## Environment normalisation:
|
|
149
|
-
/.bundle/
|
|
150
|
-
/vendor/bundle
|
|
151
|
-
/lib/bundler/man/
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.rspec
|
|
6
|
+
.yardoc
|
|
152
7
|
Gemfile.lock
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
8
|
+
InstalledFiles
|
|
9
|
+
_yardoc
|
|
10
|
+
coverage
|
|
11
|
+
doc/
|
|
12
|
+
lib/bundler/man
|
|
13
|
+
pkg
|
|
14
|
+
rdoc
|
|
15
|
+
spec/reports
|
|
16
|
+
test/tmp
|
|
17
|
+
test/version_tmp
|
|
18
|
+
tmp
|
data/.rspec
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# For all options see https://github.com/bbatsov/rubocop/tree/master/config
|
|
2
|
+
|
|
3
|
+
AllCops:
|
|
4
|
+
Include:
|
|
5
|
+
- Rakefile
|
|
6
|
+
- lib/tasks/*.rake
|
|
7
|
+
Exclude:
|
|
8
|
+
- vendor/**/*
|
|
9
|
+
- .*/**
|
|
10
|
+
- spec/fixtures/**/*
|
|
11
|
+
|
|
12
|
+
Style/StringLiterals:
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
Style/Documentation:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
Style/SignalException:
|
|
19
|
+
EnforcedStyle: only_raise
|
|
20
|
+
|
|
21
|
+
Metrics/MethodLength:
|
|
22
|
+
CountComments: false
|
|
23
|
+
Max: 25
|
|
24
|
+
|
|
25
|
+
Metrics/AbcSize:
|
|
26
|
+
Max: 25
|
|
27
|
+
|
|
28
|
+
# Don't require utf-8 encoding comment
|
|
29
|
+
Style/Encoding:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
Metrics/LineLength:
|
|
33
|
+
Max: 80
|
|
34
|
+
|
|
35
|
+
Metrics/ClassLength:
|
|
36
|
+
Enabled: false
|
|
37
|
+
|
|
38
|
+
Style/DotPosition:
|
|
39
|
+
EnforcedStyle: trailing
|
|
40
|
+
|
|
41
|
+
# Allow class and message or instance raises
|
|
42
|
+
Style/RaiseArgs:
|
|
43
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## v0.1.0 11 November 2015
|
|
2
|
+
|
|
3
|
+
- BREAKING: remove `throws_exceptions` option. We now always throw exceptions
|
|
4
|
+
for errors. This option had become confusing since `Onfido::ConnectionError`
|
|
5
|
+
was added in v0.0.4, since timeout errors were raised regardless of its value.
|
|
6
|
+
- Add base errors class (`Onfido::OnfidoError`)
|
|
7
|
+
- Add rubocop, and fix style inconsistencies
|
|
8
|
+
|
|
1
9
|
## v0.0.4 10 November 2015
|
|
2
10
|
|
|
3
11
|
- Split out connection errors so they can be automatically retried
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A wrapper for Onfido's [API](https://onfido.com/documentation#introduction). You should always refer to the documentation for valid API calls.
|
|
4
4
|
|
|
5
|
-
[](https://snap-ci.com/hvssle/onfido/branch/master)
|
|
6
5
|
[](http://badge.fury.io/rb/onfido)
|
|
7
6
|
[](https://travis-ci.org/hvssle/onfido)
|
|
8
|
-
[!['gitter room'][2]][1]
|
|
9
7
|
|
|
10
8
|
|
|
11
9
|
[1]: https://gitter.im/hvssle/onfido
|
|
@@ -30,13 +28,12 @@ Or install it yourself as:
|
|
|
30
28
|
|
|
31
29
|
## Usage
|
|
32
30
|
|
|
33
|
-
There are
|
|
31
|
+
There are 4 configuration options for Onfido, including your `api_key`, timeout details and logging.
|
|
34
32
|
|
|
35
33
|
```ruby
|
|
36
34
|
Onfido.configure do |config|
|
|
37
35
|
config.api_key = 'MY_API_KEY'
|
|
38
36
|
config.logger = Logger.new(STDOUT)
|
|
39
|
-
config.throws_exceptions = false
|
|
40
37
|
config.open_timeout = 30
|
|
41
38
|
config.read_timeout = 80
|
|
42
39
|
end
|
|
@@ -52,7 +49,7 @@ Assuming you have a valid key, you can conveniently make API calls by using an i
|
|
|
52
49
|
|
|
53
50
|
All resources share the same interface when making API calls. For creating a resource you can use `.create`, for finding one `.find` and for fetching all records for a resource `.all`.
|
|
54
51
|
|
|
55
|
-
**Note:** *All param keys should be a symbol e.g. `{type: 'express', reports: [{name: 'identity'}]}`*
|
|
52
|
+
**Note:** *All param keys should be a symbol e.g. `{ type: 'express', reports: [{ name: 'identity' }] }`*
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
### Applicant
|
|
@@ -80,7 +77,7 @@ To get all applicants
|
|
|
80
77
|
To upload a document for an applicant, you can simply use
|
|
81
78
|
|
|
82
79
|
```ruby
|
|
83
|
-
api.document.create('applicant_id',
|
|
80
|
+
api.document.create('applicant_id', file: 'http://example.com', type: 'passport')
|
|
84
81
|
```
|
|
85
82
|
|
|
86
83
|
The file can both be a `File` object or a link to an image.
|
|
@@ -90,7 +87,7 @@ The file can both be a `File` object or a link to an image.
|
|
|
90
87
|
To create a check for an applicant, you can simply use
|
|
91
88
|
|
|
92
89
|
```ruby
|
|
93
|
-
api.check.create('applicant_id',
|
|
90
|
+
api.check.create('applicant_id', type: 'express', reports: [{ name: 'identity' }])
|
|
94
91
|
```
|
|
95
92
|
|
|
96
93
|
To find an existing check for an applicant
|
|
@@ -147,23 +144,19 @@ api.check.all('applicant_id', page: 2, per_page: 10)
|
|
|
147
144
|
|
|
148
145
|
## Error Handling
|
|
149
146
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
If you set the `throws_exceptions` to false, it will simply return the response body. This allows you to handle errors manually.
|
|
153
|
-
|
|
154
|
-
If you rescue `Onfido::RequestError`, you are provided with the error message itself as well as the type of error, response code and fields that have errored. Here's how you might do that:
|
|
147
|
+
If you rescue `Onfido::RequestError`, you are provided with the response code, response body and parsed JSON body, the type of error the the fields that have errored.
|
|
155
148
|
|
|
156
149
|
```ruby
|
|
157
150
|
def create_applicant
|
|
158
151
|
api.applicant.create(params)
|
|
159
152
|
rescue Onfido::RequestError => e
|
|
160
|
-
e.type
|
|
161
|
-
e.fields
|
|
162
|
-
e.response_code #
|
|
153
|
+
e.type # => 'validation_error'
|
|
154
|
+
e.fields # => { "email": { "messages": ["invalid format"] } }
|
|
155
|
+
e.response_code # => '422'
|
|
163
156
|
end
|
|
164
157
|
```
|
|
165
158
|
|
|
166
|
-
You can also rescue `Onfido::ConnectionError`, which is raised
|
|
159
|
+
You can also rescue `Onfido::ConnectionError`, which is raised when something goes wrong with the connection to Onfido. This is useful for adding automatic retries to your background jobs.
|
|
167
160
|
|
|
168
161
|
### Roadmap
|
|
169
162
|
|
data/Rakefile
CHANGED
data/lib/onfido.rb
CHANGED
|
@@ -5,6 +5,7 @@ require 'open-uri'
|
|
|
5
5
|
|
|
6
6
|
require 'onfido/version'
|
|
7
7
|
require 'onfido/configuration'
|
|
8
|
+
require 'onfido/errors/onfido_error'
|
|
8
9
|
require 'onfido/errors/request_error'
|
|
9
10
|
require 'onfido/errors/connection_error'
|
|
10
11
|
require 'onfido/null_logger'
|
|
@@ -16,7 +17,6 @@ require 'onfido/check'
|
|
|
16
17
|
require 'onfido/report'
|
|
17
18
|
require 'onfido/api'
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
module Onfido
|
|
21
21
|
extend Configuration
|
|
22
22
|
end
|
data/lib/onfido/address.rb
CHANGED
data/lib/onfido/applicant.rb
CHANGED
|
@@ -12,7 +12,10 @@ module Onfido
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def all(page: 1, per_page: 20)
|
|
15
|
-
get(
|
|
15
|
+
get(
|
|
16
|
+
url: url_for("applicants?page=#{page}&per_page=#{per_page}"),
|
|
17
|
+
payload: {}
|
|
18
|
+
)
|
|
16
19
|
end
|
|
17
20
|
end
|
|
18
21
|
end
|
data/lib/onfido/check.rb
CHANGED
|
@@ -2,8 +2,8 @@ module Onfido
|
|
|
2
2
|
class Check < Resource
|
|
3
3
|
def create(applicant_id, payload)
|
|
4
4
|
post(
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
url: url_for("applicants/#{applicant_id}/checks"),
|
|
6
|
+
payload: payload
|
|
7
7
|
)
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -15,8 +15,9 @@ module Onfido
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def all(applicant_id, page: 1, per_page: 20)
|
|
18
|
+
querystring = "page=#{page}&per_page=#{per_page}"
|
|
18
19
|
get(
|
|
19
|
-
url: url_for("applicants/#{applicant_id}/checks
|
|
20
|
+
url: url_for("applicants/#{applicant_id}/checks?#{querystring}"),
|
|
20
21
|
payload: {}
|
|
21
22
|
)
|
|
22
23
|
end
|
data/lib/onfido/configuration.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Onfido
|
|
2
2
|
module Configuration
|
|
3
|
-
attr_accessor :api_key, :
|
|
3
|
+
attr_accessor :api_key, :open_timeout, :read_timeout
|
|
4
4
|
|
|
5
5
|
def self.extended(base)
|
|
6
6
|
base.reset
|
|
@@ -12,7 +12,6 @@ module Onfido
|
|
|
12
12
|
|
|
13
13
|
def reset
|
|
14
14
|
self.api_key = nil
|
|
15
|
-
self.throws_exceptions = true
|
|
16
15
|
self.open_timeout = 30
|
|
17
16
|
self.read_timeout = 80
|
|
18
17
|
RestClient.log = nil
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Onfido
|
|
2
|
+
class OnfidoError < StandardError
|
|
3
|
+
attr_accessor :response_code, :response_body
|
|
4
|
+
|
|
5
|
+
def initialize(message = nil,
|
|
6
|
+
response_code: nil,
|
|
7
|
+
response_body: nil)
|
|
8
|
+
@response_code = response_code
|
|
9
|
+
@response_body = response_body
|
|
10
|
+
|
|
11
|
+
super(message)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def json_body
|
|
15
|
+
JSON.parse(response_body.to_s)
|
|
16
|
+
rescue JSON::ParserError
|
|
17
|
+
nil
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def type
|
|
21
|
+
json_body && json_body['error'] && json_body['error']['type']
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def fields
|
|
25
|
+
json_body && json_body['error'] && json_body['error']['fields']
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
The class will handle response failures coming from Onfido
|
|
3
|
-
It's main purpose is to produce meaningful error messages to the user e.g.
|
|
4
|
-
|
|
5
|
-
RequestError: Authorization error: please re-check your credentials
|
|
6
|
-
|
|
7
|
-
Users can also rescue the error and insect its type and affected fields as
|
|
8
|
-
specified in the Onfido documentation e.g.
|
|
9
|
-
|
|
10
|
-
begin
|
|
11
|
-
# error being raised
|
|
12
|
-
rescue Onfido::RequestError => e
|
|
13
|
-
e.type
|
|
14
|
-
e.fields
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
=end
|
|
18
|
-
|
|
19
1
|
module Onfido
|
|
20
|
-
class RequestError <
|
|
21
|
-
attr_accessor :type, :fields, :response_code
|
|
22
|
-
|
|
23
|
-
def initialize(message=nil, type: nil, fields: nil, response_code: nil)
|
|
24
|
-
@type = type
|
|
25
|
-
@fields = fields
|
|
26
|
-
@response_code = response_code
|
|
27
|
-
|
|
28
|
-
super(message)
|
|
29
|
-
end
|
|
2
|
+
class RequestError < OnfidoError
|
|
30
3
|
end
|
|
31
4
|
end
|
data/lib/onfido/resource.rb
CHANGED
|
@@ -46,7 +46,7 @@ module Onfido
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def parse(response)
|
|
49
|
-
JSON.parse(response.body)
|
|
49
|
+
JSON.parse(response.body.to_s)
|
|
50
50
|
rescue JSON::ParserError
|
|
51
51
|
general_api_error(response.code, response.body)
|
|
52
52
|
end
|
|
@@ -77,22 +77,19 @@ module Onfido
|
|
|
77
77
|
general_api_error(response.code, response.body)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
response_code: response.code)
|
|
86
|
-
else
|
|
87
|
-
parsed_response
|
|
88
|
-
end
|
|
80
|
+
raise RequestError.new(
|
|
81
|
+
parsed_response["error"]['message'],
|
|
82
|
+
response_code: response.code,
|
|
83
|
+
response_body: response.body
|
|
84
|
+
)
|
|
89
85
|
end
|
|
90
86
|
|
|
91
87
|
def general_api_error(response_code, response_body)
|
|
92
88
|
raise RequestError.new(
|
|
93
89
|
"Invalid response object from API: #{response_body} " \
|
|
94
90
|
"(HTTP response code was #{response_code})",
|
|
95
|
-
response_code: response_code
|
|
91
|
+
response_code: response_code,
|
|
92
|
+
response_body: response_body
|
|
96
93
|
)
|
|
97
94
|
end
|
|
98
95
|
|
|
@@ -111,15 +108,15 @@ module Onfido
|
|
|
111
108
|
"request completed. #{connection_message}"
|
|
112
109
|
|
|
113
110
|
when RestClient::SSLCertificateNotVerified
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
111
|
+
"Could not verify Onfido's SSL certificate. Please make sure " \
|
|
112
|
+
"that your network is not intercepting certificates. " \
|
|
113
|
+
"(Try going to #{Onfido.endpoint} in your browser.) " \
|
|
114
|
+
"If this problem persists, let us know at info@onfido.com."
|
|
118
115
|
|
|
119
116
|
when SocketError
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
"Unexpected error when trying to connect to Onfido. " \
|
|
118
|
+
"You may be seeing this message because your DNS is not working. " \
|
|
119
|
+
"To check, try running 'host onfido.com' from the command line."
|
|
123
120
|
|
|
124
121
|
else
|
|
125
122
|
"Unexpected error communicating with Onfido. " \
|
data/lib/onfido/version.rb
CHANGED
data/onfido.gemspec
CHANGED
|
@@ -6,10 +6,10 @@ require 'onfido/version'
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'onfido'
|
|
8
8
|
spec.version = Onfido::VERSION
|
|
9
|
-
spec.authors = ['Pericles Theodorou']
|
|
10
|
-
spec.email = ['periclestheo@gmail.com']
|
|
11
|
-
spec.summary = %q{A wrapper for Onfido API
|
|
12
|
-
spec.description = %q{A wrapper for Onfido API
|
|
9
|
+
spec.authors = ['Pericles Theodorou', 'Grey Baker']
|
|
10
|
+
spec.email = ['periclestheo@gmail.com', 'grey@gocardless.com']
|
|
11
|
+
spec.summary = %q{A wrapper for Onfido API}
|
|
12
|
+
spec.description = %q{A wrapper for Onfido API}
|
|
13
13
|
spec.homepage = 'http://github.com/hvssle/onfido'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
15
|
|
|
@@ -21,6 +21,10 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
23
23
|
spec.add_development_dependency 'webmock', '~> 1.22'
|
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 0.35.1'
|
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
|
26
|
+
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
|
27
|
+
spec.add_development_dependency 'sinatra', '~> 1.4'
|
|
24
28
|
|
|
25
29
|
spec.add_dependency 'rest-client', '~> 1.8.0'
|
|
26
30
|
end
|
|
@@ -13,24 +13,24 @@ describe Onfido::Applicant do
|
|
|
13
13
|
'email' => 'chandler_bing_6@friends.com',
|
|
14
14
|
'addresses' => [
|
|
15
15
|
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
'flat_number' => '4',
|
|
17
|
+
'building_number' => '100',
|
|
18
|
+
'building_name' => 'Awesome Building',
|
|
19
|
+
'street' => 'Main Street',
|
|
20
|
+
'sub_street' => 'A sub street',
|
|
21
|
+
'town' => 'London',
|
|
22
|
+
'postcode' => 'SW4 6EH',
|
|
23
|
+
'country' => 'GBR'
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
'flat_number' => '1',
|
|
27
|
+
'building_number' => '10',
|
|
28
|
+
'building_name' => 'Great Building',
|
|
29
|
+
'street' => 'Old Street',
|
|
30
|
+
'sub_street' => 'Sub Street',
|
|
31
|
+
'town' => 'London',
|
|
32
|
+
'postcode' => 'SW1 4NG',
|
|
33
|
+
'country' => 'GBR'
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
}
|
|
@@ -42,9 +42,10 @@ describe Onfido::Applicant do
|
|
|
42
42
|
# is only for semantic reasons
|
|
43
43
|
|
|
44
44
|
it 'serializes the payload correctly' do
|
|
45
|
-
WebMock.after_request do |request_signature,
|
|
45
|
+
WebMock.after_request do |request_signature, _response|
|
|
46
46
|
if request_signature.uri.path == 'v1/applicants'
|
|
47
|
-
expect(Rack::Utils.parse_nested_query(request_signature.body)).
|
|
47
|
+
expect(Rack::Utils.parse_nested_query(request_signature.body)).
|
|
48
|
+
to eq(params)
|
|
48
49
|
end
|
|
49
50
|
end
|
|
50
51
|
end
|
|
@@ -3,12 +3,7 @@ describe Onfido::Check do
|
|
|
3
3
|
let(:applicant_id) { '61f659cb-c90b-4067-808a-6136b5c01351' }
|
|
4
4
|
|
|
5
5
|
describe '#create' do
|
|
6
|
-
let(:params)
|
|
7
|
-
{
|
|
8
|
-
type: 'express',
|
|
9
|
-
reports: [{name: 'identity'}]
|
|
10
|
-
}
|
|
11
|
-
end
|
|
6
|
+
let(:params) { { type: 'express', reports: [{ name: 'identity' }] } }
|
|
12
7
|
|
|
13
8
|
it 'creates a new check for an applicant' do
|
|
14
9
|
response = check.create(applicant_id, params)
|
|
@@ -10,18 +10,19 @@ describe Onfido::Document do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
let(:file) { Tempfile.new(['passport', '.jpg']) }
|
|
13
|
+
before { allow(document).to receive(:open).and_return(:file) }
|
|
13
14
|
let(:params) do
|
|
14
15
|
{
|
|
15
16
|
type: 'passport',
|
|
16
17
|
side: 'back',
|
|
17
18
|
file: file
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
end
|
|
21
|
+
let(:applicant_id) { '1030303-123123-123123' }
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
end
|
|
23
|
+
it 'creates a new document' do
|
|
24
|
+
response = document.create('foobar', params)
|
|
25
|
+
expect(response['id']).not_to be_nil
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
28
|
end
|
|
@@ -4,74 +4,32 @@ describe Onfido::Resource do
|
|
|
4
4
|
let(:api_key) { 'some_key' }
|
|
5
5
|
let(:payload) { { postcode: 'SE1 4NG' } }
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
before do
|
|
9
|
-
allow(Onfido).to receive(:api_key).and_return(api_key)
|
|
10
|
-
end
|
|
7
|
+
before { allow(Onfido).to receive(:api_key).and_return(api_key) }
|
|
11
8
|
|
|
12
9
|
context '4xx response' do
|
|
13
10
|
let(:path) { '4xx_response' }
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
it 'raises a custom error' do
|
|
19
|
-
expect { resource.get({ url: url, payload: payload }) }.
|
|
20
|
-
to raise_error(Onfido::RequestError, 'Something went wrong')
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "when 'throws_exceptions' is false" do
|
|
25
|
-
before { allow(Onfido).to receive(:throws_exceptions).and_return(false) }
|
|
26
|
-
|
|
27
|
-
it 'returns the body as a hash' do
|
|
28
|
-
response = resource.get({ url: url, payload: payload })
|
|
29
|
-
expect(response['error']).not_to be_nil
|
|
30
|
-
end
|
|
12
|
+
it 'raises a custom error' do
|
|
13
|
+
expect { resource.get(url: url, payload: payload) }.
|
|
14
|
+
to raise_error(Onfido::RequestError, 'Something went wrong')
|
|
31
15
|
end
|
|
32
16
|
end
|
|
33
17
|
|
|
34
18
|
context 'unexpected error format' do
|
|
35
19
|
let(:path) { 'unexpected_error_format' }
|
|
36
20
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
it 'raises a custom error' do
|
|
41
|
-
expect { resource.get({ url: url, payload: payload }) }.
|
|
42
|
-
to raise_error(Onfido::RequestError, /response code was 400/)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
context "when 'throws_exceptions' is false" do
|
|
47
|
-
before { allow(Onfido).to receive(:throws_exceptions).and_return(false) }
|
|
48
|
-
|
|
49
|
-
it 'still raises a custom error' do
|
|
50
|
-
expect { resource.get({ url: url, payload: payload }) }.
|
|
51
|
-
to raise_error(Onfido::RequestError, /response code was 400/)
|
|
52
|
-
end
|
|
21
|
+
it 'raises a custom error' do
|
|
22
|
+
expect { resource.get(url: url, payload: payload) }.
|
|
23
|
+
to raise_error(Onfido::RequestError, /response code was 400/)
|
|
53
24
|
end
|
|
54
25
|
end
|
|
55
26
|
|
|
56
27
|
context 'unparseable JSON' do
|
|
57
28
|
let(:path) { 'unparseable_response' }
|
|
58
29
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
it 'raises a custom error' do
|
|
63
|
-
expect { resource.get({ url: url, payload: payload }) }.
|
|
64
|
-
to raise_error(Onfido::RequestError, /response code was 504/)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
context "when 'throws_exceptions' is false" do
|
|
69
|
-
before { allow(Onfido).to receive(:throws_exceptions).and_return(false) }
|
|
70
|
-
|
|
71
|
-
it 'still raises a custom error' do
|
|
72
|
-
expect { resource.get({ url: url, payload: payload }) }.
|
|
73
|
-
to raise_error(Onfido::RequestError, /response code was 504/)
|
|
74
|
-
end
|
|
30
|
+
it 'raises a custom error' do
|
|
31
|
+
expect { resource.get(url: url, payload: payload) }.
|
|
32
|
+
to raise_error(Onfido::RequestError, /response code was 504/)
|
|
75
33
|
end
|
|
76
34
|
end
|
|
77
35
|
|
|
@@ -83,7 +41,7 @@ describe Onfido::Resource do
|
|
|
83
41
|
end
|
|
84
42
|
|
|
85
43
|
it 'raises a ConnectionError' do
|
|
86
|
-
expect { resource.get(
|
|
44
|
+
expect { resource.get(url: Onfido.endpoint, payload: payload) }.
|
|
87
45
|
to raise_error(Onfido::ConnectionError, /Could not connect/)
|
|
88
46
|
end
|
|
89
47
|
end
|
|
@@ -96,7 +54,7 @@ describe Onfido::Resource do
|
|
|
96
54
|
end
|
|
97
55
|
|
|
98
56
|
it 'raises a ConnectionError' do
|
|
99
|
-
expect { resource.get(
|
|
57
|
+
expect { resource.get(url: Onfido.endpoint, payload: payload) }.
|
|
100
58
|
to raise_error(Onfido::ConnectionError, /connection to the server/)
|
|
101
59
|
end
|
|
102
60
|
end
|
|
@@ -109,7 +67,7 @@ describe Onfido::Resource do
|
|
|
109
67
|
end
|
|
110
68
|
|
|
111
69
|
it 'raises a ConnectionError' do
|
|
112
|
-
expect { resource.get(
|
|
70
|
+
expect { resource.get(url: Onfido.endpoint, payload: payload) }.
|
|
113
71
|
to raise_error(Onfido::ConnectionError, /SSL certificate/)
|
|
114
72
|
end
|
|
115
73
|
end
|
|
@@ -3,7 +3,7 @@ describe Onfido::Report do
|
|
|
3
3
|
let(:check_id) { '8546921-123123-123123' }
|
|
4
4
|
|
|
5
5
|
describe '#find' do
|
|
6
|
-
let(:report_id) {'6951786-123123-422221' }
|
|
6
|
+
let(:report_id) { '6951786-123123-422221' }
|
|
7
7
|
|
|
8
8
|
it 'returns a report for an existing check' do
|
|
9
9
|
response = report.find(check_id, report_id)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
describe Onfido::ConnectionError do
|
|
2
|
+
subject(:error) do
|
|
3
|
+
described_class.new(
|
|
4
|
+
"Invalid response object from API",
|
|
5
|
+
response_code: response_code,
|
|
6
|
+
response_body: response_body
|
|
7
|
+
)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
let(:response_code) { nil }
|
|
11
|
+
let(:response_body) { nil }
|
|
12
|
+
|
|
13
|
+
context "without a response_body" do
|
|
14
|
+
its(:json_body) { is_expected.to be_nil }
|
|
15
|
+
its(:type) { is_expected.to be_nil }
|
|
16
|
+
its(:fields) { is_expected.to be_nil }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
describe Onfido::RequestError do
|
|
2
2
|
subject(:error) do
|
|
3
|
-
described_class.new(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
described_class.new(
|
|
4
|
+
failed_response['error']['message'],
|
|
5
|
+
response_code: 401,
|
|
6
|
+
response_body: failed_response.to_json
|
|
7
|
+
)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
let(:failed_response) do
|
|
@@ -14,26 +14,21 @@ describe Onfido::RequestError do
|
|
|
14
14
|
'id' => '551722cc964860653c00c202',
|
|
15
15
|
'type' => 'authorization_error',
|
|
16
16
|
'message' => 'Authorization error: please re-check your credentials',
|
|
17
|
-
'fields' => {'name' => {'messages' => ['cannot be blank']} }
|
|
17
|
+
'fields' => { 'name' => { 'messages' => ['cannot be blank'] } }
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
it 'has the right error type' do
|
|
28
|
-
expect(error.type).to eq('authorization_error')
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'has the right affected fields' do
|
|
32
|
-
expect(error.fields).to eq({'name' => {'messages' => ['cannot be blank']} })
|
|
33
|
-
end
|
|
22
|
+
it 'returns the right message' do
|
|
23
|
+
expect { raise error }.
|
|
24
|
+
to raise_error('Authorization error: please re-check your credentials')
|
|
25
|
+
end
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
its(:type) { is_expected.to eq('authorization_error') }
|
|
28
|
+
its(:response_code) { is_expected.to eq(401) }
|
|
29
|
+
its(:response_body) { is_expected.to eq(failed_response.to_json) }
|
|
30
|
+
its(:json_body) { is_expected.to eq(failed_response) }
|
|
31
|
+
its(:fields) do
|
|
32
|
+
is_expected.to eq('name' => { 'messages' => ['cannot be blank'] })
|
|
38
33
|
end
|
|
39
34
|
end
|
|
@@ -4,10 +4,8 @@ describe Onfido::Resource do
|
|
|
4
4
|
let(:path) { 'addresses/pick' }
|
|
5
5
|
let(:api_key) { 'some_key' }
|
|
6
6
|
|
|
7
|
-
before
|
|
8
|
-
|
|
9
|
-
allow(Onfido).to receive(:api_key).and_return(api_key)
|
|
10
|
-
end
|
|
7
|
+
before { allow(Onfido).to receive(:endpoint).and_return(endpoint) }
|
|
8
|
+
before { allow(Onfido).to receive(:api_key).and_return(api_key) }
|
|
11
9
|
|
|
12
10
|
describe '#url_for' do
|
|
13
11
|
it 'composes the full api url' do
|
|
@@ -19,9 +17,9 @@ describe Onfido::Resource do
|
|
|
19
17
|
%i(put delete patch).each do |method|
|
|
20
18
|
context "for unsupported HTTP method: #{method}" do
|
|
21
19
|
it 'raises an error' do
|
|
22
|
-
expect
|
|
20
|
+
expect do
|
|
23
21
|
resource.public_send(method)
|
|
24
|
-
|
|
22
|
+
end.to raise_error(NoMethodError)
|
|
25
23
|
end
|
|
26
24
|
end
|
|
27
25
|
end
|
|
@@ -31,7 +29,7 @@ describe Onfido::Resource do
|
|
|
31
29
|
%i(get post).each do |method|
|
|
32
30
|
context "for supported HTTP method: #{method}" do
|
|
33
31
|
let(:url) { endpoint + path }
|
|
34
|
-
let(:payload) { {postcode: 'SE1 4NG'} }
|
|
32
|
+
let(:payload) { { postcode: 'SE1 4NG' } }
|
|
35
33
|
let(:response) do
|
|
36
34
|
{
|
|
37
35
|
'addresses' => [
|
|
@@ -46,8 +44,8 @@ describe Onfido::Resource do
|
|
|
46
44
|
end
|
|
47
45
|
|
|
48
46
|
before do
|
|
49
|
-
expect(RestClient::Request).to receive(:execute)
|
|
50
|
-
|
|
47
|
+
expect(RestClient::Request).to receive(:execute).
|
|
48
|
+
with(
|
|
51
49
|
url: url,
|
|
52
50
|
payload: Rack::Utils.build_query(payload),
|
|
53
51
|
method: method,
|
|
@@ -61,7 +59,7 @@ describe Onfido::Resource do
|
|
|
61
59
|
end
|
|
62
60
|
|
|
63
61
|
it 'makes a request to an endpoint' do
|
|
64
|
-
expect(resource.public_send(method,
|
|
62
|
+
expect(resource.public_send(method, url: url, payload: payload)).
|
|
65
63
|
to eq(response)
|
|
66
64
|
end
|
|
67
65
|
end
|
data/spec/onfido_spec.rb
CHANGED
|
@@ -2,34 +2,33 @@ describe Onfido do
|
|
|
2
2
|
subject(:onfido) { described_class }
|
|
3
3
|
|
|
4
4
|
context 'configuration' do
|
|
5
|
-
before
|
|
6
|
-
onfido.reset
|
|
7
|
-
end
|
|
5
|
+
before { onfido.reset }
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
describe "
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
end
|
|
7
|
+
describe "default values" do
|
|
8
|
+
describe ".api_key" do
|
|
9
|
+
subject { onfido.api_key }
|
|
10
|
+
it { is_expected.to be_nil }
|
|
14
11
|
end
|
|
15
|
-
end
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
it
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
describe ".endpoint" do
|
|
14
|
+
subject { onfido.endpoint }
|
|
15
|
+
it { is_expected.to eq('https://api.onfido.com/v1/') }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe ".logger" do
|
|
19
|
+
subject { onfido.logger }
|
|
20
|
+
it { is_expected.to be_an_instance_of(Onfido::NullLogger) }
|
|
23
21
|
end
|
|
24
22
|
end
|
|
25
23
|
|
|
26
|
-
describe
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
end
|
|
24
|
+
describe "setting an API key" do
|
|
25
|
+
it 'changes the configuration to the new value' do
|
|
26
|
+
onfido.api_key = 'some_key'
|
|
27
|
+
expect(onfido.api_key).to eq('some_key')
|
|
31
28
|
end
|
|
29
|
+
end
|
|
32
30
|
|
|
31
|
+
describe '.logger' do
|
|
33
32
|
context 'when an option is passed' do
|
|
34
33
|
context 'when the option passed behaves like a logger' do
|
|
35
34
|
let(:logger_like) { double('LoggerLike', :<< => nil) }
|
|
@@ -44,9 +43,10 @@ describe Onfido do
|
|
|
44
43
|
let(:non_logger) { double('NotLogger') }
|
|
45
44
|
|
|
46
45
|
it 'raises an error' do
|
|
47
|
-
expect {
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
expect { onfido.logger = non_logger }.
|
|
47
|
+
to raise_error(
|
|
48
|
+
"#{non_logger.class} doesn't seem to behave like a logger!"
|
|
49
|
+
)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
3
|
-
Dir[File.dirname(__FILE__).concat("/support/**/*.rb")].each {|f| require f}
|
|
3
|
+
Dir[File.dirname(__FILE__).concat("/support/**/*.rb")].each { |f| require f }
|
|
4
4
|
|
|
5
5
|
require 'onfido'
|
|
6
6
|
require 'webmock/rspec'
|
|
7
|
+
require 'rspec/its'
|
|
7
8
|
|
|
8
9
|
WebMock.disable_net_connect!(allow_localhost: true)
|
|
9
10
|
|
|
@@ -30,6 +31,7 @@ RSpec.configure do |config|
|
|
|
30
31
|
config.filter_run :focus
|
|
31
32
|
config.run_all_when_everything_filtered = true
|
|
32
33
|
config.disable_monkey_patching!
|
|
34
|
+
config.raise_errors_for_deprecations!
|
|
33
35
|
config.warnings = false
|
|
34
36
|
config.expose_dsl_globally = true
|
|
35
37
|
|
|
@@ -15,7 +15,7 @@ class FakeOnfidoAPI < Sinatra::Base
|
|
|
15
15
|
|
|
16
16
|
get '/v1/applicants' do
|
|
17
17
|
response = json_response(200, 'applicants.json')
|
|
18
|
-
{applicants: JSON.parse(response)['applicants'][pagination_range]}.to_json
|
|
18
|
+
{ applicants: JSON.parse(response)['applicants'][pagination_range] }.to_json
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
post '/v1/applicants/:id/documents' do
|
|
@@ -32,7 +32,7 @@ class FakeOnfidoAPI < Sinatra::Base
|
|
|
32
32
|
|
|
33
33
|
get '/v1/applicants/:id/checks' do
|
|
34
34
|
response = json_response(200, 'checks.json')
|
|
35
|
-
{checks: JSON.parse(response)['checks'][pagination_range]}.to_json
|
|
35
|
+
{ checks: JSON.parse(response)['checks'][pagination_range] }.to_json
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
get '/v1/checks/:id/reports' do
|
metadata
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: onfido
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pericles Theodorou
|
|
8
|
+
- Grey Baker
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
@@ -52,6 +53,62 @@ dependencies:
|
|
|
52
53
|
- - ~>
|
|
53
54
|
- !ruby/object:Gem::Version
|
|
54
55
|
version: '1.22'
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: rubocop
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ~>
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: 0.35.1
|
|
63
|
+
type: :development
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ~>
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: 0.35.1
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: rspec
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ~>
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '3.1'
|
|
77
|
+
type: :development
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ~>
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '3.1'
|
|
84
|
+
- !ruby/object:Gem::Dependency
|
|
85
|
+
name: rspec-its
|
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ~>
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '1.2'
|
|
91
|
+
type: :development
|
|
92
|
+
prerelease: false
|
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - ~>
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '1.2'
|
|
98
|
+
- !ruby/object:Gem::Dependency
|
|
99
|
+
name: sinatra
|
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ~>
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '1.4'
|
|
105
|
+
type: :development
|
|
106
|
+
prerelease: false
|
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ~>
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '1.4'
|
|
55
112
|
- !ruby/object:Gem::Dependency
|
|
56
113
|
name: rest-client
|
|
57
114
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,20 +123,21 @@ dependencies:
|
|
|
66
123
|
- - ~>
|
|
67
124
|
- !ruby/object:Gem::Version
|
|
68
125
|
version: 1.8.0
|
|
69
|
-
description: A wrapper for Onfido API
|
|
126
|
+
description: A wrapper for Onfido API
|
|
70
127
|
email:
|
|
71
128
|
- periclestheo@gmail.com
|
|
129
|
+
- grey@gocardless.com
|
|
72
130
|
executables: []
|
|
73
131
|
extensions: []
|
|
74
132
|
extra_rdoc_files: []
|
|
75
133
|
files:
|
|
76
134
|
- .gitignore
|
|
77
135
|
- .rspec
|
|
136
|
+
- .rubocop.yml
|
|
78
137
|
- .travis.yml
|
|
79
138
|
- CHANGELOG.md
|
|
80
139
|
- Gemfile
|
|
81
140
|
- LICENSE
|
|
82
|
-
- LICENSE.txt
|
|
83
141
|
- README.md
|
|
84
142
|
- Rakefile
|
|
85
143
|
- lib/onfido.rb
|
|
@@ -90,6 +148,7 @@ files:
|
|
|
90
148
|
- lib/onfido/configuration.rb
|
|
91
149
|
- lib/onfido/document.rb
|
|
92
150
|
- lib/onfido/errors/connection_error.rb
|
|
151
|
+
- lib/onfido/errors/onfido_error.rb
|
|
93
152
|
- lib/onfido/errors/request_error.rb
|
|
94
153
|
- lib/onfido/null_logger.rb
|
|
95
154
|
- lib/onfido/report.rb
|
|
@@ -102,6 +161,7 @@ files:
|
|
|
102
161
|
- spec/integrations/document_spec.rb
|
|
103
162
|
- spec/integrations/exceptions_spec.rb
|
|
104
163
|
- spec/integrations/report_spec.rb
|
|
164
|
+
- spec/onfido/connection_error_spec.rb
|
|
105
165
|
- spec/onfido/request_error_spec.rb
|
|
106
166
|
- spec/onfido/resource_spec.rb
|
|
107
167
|
- spec/onfido_spec.rb
|
|
@@ -140,7 +200,7 @@ rubyforge_project:
|
|
|
140
200
|
rubygems_version: 2.2.2
|
|
141
201
|
signing_key:
|
|
142
202
|
specification_version: 4
|
|
143
|
-
summary: A wrapper for Onfido API
|
|
203
|
+
summary: A wrapper for Onfido API
|
|
144
204
|
test_files:
|
|
145
205
|
- spec/integrations/address_spec.rb
|
|
146
206
|
- spec/integrations/applicant_spec.rb
|
|
@@ -148,6 +208,7 @@ test_files:
|
|
|
148
208
|
- spec/integrations/document_spec.rb
|
|
149
209
|
- spec/integrations/exceptions_spec.rb
|
|
150
210
|
- spec/integrations/report_spec.rb
|
|
211
|
+
- spec/onfido/connection_error_spec.rb
|
|
151
212
|
- spec/onfido/request_error_spec.rb
|
|
152
213
|
- spec/onfido/resource_spec.rb
|
|
153
214
|
- spec/onfido_spec.rb
|
data/LICENSE.txt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2015 Pericles Theodorou
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|