checkr-official 1.6 → 1.7

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: 2bb95db1be17c9c05e0f7eb6d0b5c59aa55364d2
4
- data.tar.gz: 325812ecf94da8c71d312ed9e69c68f6cb831cd0
3
+ metadata.gz: 419e5c8590cb5750264886e813b59c9ff657822c
4
+ data.tar.gz: 39e5119e18ee5fae44a5860e6a1047478fd02107
5
5
  SHA512:
6
- metadata.gz: e42cb13af6da89f838ba1266ed3bdd1676e65ee818b84f3083e9818ae8071e0ffb3f66f9fde795b5366c505772c6f9f3d2f71a48c592a8aa1f465d13b074094b
7
- data.tar.gz: 2a99458a7b72b23f518923d5307333c63ca34c51b375c42ee9d11d14b6b6e419476fb47f9f04cc1c2a64d4cbca5b78d239a0add2f7d6afc8c3b9d5b39222e2e2
6
+ metadata.gz: de81030f52a846f734c189af6e67b158345fc9e868e0e57e47b25feeb0e5972e268062048723790a73edddb3d139fff80428a892e9aa1a10e21f33ac70bc53fa
7
+ data.tar.gz: 48c1a067f7eb082670ff9d4ffcf036bc35c1f61bab9103b2a5b96c056f862ad6fbd6ed116af0f718644ad87d9f124460bcef098a06fa00db5aed5197300323e8
@@ -1,6 +1,13 @@
1
+ ## 1.6.1 (2019-07-16)
2
+
3
+ Features:
4
+
5
+ - Add Adverse Action resource
6
+ - Add Adverse Item resource
7
+
1
8
  ## 1.6 (2019-05-20)
2
9
 
3
- - Add State CriminalSearch
10
+ - Add State Criminal Search
4
11
  - Add Employment Verification
5
12
 
6
13
  ## v1.5.4 (2018-12-10)
@@ -0,0 +1,20 @@
1
+ # Releasing a new version of checkr-official
2
+
3
+ ## Release process
4
+
5
+ 1. Create a list of all the changes since the prior release
6
+ 1. Compare the latest release to master using
7
+ https://github.com/checkr/checkr-ruby/compare/`${latest}`...master
8
+ 1. Open the linked pull requests from all the `Merge pull request #...` commits
9
+ 1. For all non-documentation PRs, copy title (including pull request number)
10
+ into markdown list items
11
+ 1. Sort into logical buckets, like "New", "Improvement", "Fix"
12
+ 1. Reorganize to put the pull request number at the end of the line with author in parenthesis
13
+ 1. Ensure there are no breaking changes, or if there are breaking changes you'll need to bump
14
+ the major version, following [SemVer](https://semver.org/)
15
+ 1. Update the version
16
+ 1. Update the constant in `lib/checkr/version.rb`
17
+ 1. Commit and push to your branch
18
+ 1. Get it reviewed and merge to master
19
+ 1. Move to master branch and pull last version
20
+ 1. Run the `bin/release` script to cut a release
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bash
2
+ # Usage: bin/release
3
+ # Build the gem, tag master, push it to origin, and then release the package on RubyGems.
4
+
5
+ set -e
6
+
7
+ branch="$(git rev-parse --abbrev-ref HEAD)"
8
+ [ "$branch" = "master" ] ||
9
+ (echo "You are not on master. First push your branch, get your PR reviewed, merge it on Github. "\
10
+ "Then locally move to master and pull last changes." && exit 1)
11
+
12
+ version="$(gem build *.gemspec | grep Version: | awk '{print $2}')"
13
+ [ -n "$version" ] || (echo "Version needs to be a number" && exit 1)
14
+
15
+ echo $version
16
+ git tag "v$version"
17
+ git push origin "v$version"
18
+ gem push *-${version}.gem
@@ -18,6 +18,9 @@ require 'checkr/api_list'
18
18
  require 'checkr/util'
19
19
 
20
20
  # Requires for classes
21
+ require 'checkr/adverse_action'
22
+ require 'checkr/adverse_item'
23
+ require 'checkr/adverse_item_list'
21
24
  require 'checkr/candidate'
22
25
  require 'checkr/county_criminal_search'
23
26
  require 'checkr/document'
@@ -0,0 +1,23 @@
1
+ module Checkr
2
+ class AdverseAction < APIResource
3
+ attribute :status
4
+ attribute :report_id
5
+ attribute :post_notice_scheduled_at
6
+ attribute :post_notice_ready_at
7
+ attribute :canceled_at
8
+ attribute :individualized_assessment_engaged
9
+ attribute :adverse_items, APIList.constructor(:AdverseItem)
10
+
11
+ api_class_method :create, :post, '/v1/reports/:report_id/adverse_actions'
12
+ api_class_method :retrieve, :get, ':path/:id', :arguments => [:id]
13
+ api_class_method :cancel, :delete, ':path/:id', :arguments => [:id]
14
+
15
+ api_instance_method :cancel, :delete
16
+
17
+ def self.path
18
+ '/v1/adverse_actions'
19
+ end
20
+
21
+ APIClass.register_subclass(self, 'adverse_action')
22
+ end
23
+ end
@@ -0,0 +1,9 @@
1
+ module Checkr
2
+ class AdverseItem < APIResource
3
+ attribute :text
4
+
5
+ api_class_method :all, :get, '/v1/reports/:report_id/adverse_items', :constructor => :AdverseItemList
6
+
7
+ APIClass.register_subclass(self, 'adverse_item')
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ module Checkr
2
+ class AdverseItemList < APIList
3
+
4
+ attribute :next_href
5
+ attribute :previous_href
6
+ attribute :count
7
+ attr_accessor :parent
8
+
9
+ api_instance_method :all, :get
10
+
11
+ def self.construct(json, parent=nil)
12
+ lambda = constructor(:AdverseItem)
13
+ instance = lambda.call(json)
14
+ instance.parent = parent if parent
15
+ instance.clear_changed_attributes
16
+ instance
17
+ end
18
+
19
+ def path
20
+ parent.path + '/adverse_items'
21
+ end
22
+
23
+ end
24
+ end
@@ -11,6 +11,9 @@ module Checkr
11
11
  attribute :candidate, :Candidate
12
12
  attribute_writer_alias :candidate_id, :candidate
13
13
 
14
+ attribute :adverse_items, :AdverseItemList, :nested => true, :default => {}
15
+ attribute_writer_alias :adverse_item_ids, :adverse_items
16
+
14
17
  attribute :ssn_trace, :SSNTrace
15
18
  attribute_writer_alias :ssn_trace_id, :ssn_trace
16
19
 
@@ -1,3 +1,3 @@
1
1
  module Checkr
2
- VERSION = '1.6'.freeze
2
+ VERSION = '1.7'.freeze
3
3
  end
@@ -0,0 +1,91 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Checkr
4
+ class AdverseActionTest < Test::Unit::TestCase
5
+ setup do
6
+ @adverse_action_url = "#{Checkr.api_base}#{AdverseAction.path}"
7
+ end
8
+
9
+ should 'be registered' do
10
+ assert(APIClass.subclasses.include?(AdverseAction))
11
+ assert_equal(AdverseAction, APIClass.subclass_fetch('adverse_action'))
12
+ end
13
+
14
+ context 'Constructed AdverseAction instance' do
15
+ setup do
16
+ @adverse_action = AdverseAction.construct(test_adverse_action)
17
+ end
18
+
19
+ [
20
+ :id,
21
+ :object,
22
+ :uri,
23
+ :created_at,
24
+ :status,
25
+ :report_id,
26
+ :post_notice_scheduled_at,
27
+ :post_notice_ready_at,
28
+ :canceled_at,
29
+ :individualized_assessment_engaged,
30
+ ].each do |attribute|
31
+ should "have the #{attribute.to_s} attribute" do
32
+ assert_equal(test_adverse_action[attribute], @adverse_action.public_send(attribute))
33
+ end
34
+ end
35
+ end
36
+
37
+ context '.create' do
38
+ setup do
39
+ @report = Report.construct(test_report)
40
+ @create_url = "#{Checkr.api_base}#{Report.path}/#{@report.id}/adverse_actions"
41
+ end
42
+
43
+ should 'creates an instance of AdverseAction' do
44
+ @mock.expects(:post).once.with(@create_url, anything, anything)
45
+ .returns(test_response(test_adverse_action))
46
+
47
+ adverse_action = AdverseAction.create({ :report_id => @report.id })
48
+
49
+ assert(adverse_action.is_a?(AdverseAction))
50
+ assert_equal(test_adverse_action[:id], adverse_action.id)
51
+ end
52
+ end
53
+
54
+ context '.retrieve' do
55
+ setup do
56
+ @id = test_adverse_action[:id]
57
+ @retrieve_url = "#{Checkr.api_base}#{AdverseAction.path}/#{@id}"
58
+ end
59
+
60
+ should 'fetches an instance of AdverseAction' do
61
+ @mock.expects(:get).once.with(@retrieve_url, anything, anything)
62
+ .returns(test_response(test_adverse_action))
63
+
64
+ adverse_action = AdverseAction.retrieve(@id)
65
+
66
+ assert(adverse_action.is_a?(AdverseAction))
67
+ assert_equal(@id, adverse_action.id)
68
+ end
69
+ end
70
+
71
+ context '#cancel/.cancel' do
72
+ setup do
73
+ @id = test_adverse_action[:id]
74
+ @cancel_url = "#{Checkr.api_base}#{AdverseAction.path}/#{@id}"
75
+ end
76
+
77
+ should 'cancels an instance of AdverseAction' do
78
+ @mock.expects(:delete).twice.with(@cancel_url, anything, anything)
79
+ .returns(test_response(test_adverse_action))
80
+
81
+ adverse_action = AdverseAction.cancel(@id)
82
+ assert(adverse_action.is_a?(AdverseAction))
83
+ assert_equal(@id, adverse_action.id)
84
+
85
+ adverse_action = AdverseAction.new(@id).cancel
86
+ assert(adverse_action.is_a?(AdverseAction))
87
+ assert_equal(@id, adverse_action.id)
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Checkr
4
+ class AdverseItemTest < Test::Unit::TestCase
5
+ setup do
6
+ @report = Report.construct(test_report)
7
+ @adverse_item_url = "#{Checkr.api_base}#{@report.path}/adverse_items"
8
+ end
9
+
10
+ context 'Constructed AdverseItem instance' do
11
+ setup do
12
+ @adverse_item = AdverseItem.construct(test_adverse_item)
13
+ end
14
+
15
+ [
16
+ :id,
17
+ :object,
18
+ :uri,
19
+ :created_at,
20
+ :text,
21
+ ].each do |attribute|
22
+ should "have the #{attribute.to_s} attribute" do
23
+ assert_equal(test_adverse_item[attribute], @adverse_item.public_send(attribute))
24
+ end
25
+ end
26
+ end
27
+
28
+ context '.all' do
29
+ should 'return instances of AdverseItem' do
30
+ @mock.expects(:get).once.with do |url, params, opts|
31
+ url.start_with?(@adverse_item_url)
32
+ end.returns(test_response(test_adverse_item_list))
33
+
34
+ adverse_items = AdverseItem.all({ :report_id => @report.id })
35
+
36
+ assert(adverse_items.is_a?(AdverseItemList))
37
+ assert(adverse_items.length > 0)
38
+ adverse_items.each do |adverse_item|
39
+ assert(adverse_item.is_a?(AdverseItem))
40
+ end
41
+ end
42
+ end
43
+
44
+ should 'be registered' do
45
+ assert(APIClass.subclasses.include?(AdverseItem))
46
+ assert_equal(AdverseItem, APIClass.subclass_fetch('adverse_item'))
47
+ end
48
+ end
49
+ end
@@ -513,6 +513,7 @@ module Checkr
513
513
  :type=>"driver_license",
514
514
  :content_type=>"image/jpeg"}
515
515
  end
516
+
516
517
  def test_document_list
517
518
  {
518
519
  :object => 'list',
@@ -528,6 +529,7 @@ module Checkr
528
529
  :verification_url=>"http://verifications.checkr.com/db313e73383710d4fa2f18fd",
529
530
  :completed_at=>nil}
530
531
  end
532
+
531
533
  def test_verification_list
532
534
  {
533
535
  :object => 'list',
@@ -535,6 +537,46 @@ module Checkr
535
537
  }
536
538
  end
537
539
 
540
+ def test_adverse_item
541
+ {
542
+ :id => '71c0c2c79349c9f899bda22d3ccf60b7e0469266',
543
+ :object => 'adverse_item',
544
+ :text => 'License status: Suspended',
545
+ }
546
+ end
547
+
548
+ def test_adverse_item_list
549
+ {
550
+ :object => 'list',
551
+ :count => 2,
552
+ :data => [test_adverse_item, test_adverse_item],
553
+ }
554
+ end
555
+
556
+ def test_adverse_action
557
+ {
558
+ :id => '5d0af2cdfccff00034be49e9',
559
+ :object => 'adverse_action',
560
+ :uri => '/v1/adverse_actions/5d0af2cdfccff00034be49e9',
561
+ :created_at => '2019-06-20T02:43:25Z',
562
+ :status => 'pending',
563
+ :report_id => 'd36abda710bde8fd2c9d2587',
564
+ :post_notice_scheduled_at => '2019-06-27T02:43:25Z',
565
+ :post_notice_ready_at => '2019-06-27T02:43:25Z',
566
+ :canceled_at => nil,
567
+ :individualized_assessment_engaged => false,
568
+ :adverse_items => test_adverse_item_list,
569
+ }
570
+ end
571
+
572
+ def test_adverse_action_list
573
+ {
574
+ :object => 'list',
575
+ :count => 2,
576
+ :data => [test_adverse_action, test_adverse_action],
577
+ }
578
+ end
579
+
538
580
  def test_education_verification
539
581
  {:id => "5af5e030d24297006cce1e06",
540
582
  :object => "education_verification",
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.6'
4
+ version: '1.7'
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: 2019-05-20 00:00:00.000000000 Z
11
+ date: 2019-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -128,6 +128,7 @@ email:
128
128
  - eng@checkr.com
129
129
  executables:
130
130
  - checkr-console
131
+ - release
131
132
  extensions: []
132
133
  extra_rdoc_files: []
133
134
  files:
@@ -138,10 +139,15 @@ files:
138
139
  - Gemfile
139
140
  - LICENSE
140
141
  - README.md
142
+ - RELEASE.md
141
143
  - Rakefile
142
144
  - bin/checkr-console
145
+ - bin/release
143
146
  - checkr-official.gemspec
144
147
  - lib/checkr.rb
148
+ - lib/checkr/adverse_action.rb
149
+ - lib/checkr/adverse_item.rb
150
+ - lib/checkr/adverse_item_list.rb
145
151
  - lib/checkr/api_class.rb
146
152
  - lib/checkr/api_list.rb
147
153
  - lib/checkr/api_resource.rb
@@ -193,6 +199,8 @@ files:
193
199
  - samples/state_criminal_search.md
194
200
  - samples/subscription.md
195
201
  - tasks/api_test.rb
202
+ - test/checkr/adverse_action_test.rb
203
+ - test/checkr/adverse_item_test.rb
196
204
  - test/checkr/api_class_test.rb
197
205
  - test/checkr/api_list_test.rb
198
206
  - test/checkr/api_resource_test.rb
@@ -246,11 +254,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
254
  version: '0'
247
255
  requirements: []
248
256
  rubyforge_project:
249
- rubygems_version: 2.6.14.3
257
+ rubygems_version: 2.5.2.3
250
258
  signing_key:
251
259
  specification_version: 4
252
260
  summary: Ruby bindings for Checkr API
253
261
  test_files:
262
+ - test/checkr/adverse_action_test.rb
263
+ - test/checkr/adverse_item_test.rb
254
264
  - test/checkr/api_class_test.rb
255
265
  - test/checkr/api_list_test.rb
256
266
  - test/checkr/api_resource_test.rb