onfido 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 7c2b7ace145ea9b4804afb24664f452851753bb15dca4221e94c43cf1db6f96e
4
- data.tar.gz: c0477b41310dc691e99a218d03a40777c5e91d3e1cc72d90884f9d6d01772a3e
2
+ SHA1:
3
+ metadata.gz: 8749aa43cbc394686f1ff769f0b0ada44c541a9c
4
+ data.tar.gz: f6e314d3f734e8eb315f97daa6765c0904bec8db
5
5
  SHA512:
6
- metadata.gz: 598a9e0fcf166be224cf0b28dd0f8ca92f8e285ac3955d7ff06ad450bd018741ce580f99de6e506100f879ef5002e485926fec8d741d7bb313d496486f4ffb48
7
- data.tar.gz: 1786150e8f9b3d8d7b1bec8aad0ff35565c77e3000c70534757aec49ae85fff9c15deb398e53d2676337b3ff9432a25ed48a690833112304ad91d249ae82f550
6
+ metadata.gz: f2db07995e16031cb9b04da83497400f082fb1fdac289761b46481ab83d283efbdf7bc12ac61508fa50583f081c53311c4dce8aa7cf90efda97d5c6bc4244435
7
+ data.tar.gz: 3e41ed2d4988192d230b67382e78b19209684a059aec2af1ca875234b3bf7787f17dbcdbd6004ca1ad0df12b051061d9413afffc85a6739c519d9eccfc89c1a9
@@ -1,14 +1,13 @@
1
1
  language: ruby
2
+ cache: bundler
2
3
 
3
4
  rvm:
5
+ - 2.2
4
6
  - 2.3
5
7
  - 2.4
6
8
  - 2.5
7
9
  - 2.6
8
-
9
- before_install:
10
- - gem update --system
11
- - gem install bundler
10
+ - 2.7
12
11
 
13
12
  script:
14
13
  - bundle exec rubocop
@@ -1,7 +1,13 @@
1
+ ## v1.1.0, 6 Aug 2020
2
+
3
+ - Add User-Agent header
4
+ - Add support for CA region
5
+
1
6
  ## v1.0.0, 13 Jan 2020
2
7
 
3
8
  - Support Onfido API version 3
4
9
  - Drop support for Onfido API version 2
10
+ - To upgrade from 0.15.0 see the v2 to v3 migration [guide](https://developers.onfido.com/guide/v2-to-v3-migration-guide)
5
11
 
6
12
  ## v0.15.0, 4 Feb 2019
7
13
 
data/README.md CHANGED
@@ -5,28 +5,27 @@ A thin wrapper for Onfido's API.
5
5
  [![Gem Version](https://badge.fury.io/rb/onfido.svg)](http://badge.fury.io/rb/onfido)
6
6
  [![Build Status](https://travis-ci.org/onfido/onfido-ruby.svg?branch=master)](https://travis-ci.org/onfido/onfido-ruby)
7
7
 
8
- This gem supports only `v3` of Onfido's API from version `1.0.0` ownards.
9
- The latest version that supports `v2` of Onfido's API is `0.15.0`. `v1` of Onfido's API is deprecated
10
- Refer to Onfido's [API documentation](https://documentation.onfido.com) for details of the expected requests and responses.
8
+ This gem supports only `v3` of Onfido's API from version `1.0.0` onwards. The latest version that supports `v2` of Onfido's API is `0.15.0`. `v1` of Onfido's API is deprecated.
11
9
 
10
+ The gem is compatible with Ruby 2.2.0 and onwards. Earlier versions of Ruby have [reached end-of-life](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/), are no longer supported and no longer receive security fixes.
11
+
12
+ Refer to Onfido's [API documentation](https://documentation.onfido.com) for details of the expected requests and responses.
12
13
 
13
14
  ## Installation
14
15
 
15
16
  Add this line to your application's Gemfile:
16
17
 
17
18
  ```ruby
18
- gem 'onfido', '~> 1.0.0'
19
+ gem 'onfido', '~> 1.1.0'
19
20
  ```
20
21
 
21
- The gem is compatible with Ruby 2.2.0 and onwards. Earlier versions of Ruby have [reached end-of-life](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/), are no longer supported and no longer receive security fixes.
22
-
23
22
  ## Configuration
24
23
 
25
24
  There are 5 configuration options:
26
25
 
27
26
  ```ruby
28
27
  Onfido.configure do |config|
29
- config.api_key = 'MY_API_KEY'
28
+ config.api_key = '<YOUR_API_KEY>'
30
29
  config.logger = Logger.new(STDOUT)
31
30
  config.open_timeout = 30
32
31
  config.read_timeout = 80
@@ -41,6 +40,9 @@ The gem will use the default region if no region is specified.
41
40
  To specify the US region do:
42
41
  `config.region = :us`
43
42
 
43
+ To specify the CA region do:
44
+ `config.region = :ca`
45
+
44
46
  See https://documentation.onfido.com/#regions for supported regions.
45
47
 
46
48
  ## Usage
@@ -48,46 +50,46 @@ See https://documentation.onfido.com/#regions for supported regions.
48
50
  You can make API calls by using an instance of the `API` class:
49
51
 
50
52
  ```ruby
51
- api = Onfido::API.new
53
+ onfido = Onfido::API.new
52
54
  ```
53
55
 
54
- Alternatively, you can set an API key here instead of in the initializer:
56
+ You can also set an API key as follows, instead of in the initializer configuration:
55
57
 
56
58
  ```ruby
57
- api = Onfido::API.new(api_key: 'API_KEY')
59
+ onfido = Onfido::API.new(api_key: '<YOUR_API_KEY>')
58
60
  ```
59
61
 
60
62
  ### Resources
61
63
 
62
64
  All resources share the same interface when making API calls. Use `.create` to create a resource, `.find` to find one, and `.all` to fetch all resources.
63
65
 
64
- **Note:** *All param keys should be a symbol e.g. `{ report_names: ['document'] }`*
66
+ **Note:** *All param keys should be symbols e.g. `{ report_names: ['document'] }`*
65
67
 
66
68
  #### Applicants
67
69
 
68
70
  Applicants are the object upon which Onfido checks are performed.
69
71
 
70
72
  ```ruby
71
- api.applicant.create(params) # => Creates an applicant
72
- api.applicant.update('applicant_id', params) # => Updates an applicant
73
- api.applicant.destroy('applicant_id') # => Schedule an applicant for deletion
74
- api.applicant.restore('applicant_id') # => Restore an applicant scheduled for deletion
75
- api.applicant.find('applicant_id') # => Finds a single applicant
76
- api.applicant.all # => Returns all applicants
73
+ onfido.applicant.create(params) # => Creates an applicant
74
+ onfido.applicant.update('<APPLICANT_ID>', params) # => Updates an applicant
75
+ onfido.applicant.destroy('<APPLICANT_ID>') # => Schedule an applicant for deletion
76
+ onfido.applicant.restore('<APPLICANT_ID>') # => Restore an applicant scheduled for deletion
77
+ onfido.applicant.find('<APPLICANT_ID>') # => Finds a single applicant
78
+ onfido.applicant.all # => Returns all applicants
77
79
  ```
78
80
 
79
- **Note:** Calling `api.applicant.destroy` adds the applicant and all associated documents, photos, videos, checks, and reports to the deletion queue. They will be deleted 20 days after the request is made. An applicant that is scheduled for deletion can be restored but applicants that have been permanently deleted cannot.
81
+ **Note:** Calling `onfido.applicant.destroy` adds the applicant and all associated documents, photos, videos, checks, and reports to the deletion queue. They will be deleted 20 days after the request is made. An applicant that is scheduled for deletion can be restored but applicants that have been permanently deleted cannot.
80
82
  See https://documentation.onfido.com/#delete-applicant for more information.
81
83
 
82
84
  #### Documents
83
85
 
84
- Documents provide supporting evidence for Onfido checks.
86
+ Some report types require identity documents (passport, driving licence etc.) in order to be processed.
85
87
 
86
88
  ```ruby
87
- api.document.create('applicant_id', file: 'http://example.com', type: 'passport') # => Creates a document
88
- api.document.find('document_id') # => Finds a document
89
- api.document.download('document_id') # => Downloads a document as a binary data
90
- api.document.all('applicant_id') # => Returns all applicant's documents
89
+ onfido.document.create(applicant_id: '<APPLICANT_ID>', file: <FILE>, type: 'passport') # => Creates a document
90
+ onfido.document.find('<DOCUMENT_ID>') # => Finds a document
91
+ onfido.document.download('<DOCUMENT_ID>') # => Downloads a document as a binary data
92
+ onfido.document.all('<APPLICANT_ID>') # => Returns all documents belonging to an applicant
91
93
  ```
92
94
 
93
95
  **Note:** The file parameter must be a `File`-like object which responds to `#read` and `#path`.
@@ -95,15 +97,17 @@ Previous versions of this gem supported providing a URL to a file accessible ove
95
97
  to a file in the local filesystem. You should instead load the file yourself and then pass it in
96
98
  to `#create`.
97
99
 
100
+ See https://documentation.onfido.com/#document-types for example document types.
101
+
98
102
  #### Live Photos
99
103
 
100
- Live Photos, like documents, can provide supporting evidence for Onfido checks.
104
+ Live photos are images of the applicant’s face, typically taken at the same time as documents are provided. These photos are used to perform Facial Similarity Photo reports on the applicant.
101
105
 
102
106
  ```ruby
103
- api.live_photo.create('applicant_id', file: 'http://example.com')
104
- api.live_photo.find(live_photo_id) # => Finds a live photo
105
- api.live_photo.download(live_photo_id) # => Downloads a live photo as binary data
106
- api.live_photo.all(applicant_id) # => Returns all applicant's live photos
107
+ onfido.live_photo.create(applicant_id: '<APPLICANT_ID>', file: <FILE>) # => Creates a live photo
108
+ onfido.live_photo.find('<LIVE_PHOTO_ID>') # => Finds a live photo
109
+ onfido.live_photo.download('<LIVE_PHOTO_ID>') # => Downloads a live photo as binary data
110
+ onfido.live_photo.all('<APPLICANT_ID>') # => Returns all live photos belonging to an applicant
107
111
  ```
108
112
 
109
113
  **Note:** The file parameter must be a `File`-like object which responds to `#read` and `#path`.
@@ -113,38 +117,37 @@ to `#create`.
113
117
 
114
118
  #### Checks
115
119
 
116
- Checks are requests for Onfido to check an applicant, by commissioning one or
117
- more "reports" on them.
120
+ Checks are performed on an applicant. Depending on the type of check you wish to perform, different information will be required when you create an applicant. A check consists of one or more reports.
118
121
 
119
122
  ```ruby
120
- api.check.create('applicant_id', report_names: ['document'])
121
- api.check.find('check_id')
122
- api.check.resume('check_id')
123
- api.check.all('applicant_id')
123
+ onfido.check.create(applicant_id: '<APPLICANT_ID>', report_names: ['document', 'facial_similarity_photo']) # => Creates a check
124
+ onfido.check.find('<CHECK_ID>') # => Finds a check
125
+ onfido.check.resume('<CHECK_ID>') # => Resumes a paused check
126
+ onfido.check.all('<APPLICANT_ID>') # => Returns all an applicant's checks
124
127
  ```
125
128
 
126
129
  #### Reports
127
130
 
128
- Reports provide details of the results of some part of a "check". They are
131
+ Reports provide details of the results of some part of a check. They are
129
132
  created when a check is created, so the Onfido API only provides support for
130
133
  finding and listing them. For paused reports specifically, additional support for resuming and
131
134
  cancelling reports is also available.
132
135
 
133
136
  ```ruby
134
- api.report.find('report_id')
135
- api.report.all('check_id')
136
- api.report.resume('report_id')
137
- api.report.cancel('report_id')
137
+ onfido.report.find('<REPORT_ID>') # => Finds a report
138
+ onfido.report.all('<CHECK_ID>') # => Returns all the reports in a check
139
+ onfido.report.resume('<REPORT_ID>') # => Resumes a paused report
140
+ onfido.report.cancel('<REPORT_ID>') # => Cancels a paused report
138
141
  ```
139
142
 
140
143
  #### Address Lookups
141
144
 
142
145
  Onfido provides an address lookup service, to help ensure well-formatted
143
- addresses are provided when creating "applicants". To search for addresses
146
+ addresses are provided when creating applicants. To search for addresses
144
147
  by postcode, use:
145
148
 
146
149
  ```ruby
147
- api.address.all('SE1 4NG')
150
+ onfido.address.all('SE1 4NG') # => Returns all addresses in a given postcode
148
151
  ```
149
152
 
150
153
  #### Webhook Endpoints
@@ -153,9 +156,9 @@ Onfido allows you to set up and view your webhook endpoints via the API, as well
153
156
  as through the dashboard.
154
157
 
155
158
  ```ruby
156
- api.webhook.create(params) # => Creates a webhook endpoint
157
- api.webhook.find('webhook_id') # => Finds a single webhook endpoint
158
- api.webhook.all # => Returns all webhook endpoints
159
+ onfido.webhook.create(url: "https://webhook.url", events: ['report.completed, check.completed']) # => Registers a webhook endpoint
160
+ onfido.webhook.find('<WEBHOOK_ID>') # => Finds a single webhook endpoint
161
+ onfido.webhook.all # => Returns all webhook endpoints
159
162
  ```
160
163
 
161
164
  #### SDK Tokens
@@ -164,21 +167,21 @@ Onfido allows you to generate JSON Web Tokens via the API in order to authentica
164
167
  with Onfido's [JavaScript SDK](https://github.com/onfido/onfido-sdk-ui).
165
168
 
166
169
  ```ruby
167
- api.sdk_token.create(applicant_id: 'applicant_id', referrer: 'referrer')
170
+ onfido.sdk_token.create(applicant_id: 'applicant_id', referrer: 'referrer') # => Creates a JWT
168
171
  ```
169
172
 
170
173
  ### Error Handling
171
174
 
172
- There are three classes of errors raised by the library, all of which subclass `Onfido::OnfidoError`:
175
+ There are 3 classes of errors raised by the library, all of which subclass `Onfido::OnfidoError`:
173
176
  - `Onfido::ServerError` is raised whenever Onfido returns a `5xx` response
174
177
  - `Onfido::RequestError` is raised whenever Onfido returns any other kind of error
175
178
  - `Onfido::ConnectionError` is raised whenever a network error occurs (e.g., a timeout)
176
179
 
177
- All three error classes provide the `response_code`, `response_body`, `json_body`, `type` and `fields` of the error (although for `Onfido::ServerError` and `Onfido::ConnectionError` the last three are likely to be `nil`).
180
+ All 3 error classes provide the `response_code`, `response_body`, `json_body`, `type` and `fields` of the error (although for `Onfido::ServerError` and `Onfido::ConnectionError` the last 3 are likely to be `nil`).
178
181
 
179
182
  ```ruby
180
183
  def create_applicant
181
- api.applicant.create(params)
184
+ onfido.applicant.create(params)
182
185
  rescue Onfido::RequestError => e
183
186
  e.type # => 'validation_error'
184
187
  e.fields # => { "email": { "messages": ["invalid format"] } }
@@ -188,13 +191,13 @@ end
188
191
 
189
192
  ## Webhooks
190
193
 
191
- Each webhook endpoint has a secret token, generated automatically and [exposed](https://onfido.com/documentation#register-webhook) in the API. When sending a request, Onfido includes a signature computed using the request body and this token in the `X-Signature` header.
194
+ Each webhook endpoint has a secret token, generated automatically and [exposed](https://onfido.com/documentation#register-webhook) in the API. When sending a request, Onfido includes a signature computed using the request body and this token in the `X-SHA2-Signature` header.
192
195
 
193
- This provided signature [should](https://onfido.com/documentation#webhook-security) be compared to one you generate yourself with the token to check that a webhook is a genuine request from Onfido.
196
+ You should compare this provided signature to one you generate yourself with the token to verify that a webhook is a genuine request from Onfido.
194
197
 
195
198
  ```ruby
196
199
  if Onfido::Webhook.valid?(request.raw_post,
197
- request.headers["X-Signature"],
200
+ request.headers["X-SHA2-Signature"],
198
201
  ENV['ONFIDO_WEBHOOK_TOKEN'])
199
202
  process_webhook
200
203
  else
@@ -202,15 +205,11 @@ else
202
205
  end
203
206
  ```
204
207
 
205
- ## Roadmap
206
-
207
- - Improve test coverage with more scenarios
208
- - Add custom errors based on the response code
209
- - Improve pagination handling (use information passed in link header)
208
+ Read more at https://onfido.com/documentation#webhook-security
210
209
 
211
210
  ## Contributing
212
211
 
213
- 1. Fork it ( https://github.com/onfido/onfido/fork )
212
+ 1. Fork it ( https://github.com/onfido/onfido-ruby/fork )
214
213
  2. Create your feature branch (`git checkout -b my-new-feature`)
215
214
  3. Commit your changes (`git commit -am 'Add some feature'`)
216
215
  4. Push to the branch (`git push origin my-new-feature`)
@@ -16,6 +16,7 @@ require 'onfido/resources/address'
16
16
  require 'onfido/resources/applicant'
17
17
  require 'onfido/resources/check'
18
18
  require 'onfido/resources/document'
19
+ require 'onfido/resources/extraction'
19
20
  require 'onfido/resources/live_photo'
20
21
  require 'onfido/resources/live_video'
21
22
  require 'onfido/resources/report'
@@ -39,5 +39,9 @@ module Onfido
39
39
  def address
40
40
  Onfido::Address.new(@api_key)
41
41
  end
42
+
43
+ def extraction
44
+ Onfido::Extraction.new(@api_key)
45
+ end
42
46
  end
43
47
  end
@@ -1,7 +1,8 @@
1
1
  module Onfido
2
2
  module Configuration
3
3
  REGION_HOSTS = {
4
- us: "api.us.onfido.com"
4
+ us: "api.us.onfido.com",
5
+ ca: "api.ca.onfido.com"
5
6
  }.freeze
6
7
 
7
8
  attr_accessor :api_key, :region, :open_timeout, :read_timeout
@@ -65,7 +65,8 @@ module Onfido
65
65
  def headers
66
66
  {
67
67
  'Authorization' => "Token token=#{@api_key}",
68
- 'Accept' => "application/json"
68
+ 'Accept' => "application/json",
69
+ 'User-Agent' => "onfido-ruby/#{Onfido::VERSION}"
69
70
  }
70
71
  end
71
72
 
@@ -0,0 +1,9 @@
1
+ module Onfido
2
+ class Extraction < Resource
3
+ def create(document_id:)
4
+ payload = { document_id: document_id }
5
+
6
+ post(path: 'extractions', payload: payload)
7
+ end
8
+ end
9
+ end
@@ -13,6 +13,10 @@ module Onfido
13
13
  get(path: 'webhooks')
14
14
  end
15
15
 
16
+ def destroy(webhook_id)
17
+ delete(path: "webhooks/#{webhook_id}")
18
+ end
19
+
16
20
  # As well as being a normal resource, Onfido::Webhook also supports
17
21
  # verifying the authenticity of a webhook by comparing the signature on the
18
22
  # request to one computed from the body
@@ -1,3 +1,3 @@
1
1
  module Onfido
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
  spec.required_ruby_version = ">= 2.2.0"
25
25
 
26
- spec.add_development_dependency 'bundler', '~> 2.0'
27
26
  spec.add_development_dependency 'rake', '~> 12.0'
28
27
  spec.add_development_dependency 'rspec', '~> 3.1'
29
28
  spec.add_development_dependency 'rspec-its', '~> 1.2'
@@ -22,7 +22,7 @@ describe Onfido::Document do
22
22
  end
23
23
 
24
24
  it 'creates a new document' do
25
- response = document.create(params)
25
+ response = document.create(**params)
26
26
 
27
27
  expect(response['id']).not_to be_nil
28
28
  end
@@ -32,7 +32,7 @@ describe Onfido::Document do
32
32
  let(:file) { 'https://onfido.com/images/logo.png' }
33
33
 
34
34
  it 'raises an ArgumentError' do
35
- expect { document.create(params) }.
35
+ expect { document.create(**params) }.
36
36
  to raise_error(ArgumentError, /must be a `File`-like object/)
37
37
  end
38
38
  end
@@ -0,0 +1,19 @@
1
+ require 'tempfile'
2
+
3
+ describe Onfido::Extraction do
4
+ subject(:extraction) { described_class.new }
5
+
6
+ describe '#create' do
7
+ let(:params) do
8
+ {
9
+ document_id: '7568415-123123-123123'
10
+ }
11
+ end
12
+
13
+ it 'creates a new extraction' do
14
+ response = extraction.create(params)
15
+
16
+ expect(response['document_id']).to eq('7568415-123123-123123')
17
+ end
18
+ end
19
+ end
@@ -15,7 +15,7 @@ describe Onfido::LivePhoto do
15
15
  end
16
16
 
17
17
  it 'creates a new photo' do
18
- response = live_photo.create(params)
18
+ response = live_photo.create(**params)
19
19
 
20
20
  expect(response['id']).not_to be_nil
21
21
  end
@@ -25,7 +25,7 @@ describe Onfido::LivePhoto do
25
25
  let(:file) { 'https://onfido.com/images/photo.jpg' }
26
26
 
27
27
  it 'raises an ArgumentError' do
28
- expect { live_photo.create(params) }.
28
+ expect { live_photo.create(**params) }.
29
29
  to raise_error(ArgumentError, /must be a `File`-like object/)
30
30
  end
31
31
  end
@@ -14,13 +14,13 @@ describe Onfido::Webhook do
14
14
  end
15
15
 
16
16
  it "creates the webhook" do
17
- response = webhook.create(params)
17
+ response = webhook.create(**params)
18
18
 
19
19
  expect(response['id']).to_not be_nil
20
20
  end
21
21
 
22
22
  it "responds with the right url" do
23
- response = webhook.create(params)
23
+ response = webhook.create(**params)
24
24
 
25
25
  expect(response["url"]).to eq params[:url]
26
26
  end
@@ -36,6 +36,13 @@ describe Onfido::Webhook do
36
36
  end
37
37
  end
38
38
 
39
+ describe "#destroy" do
40
+ it "removes the webhook" do
41
+ webhook_id = 'fcb73186-0733-4f6f-9c57-d9d5ef979443'
42
+ expect { webhook.destroy(webhook_id) }.not_to raise_error
43
+ end
44
+ end
45
+
39
46
  describe "#all" do
40
47
  it "returns all the registered webhooks" do
41
48
  response = webhook.all
@@ -63,7 +63,8 @@ describe Onfido::Resource do
63
63
  expect(WebMock).to have_requested(:get, url).with(
64
64
  headers: {
65
65
  'Authorization' => "Token token=#{specific_api_key}",
66
- 'Accept' => "application/json"
66
+ 'Accept' => "application/json",
67
+ 'User-Agent' => "onfido-ruby/#{Onfido::VERSION}"
67
68
  }
68
69
  )
69
70
  end
@@ -78,7 +79,8 @@ describe Onfido::Resource do
78
79
  expect(WebMock).to have_requested(:get, url).with(
79
80
  headers: {
80
81
  'Authorization' => "Token token=#{api_key}",
81
- 'Accept' => "application/json"
82
+ 'Accept' => "application/json",
83
+ 'User-Agent' => "onfido-ruby/#{Onfido::VERSION}"
82
84
  }
83
85
  )
84
86
  end
@@ -34,6 +34,13 @@ describe Onfido do
34
34
  end
35
35
  end
36
36
 
37
+ describe 'using the CA region' do
38
+ it 'should change endpoint' do
39
+ onfido.region = 'ca'
40
+ expect(onfido.endpoint).to eq('https://api.ca.onfido.com/v3/')
41
+ end
42
+ end
43
+
37
44
  describe 'using an unsupported region' do
38
45
  it 'should change endpoint' do
39
46
  onfido.region = 'de'
@@ -38,6 +38,10 @@ class FakeOnfidoAPI < Sinatra::Base
38
38
  json_response(201, 'document.json')
39
39
  end
40
40
 
41
+ post '/v3/extractions' do
42
+ json_response(201, 'extraction.json')
43
+ end
44
+
41
45
  get '/v3/documents/:id' do
42
46
  json_response(200, 'document.json')
43
47
  end
@@ -136,6 +140,11 @@ class FakeOnfidoAPI < Sinatra::Base
136
140
  json_response(200, 'webhook.json')
137
141
  end
138
142
 
143
+ delete '/v3/webhooks/:id' do
144
+ content_type "application/json; charset=utf-8"
145
+ status 204
146
+ end
147
+
139
148
  get '/v3/webhooks' do
140
149
  json_response(200, 'webhooks.json')
141
150
  end
@@ -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
+ }
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onfido
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onfido
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-13 00:00:00.000000000 Z
11
+ date: 2020-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -167,6 +153,7 @@ files:
167
153
  - lib/onfido/resources/applicant.rb
168
154
  - lib/onfido/resources/check.rb
169
155
  - lib/onfido/resources/document.rb
156
+ - lib/onfido/resources/extraction.rb
170
157
  - lib/onfido/resources/live_photo.rb
171
158
  - lib/onfido/resources/live_video.rb
172
159
  - lib/onfido/resources/report.rb
@@ -179,6 +166,7 @@ files:
179
166
  - spec/integrations/check_spec.rb
180
167
  - spec/integrations/document_spec.rb
181
168
  - spec/integrations/exceptions_spec.rb
169
+ - spec/integrations/extraction_spec.rb
182
170
  - spec/integrations/live_photo_spec.rb
183
171
  - spec/integrations/live_video_spec.rb
184
172
  - spec/integrations/report_spec.rb
@@ -199,6 +187,7 @@ files:
199
187
  - spec/support/fixtures/checks.json
200
188
  - spec/support/fixtures/document.json
201
189
  - spec/support/fixtures/documents.json
190
+ - spec/support/fixtures/extraction.json
202
191
  - spec/support/fixtures/live_photo.json
203
192
  - spec/support/fixtures/live_photos.json
204
193
  - spec/support/fixtures/live_video.json
@@ -214,7 +203,7 @@ homepage: http://github.com/onfido/onfido-ruby
214
203
  licenses:
215
204
  - MIT
216
205
  metadata: {}
217
- post_install_message:
206
+ post_install_message:
218
207
  rdoc_options: []
219
208
  require_paths:
220
209
  - lib
@@ -229,8 +218,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
218
  - !ruby/object:Gem::Version
230
219
  version: '0'
231
220
  requirements: []
232
- rubygems_version: 3.0.3
233
- signing_key:
221
+ rubyforge_project:
222
+ rubygems_version: 2.4.5.5
223
+ signing_key:
234
224
  specification_version: 4
235
225
  summary: A wrapper for Onfido API
236
226
  test_files:
@@ -239,6 +229,7 @@ test_files:
239
229
  - spec/integrations/check_spec.rb
240
230
  - spec/integrations/document_spec.rb
241
231
  - spec/integrations/exceptions_spec.rb
232
+ - spec/integrations/extraction_spec.rb
242
233
  - spec/integrations/live_photo_spec.rb
243
234
  - spec/integrations/live_video_spec.rb
244
235
  - spec/integrations/report_spec.rb
@@ -259,6 +250,7 @@ test_files:
259
250
  - spec/support/fixtures/checks.json
260
251
  - spec/support/fixtures/document.json
261
252
  - spec/support/fixtures/documents.json
253
+ - spec/support/fixtures/extraction.json
262
254
  - spec/support/fixtures/live_photo.json
263
255
  - spec/support/fixtures/live_photos.json
264
256
  - spec/support/fixtures/live_video.json