checkr-official 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 204fa32aac332586ff0659b1c1ab5713b1cc79bf
4
- data.tar.gz: e74b3546eb997df8a6e2e05698652f517bc24060
3
+ metadata.gz: 2ccafdc7b87f315c5f14d9c79f8d12cbc701e810
4
+ data.tar.gz: e7c5657e8b647000b5affea8d230f9d1108ead92
5
5
  SHA512:
6
- metadata.gz: f3e1c06a138a2506b738f4d3b8195450a869c819eb6ac2c8546855f9c31747195d8f969ac1d2d7fef7b9499294c7306535d6901cc73595ccd68cd75cb04f99d6
7
- data.tar.gz: 3cde6c929301904aadd2f5f53a07f6236eb0826213e926d9691ce8ccb571afa7cc3ab5e204edfbf03b868269aa71265c2e88b71e73709d8df5954d3243e7c9be
6
+ metadata.gz: b8e4424123de74f5be964464c0d2bbed9e01036ae1ab35327da5e42a371910c25057f78564e566ab1d86e7e593b723d18fb710c45e88b7ad7aca2748d9ae8577
7
+ data.tar.gz: 848abe2c0c6f2989bd9e6b0ecdc62a94630c9bc772e203159ac2696497e77eaac5927cf56c970efd2ba71d7e7b546c5427617fa6f53319bd58792a111b86924a
@@ -1,3 +1,7 @@
1
+ === 1.0.1 2015-03-24
2
+ * 1 minor enchancement:
3
+ * Updated documents class to feel like other classes.
4
+
1
5
  === 1.0 2015-03-04
2
6
 
3
7
  * 1 major enhancement:
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Checkr Ruby bindings ![Travis CI Status](https://travis-ci.org/checkr/checkr-ruby.svg?branch=master)
1
+ # Checkr Ruby bindings ![Travis CI Status](https://travis-ci.org/checkr/checkr-ruby.svg?branch=master) [![Code Climate](https://codeclimate.com/github/checkr/checkr-ruby/badges/gpa.svg)](https://codeclimate.com/github/checkr/checkr-ruby)
2
2
 
3
3
 
4
4
  ## Installation
@@ -7,16 +7,24 @@ You don't need this source code unless you want to modify the gem. If
7
7
  you just want to use the Checkr Ruby bindings, you should run:
8
8
 
9
9
  ```bash
10
- gem install checkr
10
+ gem install checkr-official
11
11
  ```
12
12
 
13
13
  If you want to build the gem from source:
14
14
 
15
15
  ```bash
16
- gem build checkr.gemspec
16
+ gem build checkr-official.gemspec
17
17
  ```
18
18
 
19
19
 
20
+ If you want to include the gem in IRB you will need to require `checkr`. This naming will hopefully be cleared up if we are given ownership of the `checkr` gem on rubygems.
21
+
22
+ ```ruby
23
+ require 'checkr'
24
+ ```
25
+
26
+
27
+
20
28
  ## Requirements
21
29
 
22
30
  * Ruby 1.8.7 or above. (Ruby 1.8.6 may work if you load
@@ -40,7 +48,7 @@ rubygems source in your Gemfile, as any gems fetched over http could potentially
40
48
  source 'https://rubygems.org'
41
49
 
42
50
  gem 'rails'
43
- gem 'checkr'
51
+ gem 'checkr-official'
44
52
  ```
45
53
 
46
54
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -157,11 +157,15 @@ module Checkr
157
157
 
158
158
  def inspect
159
159
  id_string = (self.respond_to?(:id) && !self.id.nil?) ? " id=#{self.id}" : ""
160
- "#<#{self.class}:0x#{self.object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(json)
160
+ "#<#{self.class}:0x#{self.object_id.to_s(16)}#{id_string}> JSON: " + JSON.pretty_generate(attributes)
161
+ end
162
+
163
+ def to_s(*args)
164
+ JSON.pretty_generate(non_nil_attributes)
161
165
  end
162
166
 
163
167
  def to_json(*a)
164
- JSON.generate(json)
168
+ JSON.generate(non_nil_attributes)
165
169
  end
166
170
 
167
171
 
@@ -240,7 +244,7 @@ module Checkr
240
244
 
241
245
  validate_args(arg_names, *args)
242
246
  arguments = compose_arguments(method, arg_names, *args)
243
- composed_path = compose_api_path(path, arguments)
247
+ composed_path = compose_api_path(path, arguments, arguments[:params])
244
248
  unused_args = determine_unused_args(path, arg_names, arguments)
245
249
  arguments[:params] = compose_params(arguments[:params], unused_args, default_params)
246
250
 
@@ -336,7 +340,7 @@ module Checkr
336
340
  self.class.compose_arguments(method, arg_names, *args)
337
341
  end
338
342
 
339
- def self.compose_api_path(path, arguments, this=self)
343
+ def self.compose_api_path(path, arguments, params={}, this=self)
340
344
  # Setup the path using the following attribute order:
341
345
  # 1. Args passed in
342
346
  # 2. Args on this
@@ -347,6 +351,7 @@ module Checkr
347
351
  matches = ret.scan(/:([^\/]*)/).flatten.map(&:to_sym)
348
352
  matches.each do |match|
349
353
  value = arguments[match]
354
+ value ||= params[match] || params[match.to_s]
350
355
  begin
351
356
  value ||= this.send(match)
352
357
  rescue NoMethodError
@@ -369,8 +374,8 @@ module Checkr
369
374
  end
370
375
  ret
371
376
  end
372
- def compose_api_path(path, arguments)
373
- self.class.compose_api_path(path, arguments, self)
377
+ def compose_api_path(path, arguments, params={})
378
+ self.class.compose_api_path(path, arguments, params, self)
374
379
  end
375
380
 
376
381
  def self.determine_unused_args(path, arg_names, arguments, this=self)
@@ -6,6 +6,9 @@ module Checkr
6
6
  attribute :filename
7
7
  attribute :content_type
8
8
 
9
+ api_class_method :all, :get, "/v1/candidates/:candidate_id/documents", :constructor => :DocumentList
10
+ api_class_method :create, :post, "/v1/candidates/:candidate_id/documents"
11
+
9
12
  # Method #create and #all are all on the Candidate instance
10
13
 
11
14
  APIClass.register_subclass(self, "document")
@@ -0,0 +1,195 @@
1
+ # Candidate
2
+
3
+ ## The Candidate Object
4
+
5
+ ### Example Response
6
+
7
+ ```ruby
8
+ #<Checkr::Candidate:0x3fd909a22584 id=e44aa283528e6fde7d542194> JSON: {
9
+ "first_name": "John",
10
+ "middle_name": "Alfred",
11
+ "last_name": "Smith",
12
+ "email": "john.smith@gmail.com",
13
+ "phone": null,
14
+ "zipcode": "90401",
15
+ "dob": "1970-01-22",
16
+ "ssn": "XXX-XX-4645",
17
+ "driver_license_number": "F211165",
18
+ "driver_license_state": "CA",
19
+ "previous_driver_license_number": null,
20
+ "previous_driver_license_state": null,
21
+ "copy_requested": false,
22
+ "custom_id": null,
23
+ "reports": {"object":"list","data":[{"id":"4722c07dd9a10c3985ae432a"}, ...]},
24
+ "geos": {"object":"list","data":[]},
25
+ "adjudication": null,
26
+ "documents": {"object":"list","data":[]},
27
+ "id": "e44aa283528e6fde7d542194",
28
+ "object": "test_candidate",
29
+ "uri": "/v1/candidates/e44aa283528e6fde7d542194",
30
+ "created_at": "2014-06-17T05:55:47Z"
31
+ }
32
+ ```
33
+
34
+
35
+
36
+ ## Create a new Candidate
37
+
38
+ ### Definition
39
+
40
+ ```ruby
41
+ Checkr::Candidate.create
42
+ ```
43
+
44
+ ### Example Request
45
+
46
+ ```ruby
47
+ require 'checkr' # Note the gem is named checkr-official
48
+ Checkr.api_key = "83ebeabdec09f6670863766f792ead24d61fe3f9"
49
+
50
+ candidate = Checkr::Candidate.create({
51
+ :first_name => "John",
52
+ :middle_name => "Alfred",
53
+ :last_name => "Smith",
54
+ :email => "john.smith@gmail.com",
55
+ :phone => "5555555555",
56
+ :zipcode => "90401",
57
+ :dob => "1970-01-22",
58
+ :ssn => "543-43-4645",
59
+ :driver_license_number => "F211165",
60
+ :driver_license_state => "CA"
61
+ })
62
+ ```
63
+
64
+ ### Example Response
65
+
66
+ ```ruby
67
+ #<Checkr::Candidate:0x3fd909a14cb8 id=25a317218b8c3254cec8ccfb> JSON: {
68
+ "first_name": "John",
69
+ "middle_name": "Alfred",
70
+ "last_name": "Smith",
71
+ "email": "john.smith@gmail.com",
72
+ "phone": "5555555555",
73
+ "zipcode": "90401",
74
+ "dob": "1970-01-22",
75
+ "ssn": "XXX-XX-4645",
76
+ "driver_license_number": "F211165",
77
+ "driver_license_state": "CA",
78
+ "previous_driver_license_number": null,
79
+ "previous_driver_license_state": null,
80
+ "copy_requested": false,
81
+ "custom_id": null,
82
+ "reports": {"object":"list","data":[]},
83
+ "geos": {"object":"list","data":[]},
84
+ "adjudication": null,
85
+ "documents": {"object":"list","data":[]},
86
+ "id": "25a317218b8c3254cec8ccfb",
87
+ "object": "test_candidate",
88
+ "uri": "/v1/candidates/25a317218b8c3254cec8ccfb",
89
+ "created_at": "2015-03-24T20:44:26Z"
90
+ }
91
+ ```
92
+
93
+
94
+
95
+ ## Retrieve an existing Candidate
96
+
97
+ ### Definition
98
+
99
+ ```ruby
100
+ Checkr::Candidate.retrieve({CANDIDATE_ID})
101
+ ```
102
+
103
+ ### Example Request
104
+
105
+ ```ruby
106
+ require 'checkr' # Note the gem is named checkr-official
107
+ Checkr.api_key = "83ebeabdec09f6670863766f792ead24d61fe3f9"
108
+
109
+ candidate = Checkr::Candidate.retrieve("e44aa283528e6fde7d542194")
110
+ ```
111
+
112
+ ### Example Response
113
+
114
+ ```ruby
115
+ #<Checkr::Candidate:0x3fd909a22584 id=e44aa283528e6fde7d542194> JSON: {
116
+ "first_name": "John",
117
+ "middle_name": "Alfred",
118
+ "last_name": "Smith",
119
+ "email": "john.smith@gmail.com",
120
+ "phone": null,
121
+ "zipcode": "90401",
122
+ "dob": "1970-01-22",
123
+ "ssn": "XXX-XX-4645",
124
+ "driver_license_number": "F211165",
125
+ "driver_license_state": "CA",
126
+ "previous_driver_license_number": null,
127
+ "previous_driver_license_state": null,
128
+ "copy_requested": false,
129
+ "custom_id": null,
130
+ "reports": {"object":"list","data":[{"id":"4722c07dd9a10c3985ae432a"}, ...]},
131
+ "geos": {"object":"list","data":[]},
132
+ "adjudication": null,
133
+ "documents": {"object":"list","data":[]},
134
+ "id": "e44aa283528e6fde7d542194",
135
+ "object": "test_candidate",
136
+ "uri": "/v1/candidates/e44aa283528e6fde7d542194",
137
+ "created_at": "2014-06-17T05:55:47Z"
138
+ }
139
+ ```
140
+
141
+
142
+ ## List existing Candidates
143
+
144
+ ### Definition
145
+
146
+ ```ruby
147
+ Checkr::Candidate.all
148
+ ```
149
+
150
+ ### Example Request
151
+
152
+ ```ruby
153
+ require 'checkr' # Note the gem is named checkr-official
154
+ Checkr.api_key = "83ebeabdec09f6670863766f792ead24d61fe3f9"
155
+
156
+ candidates = Checkr::Candidate.all({
157
+ :created_after => "2015-03-23"
158
+ })
159
+ ```
160
+
161
+ ### Example Response
162
+
163
+ ```ruby
164
+ #<Checkr::APIList:0x3ffc490506b0> JSON: {
165
+ "object": "list",
166
+ "data": [
167
+ #<Checkr::Candidate:0x3ff176151ca4 id=6be8ba695388837cb74bcc50> JSON: {
168
+ "first_name": "John",
169
+ "last_name": "Smith",
170
+ "email": "john@smith.org",
171
+ "phone": "5555555555",
172
+ "dob": "1970-01-22",
173
+ "ssn": "XXX-XX-6789",
174
+ "copy_requested": false,
175
+ "reports": {
176
+ "object": "list",
177
+ "data": []
178
+ },
179
+ "geos": {
180
+ "object": "list",
181
+ "data": []
182
+ },
183
+ "documents": {
184
+ "object": "list",
185
+ "data": []
186
+ },
187
+ "id": "6be8ba695388837cb74bcc50",
188
+ "object": "test_candidate",
189
+ "uri": "/v1/candidates/6be8ba695388837cb74bcc50",
190
+ "created_at": "2015-03-23T11:24:18Z"
191
+ },
192
+ ...
193
+ ]
194
+ }
195
+ ```
@@ -0,0 +1,60 @@
1
+ # County Criminal Search
2
+
3
+ ## The County Criminal Search Object
4
+
5
+ ### Example Response
6
+
7
+ ```ruby
8
+ #<Checkr::CountyCriminalSearch:0x3fd909bcd974 id=539fdcf335644a0ef4000001> JSON: {
9
+ "status": "pending",
10
+ "completed_at": null,
11
+ "turnaround_time": null,
12
+ "county": "San Francisco",
13
+ "state": "CA",
14
+ "records": [
15
+
16
+ ],
17
+ "id": "539fdcf335644a0ef4000001",
18
+ "object": "test_county_criminal_search",
19
+ "uri": "/v1/county_criminal_searches/539fdcf335644a0ef4000001",
20
+ "created_at": "2014-06-17T06:15:47Z"
21
+ }
22
+ ```
23
+
24
+
25
+
26
+ ## Retrieve an existing County Criminal Search
27
+
28
+ ### Definition
29
+
30
+ ```ruby
31
+ Checkr::CountyCriminalSearch.retrieve({COUNTY_CRIMINAL_SEARCH_ID})
32
+ ```
33
+
34
+ ### Example Request
35
+
36
+ ```ruby
37
+ require 'checkr' # Note the gem is named checkr-official
38
+ Checkr.api_key = "83ebeabdec09f6670863766f792ead24d61fe3f9"
39
+
40
+ ccs = Checkr::CountyCriminalSearch.retrieve("539fdcf335644a0ef4000001")
41
+ ```
42
+
43
+ ### Example Response
44
+
45
+ ```ruby
46
+ #<Checkr::CountyCriminalSearch:0x3fd909bcd974 id=539fdcf335644a0ef4000001> JSON: {
47
+ "status": "pending",
48
+ "completed_at": null,
49
+ "turnaround_time": null,
50
+ "county": "San Francisco",
51
+ "state": "CA",
52
+ "records": [
53
+
54
+ ],
55
+ "id": "539fdcf335644a0ef4000001",
56
+ "object": "test_county_criminal_search",
57
+ "uri": "/v1/county_criminal_searches/539fdcf335644a0ef4000001",
58
+ "created_at": "2014-06-17T06:15:47Z"
59
+ }
60
+ ```
@@ -0,0 +1,109 @@
1
+ # Document
2
+
3
+ ## The Document Object
4
+
5
+ ### Example Response
6
+
7
+ ```ruby
8
+ #<Checkr::Document:0x3fd90aa3e10c id=e9293aac1d008123627c398f> JSON: {
9
+ "download_uri": "https://checkr-documents.s3.amazonaws.com/candidates/e44aa283528e6fde7d542194/1427231857_mclovin.jpg?AWSAccessKeyId=AKIAJVBH7HZTOFURSXYQ&Expires=1427235458&Signature=7LPgGkve9SPnaMqozkV9%2BlL6luw%3D",
10
+ "filesize": 37291,
11
+ "filename": "1427231857_mclovin.jpg",
12
+ "content_type": "image/jpeg",
13
+ "id": "e9293aac1d008123627c398f",
14
+ "object": "document",
15
+ "uri": null,
16
+ "created_at": "2015-03-24T21:17:38Z"
17
+ }
18
+ ```
19
+
20
+
21
+
22
+ ## Create a new Document
23
+
24
+ ### Definition
25
+
26
+ ```ruby
27
+ candidate = Checkr::Candidate.retrieve({CANDIDATE_ID})
28
+ candidate.documents.create
29
+ ```
30
+
31
+ ### Example Request
32
+
33
+ ```ruby
34
+ require 'checkr' # Note the gem is named checkr-official
35
+ Checkr.api_key = "83ebeabdec09f6670863766f792ead24d61fe3f9"
36
+
37
+ candidate = Checkr::Candidate.retrieve("e44aa283528e6fde7d542194")
38
+ document = Checkr::Document.create({
39
+ :candidate_id => candidate.id,
40
+ :type => "driver_license",
41
+ :file => File.open("./mclovin.jpg")
42
+ })
43
+ ```
44
+
45
+ ### Example Response
46
+
47
+ ```ruby
48
+ #<Checkr::Document:0x3fd90aa3e10c id=e9293aac1d008123627c398f> JSON: {
49
+ "download_uri": "https://checkr-documents.s3.amazonaws.com/candidates/e44aa283528e6fde7d542194/1427231857_mclovin.jpg?AWSAccessKeyId=AKIAJVBH7HZTOFURSXYQ&Expires=1427235458&Signature=7LPgGkve9SPnaMqozkV9%2BlL6luw%3D",
50
+ "filesize": 37291,
51
+ "filename": "1427231857_mclovin.jpg",
52
+ "content_type": "image/jpeg",
53
+ "id": "e9293aac1d008123627c398f",
54
+ "object": "document",
55
+ "uri": null,
56
+ "created_at": "2015-03-24T21:17:38Z"
57
+ }
58
+ ```
59
+
60
+
61
+
62
+
63
+
64
+ ## List a Candidate's Documents
65
+
66
+ ### Definition
67
+
68
+ ```ruby
69
+ candidate = Checkr::Candidate.retrieve({CANDIDATE_ID})
70
+ Checkr::Document.all({
71
+ :candidate => candidate.id
72
+ })
73
+ ```
74
+
75
+ ### Example Request
76
+
77
+ ```ruby
78
+ require 'checkr' # Note the gem is named checkr-official
79
+ Checkr.api_key = "83ebeabdec09f6670863766f792ead24d61fe3f9"
80
+
81
+ candidate = Checkr::Candidate.retrieve("e44aa283528e6fde7d542194")
82
+ documents = Checkr::Document.all({
83
+ :candidate_id => candidate.id
84
+ })
85
+ ```
86
+
87
+ ### Example Response
88
+
89
+ ```ruby
90
+ #<Checkr::DocumentList:0x3fd90a9bb93c> JSON: {
91
+ "next_href": null,
92
+ "previous_href": null,
93
+ "count": 4,
94
+ "object": "list",
95
+ "data": [
96
+ #<Checkr::Document:0x3fd909fa1320 id=a89c96f8ae80b961900ca8a3> JSON: {
97
+ "download_uri": "https://checkr-documents.s3.amazonaws.com/candidates/e44aa283528e6fde7d542194/1423684869_test.jpg?AWSAccessKeyId=AKIAJVBH7HZTOFURSXYQ&Expires=1427236003&Signature=kOYFewxbFn1%2FstvXEX1Y0V51sHY%3D",
98
+ "filesize": 8576,
99
+ "filename": "1423684869_test.jpg",
100
+ "content_type": "image/jpeg",
101
+ "id": "a89c96f8ae80b961900ca8a3",
102
+ "object": "document",
103
+ "uri": null,
104
+ "created_at": "2015-02-11T20:01:10Z"
105
+ },
106
+ ...
107
+ ]
108
+ }
109
+ ```