onfido 0.12.0 → 1.1.0

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 +5 -5
  2. data/.rubocop.yml +4 -3
  3. data/.travis.yml +8 -7
  4. data/CHANGELOG.md +23 -0
  5. data/LICENSE +2 -1
  6. data/README.md +70 -70
  7. data/lib/onfido.rb +1 -1
  8. data/lib/onfido/api.rb +4 -4
  9. data/lib/onfido/configuration.rb +12 -16
  10. data/lib/onfido/resource.rb +3 -6
  11. data/lib/onfido/resources/address.rb +1 -1
  12. data/lib/onfido/resources/applicant.rb +9 -5
  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 +8 -9
  23. data/spec/integrations/address_spec.rb +1 -0
  24. data/spec/integrations/applicant_spec.rb +38 -32
  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 -13
  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 +13 -13
  36. data/spec/support/fake_onfido_api.rb +60 -77
  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 +22 -42
  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
@@ -2,12 +2,12 @@
2
2
  "checks": [
3
3
  {
4
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",
5
+ "created_at": "2019-11-23T13:50:33Z",
6
+ "href": "/v3/checks/8546921-123123-123123",
7
+ "applicant_provides_data": "false",
8
8
  "status": "pending",
9
9
  "result": "pending",
10
- "reports": [
10
+ "report_ids": [
11
11
  "1030303-123123-375629",
12
12
  "1030303-123123-456789"
13
13
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "7568415-123123-123123",
3
- "created_at": "2014-05-23 13:50:33Z",
4
- "href": "/v2/applicants/1030303-123123-123123/documents/7568415-123123-123123",
3
+ "created_at": "2019-11-23 13:50:33Z",
4
+ "href": "/v3/documents/7568415-123123-123123",
5
5
  "file_name": "passport.jpg",
6
6
  "file_type": "png",
7
7
  "file_size": 282870,
@@ -2,22 +2,22 @@
2
2
  "documents": [
3
3
  {
4
4
  "id": "7568415-123123-123123",
5
- "created_at": "2014-05-23 13:50:33Z",
6
- "href": "/v2/applicants/1030303-123123-123123/documents/7568415-123123-123123",
5
+ "created_at": "2019-11-23 13:50:33Z",
6
+ "href": "/v3/documents/7568415-123123-123123",
7
7
  "file_name": "passport.jpg",
8
8
  "file_type": "png",
9
9
  "file_size": 282870,
10
- "type": "passport",
11
- "side": "back"
10
+ "type": "passport"
12
11
  },
13
12
  {
14
13
  "id": "121122-123123-123123",
15
- "created_at": "2014-05-23 13:50:33Z",
16
- "href": "/v2/applicants/1030303-123123-123123/documents/7568415-123123-123123",
17
- "file_name": "right_to_work.png",
14
+ "created_at": "2019-11-23 13:50:40Z",
15
+ "href": "/v3/documents/7568415-123123-123123",
16
+ "file_name": "driving_licence.png",
18
17
  "file_type": "png",
19
18
  "file_size": 282870,
20
- "type": "right_to_work"
19
+ "type": "driving_licence",
20
+ "side": "front"
21
21
  }
22
22
  ]
23
23
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "document_id": "7568415-123123-123123",
3
+ "document_classification": {
4
+ "issuing_country": "FRA",
5
+ "document_type": "national_identity_card"
6
+ },
7
+ "extracted_data": {
8
+ "date_of_birth": "1965-09-08",
9
+ "document_number": "400925733",
10
+ "first_name": "MARIE",
11
+ "gender": "Female",
12
+ "last_name": "MAVARINE",
13
+ "mrz_line1": "P<GBRDU<MARIE<<MAVARINE<<<<<<<<<<<<<<<<<<<<<",
14
+ "mrz_line2": "4009257333GBR6509088F1307072<<<<<<<<<<<<<<06",
15
+ "nationality": "BRITISH CITIZEN",
16
+ "full_name": "MAVARINE DU MARIE",
17
+ "date_of_expiry": "2013-07-07",
18
+ "middle_name": "DU",
19
+ "address_line_1": "52 RUE DES FLEURS",
20
+ "address_line_2": "33500 BORDEAUX",
21
+ "address_line_3": "FRANCE"
22
+ }
23
+ }
@@ -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.12.0
4
+ version: 1.1.0
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: 2018-05-29 00:00:00.000000000 Z
11
+ date: 2020-08-14 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
@@ -73,14 +58,14 @@ dependencies:
73
58
  requirements:
74
59
  - - "~>"
75
60
  - !ruby/object:Gem::Version
76
- version: 0.52.0
61
+ version: 0.57.0
77
62
  type: :development
78
63
  prerelease: false
79
64
  version_requirements: !ruby/object:Gem::Requirement
80
65
  requirements:
81
66
  - - "~>"
82
67
  - !ruby/object:Gem::Version
83
- version: 0.52.0
68
+ version: 0.57.0
84
69
  - !ruby/object:Gem::Dependency
85
70
  name: sinatra
86
71
  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,9 @@ 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
+ rubyforge_project:
222
+ rubygems_version: 2.4.5.5
223
+ signing_key:
242
224
  specification_version: 4
243
225
  summary: A wrapper for Onfido API
244
226
  test_files:
@@ -247,10 +229,10 @@ test_files:
247
229
  - spec/integrations/check_spec.rb
248
230
  - spec/integrations/document_spec.rb
249
231
  - spec/integrations/exceptions_spec.rb
232
+ - spec/integrations/extraction_spec.rb
250
233
  - spec/integrations/live_photo_spec.rb
251
234
  - spec/integrations/live_video_spec.rb
252
235
  - spec/integrations/report_spec.rb
253
- - spec/integrations/report_type_group_spec.rb
254
236
  - spec/integrations/sdk_token_spec.rb
255
237
  - spec/integrations/webhook_spec.rb
256
238
  - spec/onfido/api_spec.rb
@@ -265,18 +247,16 @@ test_files:
265
247
  - spec/support/fixtures/applicant.json
266
248
  - spec/support/fixtures/applicants.json
267
249
  - spec/support/fixtures/check.json
268
- - spec/support/fixtures/check_with_expanded_reports.json
269
250
  - spec/support/fixtures/checks.json
270
- - spec/support/fixtures/checks_with_expanded_reports.json
271
251
  - spec/support/fixtures/document.json
272
252
  - spec/support/fixtures/documents.json
253
+ - spec/support/fixtures/extraction.json
273
254
  - spec/support/fixtures/live_photo.json
274
255
  - spec/support/fixtures/live_photos.json
275
256
  - spec/support/fixtures/live_video.json
276
257
  - spec/support/fixtures/live_videos.json
258
+ - spec/support/fixtures/not_scheduled_for_deletion_error.json
277
259
  - spec/support/fixtures/report.json
278
- - spec/support/fixtures/report_type_group.json
279
- - spec/support/fixtures/report_type_groups.json
280
260
  - spec/support/fixtures/reports.json
281
261
  - spec/support/fixtures/sdk_token.json
282
262
  - 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