checkr-official 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Changelog.md +4 -0
- data/lib/checkr.rb +3 -0
- data/lib/checkr/version.rb +1 -1
- data/test/checkr/api_class_test.rb +79 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 75c06d4b9b7ca0f7e10ea7dacda6b01391bf5f324f4d32a5824d253b06040b25
|
4
|
+
data.tar.gz: e585ca7f37af58ba98da2e1c4c04af6207d4a32a07130ea0ad06e7e2208bed67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8f3a05d1d15e60cbb69f30a6b31335a1540f4d40a468abc8e3a986e11da5ede73bba7496e3c7724c1049d863d3af2bd75e0fd131d9ff987c468c18e31bf3fcf
|
7
|
+
data.tar.gz: aa1c480c462230f8f9b1865ea499ad7cfa460a0b163f6424938794cc56243e7b4faa0cbceef137c0a535e3e33ad6df670025d7e39ca8bce7bd4b907e85756e93
|
data/Changelog.md
CHANGED
data/lib/checkr.rb
CHANGED
data/lib/checkr/version.rb
CHANGED
@@ -48,6 +48,47 @@ module Checkr
|
|
48
48
|
:filter => 'test filter',
|
49
49
|
})
|
50
50
|
end
|
51
|
+
|
52
|
+
should 'allow passing an api_key as a param when the global api_key is set' do
|
53
|
+
response = test_response(test_mock_resource_list)
|
54
|
+
api_key = '123456'
|
55
|
+
|
56
|
+
@mock.expects(:get).with do |url, headers, params|
|
57
|
+
(url == "#{Checkr.api_base}#{MockResource.path}?page=1&filter=test%20filter" ||
|
58
|
+
url == "#{Checkr.api_base}#{MockResource.path}?filter=test%20filter&page=1") &&
|
59
|
+
params == nil &&
|
60
|
+
Checkr.api_key == 'foo'
|
61
|
+
headers["Authorization"] == "Basic #{Base64.encode64("#{api_key}:")}"
|
62
|
+
end.returns(response)
|
63
|
+
|
64
|
+
list = MockResource.all(
|
65
|
+
:page => 1,
|
66
|
+
:filter => 'test filter',
|
67
|
+
:api_key => api_key
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
should 'allow passing an api_key as a param when the global api_key is NOT set' do
|
72
|
+
response = test_response(test_mock_resource_list)
|
73
|
+
api_key = '123456'
|
74
|
+
Checkr.api_key = nil
|
75
|
+
|
76
|
+
|
77
|
+
@mock.expects(:get).with do |url, headers, params|
|
78
|
+
(url == "#{Checkr.api_base}#{MockResource.path}?page=1&filter=test%20filter" ||
|
79
|
+
url == "#{Checkr.api_base}#{MockResource.path}?filter=test%20filter&page=1") &&
|
80
|
+
params == nil &&
|
81
|
+
headers["Authorization"] == "Basic #{Base64.encode64("#{api_key}:")}"
|
82
|
+
end.returns(response)
|
83
|
+
|
84
|
+
assert_equal(Checkr.api_key, nil)
|
85
|
+
|
86
|
+
list = MockResource.all(
|
87
|
+
:page => 1,
|
88
|
+
:filter => 'test filter',
|
89
|
+
:api_key => api_key
|
90
|
+
)
|
91
|
+
end
|
51
92
|
end
|
52
93
|
|
53
94
|
context 'Making a DELETE request' do
|
@@ -60,6 +101,19 @@ module Checkr
|
|
60
101
|
end.returns(test_response({}))
|
61
102
|
mock_resource.delete(:reason => "delinquent payments")
|
62
103
|
end
|
104
|
+
|
105
|
+
should 'allow passing an api_key as a param' do
|
106
|
+
api_key = '123456'
|
107
|
+
|
108
|
+
@mock.expects(:get).once.returns(test_response(test_mock_resource))
|
109
|
+
mock_resource = MockResource.retrieve("fake_id")
|
110
|
+
|
111
|
+
@mock.expects(:delete).once.with do |url, headers, payload|
|
112
|
+
url == "#{Checkr.api_base}#{mock_resource.path}?reason=delinquent%20payments" && payload.nil? &&
|
113
|
+
headers["Authorization"] == "Basic #{Base64.encode64("#{api_key}:")}"
|
114
|
+
end.returns(test_response({}))
|
115
|
+
mock_resource.delete(:reason => "delinquent payments", :api_key => api_key)
|
116
|
+
end
|
63
117
|
end
|
64
118
|
|
65
119
|
context 'Making a PUT request' do
|
@@ -73,6 +127,20 @@ module Checkr
|
|
73
127
|
end.returns(test_response(test_mock_resource))
|
74
128
|
mock_resource.save
|
75
129
|
end
|
130
|
+
|
131
|
+
should 'allow passing an api_key as a param' do
|
132
|
+
api_key = '123456'
|
133
|
+
|
134
|
+
@mock.expects(:get).once.returns(test_response(test_mock_resource))
|
135
|
+
mock_resource = MockResource.retrieve("fake_id")
|
136
|
+
mock_resource.name = "new name"
|
137
|
+
|
138
|
+
@mock.expects(:put).once.with do |url, headers, payload|
|
139
|
+
payload == { :name => "new name"} &&
|
140
|
+
headers["Authorization"] == "Basic #{Base64.encode64("#{api_key}:")}"
|
141
|
+
end.returns(test_response(test_mock_resource))
|
142
|
+
mock_resource.save(:api_key => api_key)
|
143
|
+
end
|
76
144
|
end
|
77
145
|
|
78
146
|
context 'Making a POST request' do
|
@@ -82,6 +150,17 @@ module Checkr
|
|
82
150
|
|
83
151
|
MockResource.create(params)
|
84
152
|
end
|
153
|
+
|
154
|
+
should 'allow passing an api_key as a param' do
|
155
|
+
api_key = '123456'
|
156
|
+
|
157
|
+
@mock.expects(:post).once.with do |url, headers, payload|
|
158
|
+
url == "#{Checkr.api_base}#{MockResource.path}" && payload == { :name => "some name" } &&
|
159
|
+
headers["Authorization"] == "Basic #{Base64.encode64("#{api_key}:")}"
|
160
|
+
end.returns(test_response(test_mock_resource))
|
161
|
+
|
162
|
+
MockResource.create(:name => "some name", :api_key => api_key)
|
163
|
+
end
|
85
164
|
end
|
86
165
|
|
87
166
|
context 'APIClass :default_params' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkr-official
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Checkr Engineering Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: '0'
|
242
242
|
requirements: []
|
243
243
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.7.7
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
247
|
summary: Ruby bindings for Checkr API
|