Skip to content

Commit 26c0b69

Browse files
righijperichon
authored andcommitted
Add Subscription.all
1 parent a5aa816 commit 26c0b69

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

lib/checkr/subscription.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Subscription < APIResource
1313
attribute :candidate, :Candidate
1414
attribute_writer_alias :candidate_id, :candidate
1515

16+
api_class_method :all, :get, :constructor => APIList.constructor(:Subscription)
1617
api_class_method :retrieve, :get, ":path/:id", :arguments => [:id]
1718
api_class_method :create, :post
1819

test/checkr/subscription_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ class SubscriptionTest < Test::Unit::TestCase
2020
assert(subscription.is_a?(Subscription))
2121
assert_equal(test_subscription[:id], subscription.id)
2222
end
23+
24+
should 'be listable' do
25+
@mock.expects(:get).once.returns(test_response(test_subscription_list))
26+
27+
subscriptions = Subscription.all
28+
29+
assert(subscriptions.is_a?(APIList))
30+
subscriptions.each do |subscription|
31+
assert(subscription.is_a?(Subscription))
32+
end
33+
end
2334
end
2435

2536
context 'Subscription instance' do

test/test_data.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ def test_subscription
116116
:candidate_id=>"e44aa283528e6fde7d542194"}
117117
end
118118

119+
def test_subscription_list
120+
{
121+
:object => 'list',
122+
:data => [test_subscription, test_subscription, test_subscription]
123+
}
124+
end
125+
119126
def test_geo
120127
{:id=>"e44aa283528e6fde7d542194",
121128
:object=>"geo",

0 commit comments

Comments
 (0)