onfido 0.14.0 → 0.15.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
2
  SHA256:
3
- metadata.gz: 27279800cfff5a840ce97b9e8de9dc74a5083ea1c57f8a10b87e5bc2950f1067
4
- data.tar.gz: 922fdbde05fe24981a5e2cf6d6be173f6db0c8966521e07a7271c15df3849440
3
+ metadata.gz: 94d4e590e003b1ff219091a7690385782a3aa1ef7ee46000f185cf183a81702e
4
+ data.tar.gz: 1961655f50cdf2f8148e83310b2d0bbebd0c3139ed3de5b63f3c001d398b02d3
5
5
  SHA512:
6
- metadata.gz: 0982bae64d5589a5909f03f92904445ea0f1912c554912a46893b61647756794522b11dbc46bb8e562712572c5459bd8f1a819e3e10d539bbbf6e5e7c077b5be
7
- data.tar.gz: 8b741438cefff280b5ad6c1c6a7db958910f78553fd3e7315943a00247b6badc993154991c6866242dd2342eb31f8bc937904672fd4a01594f5feb1f454664d0
6
+ metadata.gz: 490a955c369dd6934ac60685ef628cc6a821b461efa13113b7e381aa5bd1a6bb958996d1ed2add552f661d18236112a541fb900b2c6a54e09ef9eaa37f2a1346
7
+ data.tar.gz: 72d9cdadfc3f73c75464cbe7fe7cb36b764ac2c420fa7afb2268e2a5d31b9c1139d5829faa2d9e830a3bd7b02d2ec12203c66e80b80c92947a0be0f58166c7e8
@@ -51,3 +51,7 @@ Layout/DotPosition:
51
51
  # Allow class and message or instance raises
52
52
  Style/RaiseArgs:
53
53
  Enabled: false
54
+
55
+ Lint/AmbiguousBlockAssociation:
56
+ Exclude:
57
+ - "spec/**/*"
@@ -1,17 +1,14 @@
1
1
  language: ruby
2
2
 
3
- matrix:
4
- allow_failures:
5
- - rvm: jruby
6
- - rvm: rbx-2
7
-
8
3
  rvm:
9
- - 2.2
10
4
  - 2.3
11
5
  - 2.4
12
6
  - 2.5
13
- - jruby
14
- - rbx-2
7
+ - 2.6
8
+
9
+ before_install:
10
+ - gem update --system
11
+ - gem install bundler
15
12
 
16
13
  script:
17
14
  - bundle exec rubocop
@@ -1,3 +1,7 @@
1
+ ## v0.15.0, 4 Feb 2019
2
+
3
+ - Add Check#find_by_url method (@ctrlaltdylan)
4
+
1
5
  ## v0.14.0, 28 Jan 2019
2
6
 
3
7
  - Add support for applicant deletion and restore endpoints
data/README.md CHANGED
@@ -12,7 +12,7 @@ This gem supports both `v1` and `v2` of the Onfido API. Refer to Onfido's [API d
12
12
  Add this line to your application's Gemfile:
13
13
 
14
14
  ```ruby
15
- gem 'onfido', '~> 0.13.0'
15
+ gem 'onfido', '~> 0.15.0'
16
16
  ```
17
17
 
18
18
  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.
@@ -74,7 +74,7 @@ api.applicant.find('applicant_id') # => Finds a single applicant
74
74
  api.applicant.all # => Returns all applicants
75
75
  ```
76
76
 
77
- **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 be restored.
77
+ **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.
78
78
  See https://documentation.onfido.com/#delete-applicant for more information.
79
79
 
80
80
  #### Documents
@@ -117,6 +117,7 @@ more "reports" on them.
117
117
  ```ruby
118
118
  api.check.create('applicant_id', type: 'express', reports: [{ name: 'identity' }])
119
119
  api.check.find('applicant_id', 'check_id')
120
+ api.check.find_by_url(params[:payload][:object][:href])
120
121
  api.check.resume('check_id')
121
122
  api.check.all('applicant_id')
122
123
  ```
@@ -13,6 +13,12 @@ module Onfido
13
13
  "#{querystring}"))
14
14
  end
15
15
 
16
+ def find_by_url(url, expand: nil)
17
+ url_path = url.sub(%r/^https\:\/\/api\.onfido\.com\/v2\//, '')
18
+ querystring = "&expand=#{expand}" if expand
19
+ get(url: url_for("#{url_path}?#{querystring}"))
20
+ end
21
+
16
22
  def all(applicant_id, page: 1, per_page: 20, expand: nil)
17
23
  querystring = "page=#{page}&per_page=#{per_page}"
18
24
  querystring += "&expand=#{expand}" if expand
@@ -1,3 +1,3 @@
1
1
  module Onfido
2
- VERSION = '0.14.0'.freeze
2
+ VERSION = '0.15.0'.freeze
3
3
  end
@@ -23,7 +23,7 @@ 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', '~> 1.7'
26
+ spec.add_development_dependency 'bundler', '~> 2.0'
27
27
  spec.add_development_dependency 'rake', '~> 12.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.1'
29
29
  spec.add_development_dependency 'rspec-its', '~> 1.2'
@@ -114,7 +114,9 @@ describe Onfido::Applicant do
114
114
  expect { applicant.restore(applicant_id) }.to raise_error { |error|
115
115
  expect(error).to be_a(Onfido::RequestError)
116
116
  expect(error.message).to eq('There was a validation error on this request')
117
- expect(error.fields).to eq("Applicant #{applicant_id} is not scheduled for deletion")
117
+ expect(error.fields).to eq(
118
+ "Applicant a2fb9c62-ab10-4898-a8ec-342c4b552ad5 is not scheduled for deletion"
119
+ )
118
120
  }
119
121
  end
120
122
  end
@@ -30,6 +30,50 @@ describe Onfido::Check do
30
30
  end
31
31
  end
32
32
 
33
+ describe '#find_by_url' do
34
+ let(:check_id) { '8546921-123123-123123' }
35
+
36
+ context 'partial url' do
37
+ let(:url) { "applicants/#{applicant_id}/checks/#{check_id}" }
38
+
39
+ it 'returns an existing check for the applicant with the partial url' do
40
+ response = check.find_by_url(url)
41
+ expect(response['id']).to eq(check_id)
42
+ end
43
+
44
+ it "returns unexpanded reports" do
45
+ response = check.find_by_url(url)
46
+ expect(response['reports'].first).to be_a(String)
47
+ end
48
+
49
+ it 'allows you to expand the reports' do
50
+ response = check.find_by_url(url, expand: "reports")
51
+ expect(response['reports'].first).to be_a(Hash)
52
+ end
53
+ end
54
+
55
+ context 'full url' do
56
+ let(:url) do
57
+ "https://api.onfido.com/v2/applicants/#{applicant_id}/checks/#{check_id}"
58
+ end
59
+
60
+ it 'returns an existing check for the applicant with the partial url' do
61
+ response = check.find_by_url(url)
62
+ expect(response['id']).to eq(check_id)
63
+ end
64
+
65
+ it "returns unexpanded reports" do
66
+ response = check.find_by_url(url)
67
+ expect(response['reports'].first).to be_a(String)
68
+ end
69
+
70
+ it 'allows you to expand the reports' do
71
+ response = check.find_by_url(url, expand: "reports")
72
+ expect(response['reports'].first).to be_a(Hash)
73
+ end
74
+ end
75
+ end
76
+
33
77
  describe '#all' do
34
78
  let(:check_id) { '8546921-123123-123123' }
35
79
 
@@ -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
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onfido
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pericles Theodorou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-28 00:00:00.000000000 Z
12
+ date: 2019-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.7'
20
+ version: '2.0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.7'
27
+ version: '2.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -209,6 +209,7 @@ files:
209
209
  - spec/support/fixtures/live_photos.json
210
210
  - spec/support/fixtures/live_video.json
211
211
  - spec/support/fixtures/live_videos.json
212
+ - spec/support/fixtures/not_scheduled_for_deletion_error.json
212
213
  - spec/support/fixtures/report.json
213
214
  - spec/support/fixtures/report_type_group.json
214
215
  - spec/support/fixtures/report_type_groups.json
@@ -236,8 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
237
  - !ruby/object:Gem::Version
237
238
  version: '0'
238
239
  requirements: []
239
- rubyforge_project:
240
- rubygems_version: 2.7.4
240
+ rubygems_version: 3.0.2
241
241
  signing_key:
242
242
  specification_version: 4
243
243
  summary: A wrapper for Onfido API
@@ -274,6 +274,7 @@ test_files:
274
274
  - spec/support/fixtures/live_photos.json
275
275
  - spec/support/fixtures/live_video.json
276
276
  - spec/support/fixtures/live_videos.json
277
+ - spec/support/fixtures/not_scheduled_for_deletion_error.json
277
278
  - spec/support/fixtures/report.json
278
279
  - spec/support/fixtures/report_type_group.json
279
280
  - spec/support/fixtures/report_type_groups.json