onfido 0.14.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.travis.yml +3 -7
  4. data/CHANGELOG.md +21 -0
  5. data/LICENSE +2 -1
  6. data/README.md +59 -73
  7. data/lib/onfido.rb +1 -1
  8. data/lib/onfido/api.rb +4 -4
  9. data/lib/onfido/configuration.rb +4 -4
  10. data/lib/onfido/resource.rb +3 -6
  11. data/lib/onfido/resources/address.rb +1 -4
  12. data/lib/onfido/resources/applicant.rb +6 -6
  13. data/lib/onfido/resources/check.rb +10 -14
  14. data/lib/onfido/resources/document.rb +11 -11
  15. data/lib/onfido/resources/extraction.rb +9 -0
  16. data/lib/onfido/resources/live_photo.rb +9 -14
  17. data/lib/onfido/resources/live_video.rb +5 -8
  18. data/lib/onfido/resources/report.rb +8 -9
  19. data/lib/onfido/resources/sdk_token.rb +3 -5
  20. data/lib/onfido/resources/webhook.rb +11 -9
  21. data/lib/onfido/version.rb +1 -1
  22. data/onfido.gemspec +6 -7
  23. data/spec/integrations/address_spec.rb +1 -0
  24. data/spec/integrations/applicant_spec.rb +21 -37
  25. data/spec/integrations/check_spec.rb +13 -23
  26. data/spec/integrations/document_spec.rb +16 -17
  27. data/spec/integrations/exceptions_spec.rb +12 -14
  28. data/spec/integrations/extraction_spec.rb +19 -0
  29. data/spec/integrations/live_photo_spec.rb +12 -13
  30. data/spec/integrations/live_video_spec.rb +7 -10
  31. data/spec/integrations/report_spec.rb +11 -13
  32. data/spec/integrations/sdk_token_spec.rb +5 -5
  33. data/spec/integrations/webhook_spec.rb +35 -20
  34. data/spec/onfido/resource_spec.rb +10 -14
  35. data/spec/onfido_spec.rb +9 -10
  36. data/spec/support/fake_onfido_api.rb +53 -78
  37. data/spec/support/fixtures/applicant.json +21 -42
  38. data/spec/support/fixtures/check.json +4 -4
  39. data/spec/support/fixtures/checks.json +4 -4
  40. data/spec/support/fixtures/document.json +2 -2
  41. data/spec/support/fixtures/documents.json +8 -8
  42. data/spec/support/fixtures/extraction.json +23 -0
  43. data/spec/support/fixtures/live_photo.json +3 -3
  44. data/spec/support/fixtures/live_photos.json +6 -6
  45. data/spec/support/fixtures/live_video.json +3 -3
  46. data/spec/support/fixtures/live_videos.json +4 -4
  47. data/spec/support/fixtures/not_scheduled_for_deletion_error.json +7 -0
  48. data/spec/support/fixtures/report.json +4 -4
  49. data/spec/support/fixtures/reports.json +8 -8
  50. data/spec/support/fixtures/webhook.json +6 -5
  51. data/spec/support/fixtures/webhooks.json +17 -12
  52. metadata +19 -40
  53. data/lib/onfido/resources/report_type_group.rb +0 -11
  54. data/spec/integrations/report_type_group_spec.rb +0 -19
  55. data/spec/support/fixtures/check_with_expanded_reports.json +0 -30
  56. data/spec/support/fixtures/checks_with_expanded_reports.json +0 -34
  57. data/spec/support/fixtures/report_type_group.json +0 -25
  58. data/spec/support/fixtures/report_type_groups.json +0 -30
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "id": "3538c8f6-fdce-4745-9d34-fc246bc05aa1",
3
- "created_at": "2014-05-23 13:50:33Z",
3
+ "created_at": "2019-11-23 13:50:33Z",
4
4
  "file_name": "onfido_captured_image.jpg",
5
5
  "file_type": "image/jpeg",
6
6
  "file_size": 47544,
7
- "href": "/v2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1",
8
- "download_href": "/v2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1/download"
7
+ "href": "/v3/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1",
8
+ "download_href": "/v3/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1/download"
9
9
  }
@@ -2,21 +2,21 @@
2
2
  "live_photos": [
3
3
  {
4
4
  "id": "3538c8f6-fdce-4745-9d34-fc246bc05aa1",
5
- "created_at": "2014-05-23 13:50:33Z",
5
+ "created_at": "2019-11-23 13:50:33Z",
6
6
  "file_name": "onfido_captured_image.jpg",
7
7
  "file_type": "image/jpeg",
8
8
  "file_size": 47544,
9
- "href": "/v2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1",
10
- "download_href": "/v2/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1/download"
9
+ "href": "/v3/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1",
10
+ "download_href": "/v3/live_photos/3538c8f6-fdce-4745-9d34-fc246bc05aa1/download"
11
11
  },
12
12
  {
13
13
  "id": "5134c12a-555a-1234-5e12-9d34fcbc11ba",
14
- "created_at": "2014-05-23 13:50:33Z",
14
+ "created_at": "2019-11-23 13:50:33Z",
15
15
  "file_name": "onfido_captured_image.jpg",
16
16
  "file_type": "image/jpeg",
17
17
  "file_size": 47544,
18
- "href": "/v2/live_photos/5134c12a-555a-1234-5e12-9d34fcbc11ba",
19
- "download_href": "/v2/live_photos/5134c12a-555a-1234-5e12-9d34fcbc11ba/download"
18
+ "href": "/v3/live_photos/5134c12a-555a-1234-5e12-9d34fcbc11ba",
19
+ "download_href": "/v3/live_photos/5134c12a-555a-1234-5e12-9d34fcbc11ba/download"
20
20
  }
21
21
  ]
22
22
  }
@@ -14,10 +14,10 @@
14
14
  ]
15
15
  }
16
16
  ],
17
- "created_at" : "2018-05-29T09:00:39Z",
17
+ "created_at" : "2019-11-29T09:00:39Z",
18
18
  "file_name" : "output-29-05-2018_11_00_24.mov",
19
19
  "file_type" : "video/quicktime",
20
20
  "file_size" : 3348421,
21
- "href" : "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
22
- "download_href" : "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download"
21
+ "href" : "/v3/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
22
+ "download_href" : "/v3/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download"
23
23
  }
@@ -15,12 +15,12 @@
15
15
  "type": "recite"
16
16
  }
17
17
  ],
18
- "created_at": "2018-05-29T09:00:39Z",
19
- "download_href": "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download",
20
- "file_name": "output-29-05-2018_11_00_24.mov",
18
+ "created_at": "2019-11-29T09:00:39Z",
19
+ "download_href": "/v3/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download",
20
+ "file_name": "output-29-11-2019_11_00_24.mov",
21
21
  "file_size": 3348421,
22
22
  "file_type": "video/quicktime",
23
- "href": "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
23
+ "href": "/v3/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
24
24
  "id": "c9701e9b-83aa-442f-995b-20320ee8fb01"
25
25
  }
26
26
  ]
@@ -0,0 +1,7 @@
1
+ {
2
+ "error": {
3
+ "type": "validation_error",
4
+ "message": "There was a validation error on this request",
5
+ "fields": "Applicant a2fb9c62-ab10-4898-a8ec-342c4b552ad5 is not scheduled for deletion"
6
+ }
7
+ }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "id": "6951786-123123-422221",
3
- "name": "identity",
4
- "created_at": "2014-05-23T13:50:33Z",
5
- "status": "awaiting_applicant",
3
+ "name": "document",
4
+ "created_at": "2019-11-23T13:50:45Z",
5
+ "status": "in_progress",
6
6
  "result": "pending",
7
- "href": "/v2/checks/8546921-123123-123123/reports/6951786-123123-422221",
7
+ "href": "/v3/reports/6951786-123123-422221",
8
8
  "breakdown": {},
9
9
  "properties": {}
10
10
  }
@@ -2,21 +2,21 @@
2
2
  "reports": [
3
3
  {
4
4
  "id": "6951786-123123-422221",
5
- "name": "identity",
6
- "created_at": "2014-05-23T13:50:33Z",
7
- "status": "awaiting_applicant",
5
+ "name": "document",
6
+ "created_at": "2019-11-23T13:50:45Z",
7
+ "status": "in_progress",
8
8
  "result": "pending",
9
- "href": "/v2/checks/8546921-123123-123123/reports/6951786-123123-422221",
9
+ "href": "/v3/reports/6951786-123123-422221",
10
10
  "breakdown": {},
11
11
  "properties": {}
12
12
  },
13
13
  {
14
14
  "id": "6951786-123123-316712",
15
- "name": "document",
16
- "created_at": "2014-05-23T13:50:33Z",
17
- "status": "awaiting_applicant",
15
+ "name": "facial_similarity_photo",
16
+ "created_at": "2019-11-23T13:50:45Z",
17
+ "status": "in_progress",
18
18
  "result": "pending",
19
- "href": "/v2/checks/8546921-123123-123123/reports/6951786-123123-316712",
19
+ "href": "/v3/reports/6951786-123123-316712",
20
20
  "breakdown": {},
21
21
  "properties": {}
22
22
  }
@@ -3,11 +3,12 @@
3
3
  "url": "https://webhookendpoint.url",
4
4
  "token": "yV85IsmuYwmjQGlZ",
5
5
  "enabled": true,
6
- "href": "/v2/webhooks/fcb73186-0733-4f6f-9c57-d9d5ef979443",
6
+ "href": "/v3/webhooks/fcb73186-0733-4f6f-9c57-d9d5ef979443",
7
+ "environments": [
8
+ "live"
9
+ ],
7
10
  "events": [
8
- "report completion",
9
- "report withdrawal",
10
- "check completion",
11
- "check in progress"
11
+ "report.completed",
12
+ "check.completed"
12
13
  ]
13
14
  }
@@ -2,24 +2,29 @@
2
2
  "webhooks": [
3
3
  {
4
4
  "id": "dd0a89e4-d44e-417a-aec4-01137d01ae59",
5
- "url": "https://demo.com","enabled":false,
6
- "href": "/v2/webhooks/dd0a89e4-d44e-417a-aec4-01137d01ae59",
7
- "events":
8
- [
9
- "check in progress"
5
+ "url": "https://demo.com",
6
+ "enabled":false,
7
+ "href": "/v3/webhooks/dd0a89e4-d44e-417a-aec4-01137d01ae59",
8
+ "environments": [
9
+ "live"
10
+ ],
11
+ "events": [
12
+ "report.completed",
13
+ "report.withdrawn",
14
+ "check.completed"
10
15
  ]
11
16
  },
12
17
  {
13
18
  "id": "bfc727a8-f7bf-4073-b123-ed70a70f58e5",
14
19
  "url": "https://demo2.com",
15
20
  "enabled": true,
16
- "href": "/v2/webhooks/bfc727a8-f7bf-4073-b123-ed70a70f58e5",
17
- "events":
18
- [
19
- "report completion",
20
- "report withdrawal",
21
- "check in progress",
22
- "check completion"
21
+ "href": "/v3/webhooks/bfc727a8-f7bf-4073-b123-ed70a70f58e5",
22
+ "environments": [
23
+ "live"
24
+ ],
25
+ "events": [
26
+ "report.completed",
27
+ "check.completed"
23
28
  ]
24
29
  }
25
30
  ]
metadata CHANGED
@@ -1,30 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onfido
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Pericles Theodorou
8
- - Grey Baker
9
- autorequire:
7
+ - Onfido
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2019-01-28 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: bundler
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.7'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '1.7'
28
13
  - !ruby/object:Gem::Dependency
29
14
  name: rake
30
15
  requirement: !ruby/object:Gem::Requirement
@@ -137,12 +122,11 @@ dependencies:
137
122
  - - "~>"
138
123
  - !ruby/object:Gem::Version
139
124
  version: '2.0'
140
- description: A thin wrapper for Onfido's API. This gem supports both v1 and v2 of
141
- the Onfido API. Refer to Onfido's API documentation for details of the expected
142
- requests and responses for both.
125
+ description: A thin wrapper for Onfido's API. This gem only supports v3 of the Onfido
126
+ API. Refer to Onfido's API documentation for details of the expected requests and
127
+ responses.
143
128
  email:
144
- - periclestheo@gmail.com
145
- - grey@gocardless.com
129
+ - engineering@onfido.com
146
130
  executables: []
147
131
  extensions: []
148
132
  extra_rdoc_files: []
@@ -169,10 +153,10 @@ files:
169
153
  - lib/onfido/resources/applicant.rb
170
154
  - lib/onfido/resources/check.rb
171
155
  - lib/onfido/resources/document.rb
156
+ - lib/onfido/resources/extraction.rb
172
157
  - lib/onfido/resources/live_photo.rb
173
158
  - lib/onfido/resources/live_video.rb
174
159
  - lib/onfido/resources/report.rb
175
- - lib/onfido/resources/report_type_group.rb
176
160
  - lib/onfido/resources/sdk_token.rb
177
161
  - lib/onfido/resources/webhook.rb
178
162
  - lib/onfido/version.rb
@@ -182,10 +166,10 @@ files:
182
166
  - spec/integrations/check_spec.rb
183
167
  - spec/integrations/document_spec.rb
184
168
  - spec/integrations/exceptions_spec.rb
169
+ - spec/integrations/extraction_spec.rb
185
170
  - spec/integrations/live_photo_spec.rb
186
171
  - spec/integrations/live_video_spec.rb
187
172
  - spec/integrations/report_spec.rb
188
- - spec/integrations/report_type_group_spec.rb
189
173
  - spec/integrations/sdk_token_spec.rb
190
174
  - spec/integrations/webhook_spec.rb
191
175
  - spec/onfido/api_spec.rb
@@ -200,28 +184,26 @@ files:
200
184
  - spec/support/fixtures/applicant.json
201
185
  - spec/support/fixtures/applicants.json
202
186
  - spec/support/fixtures/check.json
203
- - spec/support/fixtures/check_with_expanded_reports.json
204
187
  - spec/support/fixtures/checks.json
205
- - spec/support/fixtures/checks_with_expanded_reports.json
206
188
  - spec/support/fixtures/document.json
207
189
  - spec/support/fixtures/documents.json
190
+ - spec/support/fixtures/extraction.json
208
191
  - spec/support/fixtures/live_photo.json
209
192
  - spec/support/fixtures/live_photos.json
210
193
  - spec/support/fixtures/live_video.json
211
194
  - spec/support/fixtures/live_videos.json
195
+ - spec/support/fixtures/not_scheduled_for_deletion_error.json
212
196
  - spec/support/fixtures/report.json
213
- - spec/support/fixtures/report_type_group.json
214
- - spec/support/fixtures/report_type_groups.json
215
197
  - spec/support/fixtures/reports.json
216
198
  - spec/support/fixtures/sdk_token.json
217
199
  - spec/support/fixtures/unexpected_error_format.json
218
200
  - spec/support/fixtures/webhook.json
219
201
  - spec/support/fixtures/webhooks.json
220
- homepage: http://github.com/hvssle/onfido
202
+ homepage: http://github.com/onfido/onfido-ruby
221
203
  licenses:
222
204
  - MIT
223
205
  metadata: {}
224
- post_install_message:
206
+ post_install_message:
225
207
  rdoc_options: []
226
208
  require_paths:
227
209
  - lib
@@ -236,9 +218,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
218
  - !ruby/object:Gem::Version
237
219
  version: '0'
238
220
  requirements: []
239
- rubyforge_project:
240
- rubygems_version: 2.7.4
241
- signing_key:
221
+ rubygems_version: 3.0.3
222
+ signing_key:
242
223
  specification_version: 4
243
224
  summary: A wrapper for Onfido API
244
225
  test_files:
@@ -247,10 +228,10 @@ test_files:
247
228
  - spec/integrations/check_spec.rb
248
229
  - spec/integrations/document_spec.rb
249
230
  - spec/integrations/exceptions_spec.rb
231
+ - spec/integrations/extraction_spec.rb
250
232
  - spec/integrations/live_photo_spec.rb
251
233
  - spec/integrations/live_video_spec.rb
252
234
  - spec/integrations/report_spec.rb
253
- - spec/integrations/report_type_group_spec.rb
254
235
  - spec/integrations/sdk_token_spec.rb
255
236
  - spec/integrations/webhook_spec.rb
256
237
  - spec/onfido/api_spec.rb
@@ -265,18 +246,16 @@ test_files:
265
246
  - spec/support/fixtures/applicant.json
266
247
  - spec/support/fixtures/applicants.json
267
248
  - spec/support/fixtures/check.json
268
- - spec/support/fixtures/check_with_expanded_reports.json
269
249
  - spec/support/fixtures/checks.json
270
- - spec/support/fixtures/checks_with_expanded_reports.json
271
250
  - spec/support/fixtures/document.json
272
251
  - spec/support/fixtures/documents.json
252
+ - spec/support/fixtures/extraction.json
273
253
  - spec/support/fixtures/live_photo.json
274
254
  - spec/support/fixtures/live_photos.json
275
255
  - spec/support/fixtures/live_video.json
276
256
  - spec/support/fixtures/live_videos.json
257
+ - spec/support/fixtures/not_scheduled_for_deletion_error.json
277
258
  - spec/support/fixtures/report.json
278
- - spec/support/fixtures/report_type_group.json
279
- - spec/support/fixtures/report_type_groups.json
280
259
  - spec/support/fixtures/reports.json
281
260
  - spec/support/fixtures/sdk_token.json
282
261
  - spec/support/fixtures/unexpected_error_format.json
@@ -1,11 +0,0 @@
1
- module Onfido
2
- class ReportTypeGroup < Resource
3
- def find(report_type_group_id)
4
- get(url: url_for("report_type_groups/#{report_type_group_id}"))
5
- end
6
-
7
- def all
8
- get(url: url_for("report_type_groups"))
9
- end
10
- end
11
- end
@@ -1,19 +0,0 @@
1
- describe Onfido::ReportTypeGroup do
2
- subject(:report_type_group) { described_class.new }
3
-
4
- describe '#find' do
5
- let(:id) { '8546921-123123-123123' }
6
-
7
- it 'return a retport type group' do
8
- response = report_type_group.find(id)
9
- expect(response['id']).not_to be_nil
10
- end
11
- end
12
-
13
- describe '#all' do
14
- it 'return a list of report type group' do
15
- response = report_type_group.all
16
- expect(response['report_type_groups']).not_to be_empty
17
- end
18
- end
19
- end
@@ -1,30 +0,0 @@
1
- {
2
- "id": "8546921-123123-123123",
3
- "created_at": "2014-05-23T13:50:33Z",
4
- "href": "/v2/applicants/61f659cb-c90b-4067-808a-6136b5c01351/checks/8546921-123123-123123",
5
- "type": "standard",
6
- "status": "pending",
7
- "result": "pending",
8
- "reports": [
9
- {
10
- "id": "6951786-123123-422221",
11
- "name": "identity",
12
- "created_at": "2014-05-23T13:50:33Z",
13
- "status": "awaiting_applicant",
14
- "result": "pending",
15
- "href": "/v2/checks/8546921-123123-123123/reports/6951786-123123-422221",
16
- "breakdown": {},
17
- "properties": {}
18
- },
19
- {
20
- "id": "6951786-123123-316712",
21
- "name": "document",
22
- "created_at": "2014-05-23T13:50:33Z",
23
- "status": "awaiting_applicant",
24
- "result": "pending",
25
- "href": "/v2/checks/8546921-123123-123123/reports/6951786-123123-316712",
26
- "breakdown": {},
27
- "properties": {}
28
- }
29
- ]
30
- }
@@ -1,34 +0,0 @@
1
- {
2
- "checks": [
3
- {
4
- "id": "8546921-123123-123123",
5
- "created_at": "2014-05-23T13:50:33Z",
6
- "href": "/v2/applicants/61f659cb-c90b-4067-808a-6136b5c01351/checks/8546921-123123-123123",
7
- "type": "standard",
8
- "status": "pending",
9
- "result": "pending",
10
- "reports": [
11
- {
12
- "id": "6951786-123123-422221",
13
- "name": "identity",
14
- "created_at": "2014-05-23T13:50:33Z",
15
- "status": "awaiting_applicant",
16
- "result": "pending",
17
- "href": "/v2/checks/8546921-123123-123123/reports/6951786-123123-422221",
18
- "breakdown": {},
19
- "properties": {}
20
- },
21
- {
22
- "id": "6951786-123123-316712",
23
- "name": "document",
24
- "created_at": "2014-05-23T13:50:33Z",
25
- "status": "awaiting_applicant",
26
- "result": "pending",
27
- "href": "/v2/checks/8546921-123123-123123/reports/6951786-123123-316712",
28
- "breakdown": {},
29
- "properties": {}
30
- }
31
- ]
32
- }
33
- ]
34
- }
@@ -1,25 +0,0 @@
1
- {
2
- "id": "8546921-123123-123123",
3
- "name": "Senior level",
4
- "group_only": false,
5
- "report_types": [
6
- {
7
- "id": "4566764-567657-234445",
8
- "name": "identity"
9
- },
10
- {
11
- "id": "2344556-236767-786868",
12
- "name": "right_to_work"
13
- },
14
- {
15
- "id": "4523434-345133-234424",
16
- "name": "directorship"
17
- },
18
- {
19
- "id": "7857345-234234-565345",
20
- "name": "criminal_history",
21
- "variant": "basic",
22
- "options": []
23
- }
24
- ]
25
- }