onfido 0.5.0 → 0.6.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
  SHA1:
3
- metadata.gz: bcac6af9dc80518231e80efa12112ef00086d6d4
4
- data.tar.gz: e557c29b2dc8565d3442bffc3f088dd497d8d467
3
+ metadata.gz: 9e6b62644e597c30a6baae2efd01abf4867c7345
4
+ data.tar.gz: a1c16d4de9eaac5018022c09fda175b9a6dc2daf
5
5
  SHA512:
6
- metadata.gz: 7345b7bbf23647ca8322ebbf30876f3bbe38bc5f2d90826cdc28f2764a70153fc6e42024f1763226aceb12a12e8cd8cc155a715de7d5a4e4216584e6a72549a3
7
- data.tar.gz: 613ec094ccec7f7b63a7c1e6a5c4dbc71a23526969b4dff0930a18aa87e2a733ce92e3aa5f7635c0caf50fc4b6ce0b61dfe0f9fe7dee4c67548017a937d344b7
6
+ metadata.gz: 4a2fda0f29284247ae819b70293ffc44b7e92126d2344b29f0553102fc00abc965f46bddfc4386ee10fefbd495c30d94d40f2069100fc1d5bf11e8a14d354429
7
+ data.tar.gz: 9580b28bacaaa10d9b7efa62178324570c74c0de4b7abaa8f998f4ed5dbd391598d390f80d5e83f68d1a7859f45d967c2434c1d1fccde309bc767eaa357f0d88
@@ -1,3 +1,8 @@
1
+ ## v0.6.0, 7 July 2016
2
+
3
+ - Add `expand` option to `Onfido::Check.find` and `Onfido::Check.all`. See
4
+ https://github.com/hvssle/onfido/pull/11 for details.
5
+
1
6
  ## v0.5.0, 7 June 2016
2
7
 
3
8
  - Add `Onfido::Webhook.valid?` method, for checking the signature of a webhook
@@ -7,12 +7,15 @@ module Onfido
7
7
  )
8
8
  end
9
9
 
10
- def find(applicant_id, check_id)
11
- get(url: url_for("applicants/#{applicant_id}/checks/#{check_id}"))
10
+ def find(applicant_id, check_id, expand: nil)
11
+ querystring = "&expand=#{expand}" if expand
12
+ get(url: url_for("applicants/#{applicant_id}/checks/#{check_id}?" \
13
+ "#{querystring}"))
12
14
  end
13
15
 
14
- def all(applicant_id, page: 1, per_page: 20)
16
+ def all(applicant_id, page: 1, per_page: 20, expand: nil)
15
17
  querystring = "page=#{page}&per_page=#{per_page}"
18
+ querystring += "&expand=#{expand}" if expand
16
19
  get(url: url_for("applicants/#{applicant_id}/checks?#{querystring}"))
17
20
  end
18
21
  end
@@ -1,3 +1,3 @@
1
1
  module Onfido
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
@@ -18,6 +18,16 @@ describe Onfido::Check do
18
18
  response = check.find(applicant_id, check_id)
19
19
  expect(response['id']).to eq(check_id)
20
20
  end
21
+
22
+ it "returns unexpanded reports" do
23
+ response = check.find(applicant_id, check_id)
24
+ expect(response['reports'].first).to be_a(String)
25
+ end
26
+
27
+ it 'allows you to expand the reports' do
28
+ response = check.find(applicant_id, check_id, expand: "reports")
29
+ expect(response['reports'].first).to be_a(Hash)
30
+ end
21
31
  end
22
32
 
23
33
  describe '#all' do
@@ -29,5 +39,15 @@ describe Onfido::Check do
29
39
  expect(response['checks'].size).to eq(1)
30
40
  end
31
41
  end
42
+
43
+ it "returns unexpanded reports" do
44
+ response = check.all(applicant_id)
45
+ expect(response['checks'].first['reports'].first).to be_a(String)
46
+ end
47
+
48
+ it 'allows you to expand the reports' do
49
+ response = check.all(applicant_id, expand: "reports")
50
+ expect(response['checks'].first['reports'].first).to be_a(Hash)
51
+ end
32
52
  end
33
53
  end
@@ -31,11 +31,20 @@ class FakeOnfidoAPI < Sinatra::Base
31
31
  end
32
32
 
33
33
  get '/v2/applicants/:id/checks/:id' do
34
- json_response(200, 'check.json')
34
+ if params["expand"] == "reports"
35
+ json_response(200, "check_with_expanded_reports.json")
36
+ else
37
+ json_response(200, "check.json")
38
+ end
35
39
  end
36
40
 
37
41
  get '/v2/applicants/:id/checks' do
38
- response = json_response(200, 'checks.json')
42
+ response = if params["expand"] == "reports"
43
+ json_response(200, "checks_with_expanded_reports.json")
44
+ else
45
+ json_response(200, "checks.json")
46
+ end
47
+
39
48
  { checks: JSON.parse(response)['checks'][pagination_range] }.to_json
40
49
  end
41
50
 
@@ -6,25 +6,7 @@
6
6
  "status": "pending",
7
7
  "result": "pending",
8
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
- }
9
+ "1030303-123123-375629",
10
+ "1030303-123123-456789"
29
11
  ]
30
12
  }
@@ -0,0 +1,30 @@
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
+ }
@@ -8,26 +8,8 @@
8
8
  "status": "pending",
9
9
  "result": "pending",
10
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
- }
11
+ "1030303-123123-375629",
12
+ "1030303-123123-456789"
31
13
  ]
32
14
  }
33
15
  ]
@@ -0,0 +1,34 @@
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
+ }
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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pericles Theodorou
@@ -9,118 +9,118 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-07 00:00:00.000000000 Z
12
+ date: 2016-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.7'
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
27
  version: '1.7'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '10.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: webmock
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '1.22'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.22'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rubocop
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: 0.37.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: 0.37.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '3.1'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '3.1'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec-its
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: '1.2'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: '1.2'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: sinatra
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ~>
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
104
  version: '1.4'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '1.4'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: rest-client
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ~>
116
+ - - "~>"
117
117
  - !ruby/object:Gem::Version
118
118
  version: 1.8.0
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ~>
123
+ - - "~>"
124
124
  - !ruby/object:Gem::Version
125
125
  version: 1.8.0
126
126
  description: A wrapper for Onfido API
@@ -131,10 +131,10 @@ executables: []
131
131
  extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
- - .gitignore
135
- - .rspec
136
- - .rubocop.yml
137
- - .travis.yml
134
+ - ".gitignore"
135
+ - ".rspec"
136
+ - ".rubocop.yml"
137
+ - ".travis.yml"
138
138
  - CHANGELOG.md
139
139
  - Gemfile
140
140
  - LICENSE
@@ -177,7 +177,9 @@ files:
177
177
  - spec/support/fixtures/applicant.json
178
178
  - spec/support/fixtures/applicants.json
179
179
  - spec/support/fixtures/check.json
180
+ - spec/support/fixtures/check_with_expanded_reports.json
180
181
  - spec/support/fixtures/checks.json
182
+ - spec/support/fixtures/checks_with_expanded_reports.json
181
183
  - spec/support/fixtures/document.json
182
184
  - spec/support/fixtures/live_photo.json
183
185
  - spec/support/fixtures/report.json
@@ -195,17 +197,17 @@ require_paths:
195
197
  - lib
196
198
  required_ruby_version: !ruby/object:Gem::Requirement
197
199
  requirements:
198
- - - '>='
200
+ - - ">="
199
201
  - !ruby/object:Gem::Version
200
202
  version: '0'
201
203
  required_rubygems_version: !ruby/object:Gem::Requirement
202
204
  requirements:
203
- - - '>='
205
+ - - ">="
204
206
  - !ruby/object:Gem::Version
205
207
  version: '0'
206
208
  requirements: []
207
209
  rubyforge_project:
208
- rubygems_version: 2.2.2
210
+ rubygems_version: 2.5.1
209
211
  signing_key:
210
212
  specification_version: 4
211
213
  summary: A wrapper for Onfido API
@@ -229,7 +231,9 @@ test_files:
229
231
  - spec/support/fixtures/applicant.json
230
232
  - spec/support/fixtures/applicants.json
231
233
  - spec/support/fixtures/check.json
234
+ - spec/support/fixtures/check_with_expanded_reports.json
232
235
  - spec/support/fixtures/checks.json
236
+ - spec/support/fixtures/checks_with_expanded_reports.json
233
237
  - spec/support/fixtures/document.json
234
238
  - spec/support/fixtures/live_photo.json
235
239
  - spec/support/fixtures/report.json