Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Subscription.all #25

Merged
merged 1 commit into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/checkr/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Subscription < APIResource
attribute :candidate, :Candidate
attribute_writer_alias :candidate_id, :candidate

api_class_method :all, :get, :constructor => APIList.constructor(:Subscription)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]
Use the new Ruby 1.9 hash syntax.

api_class_method :retrieve, :get, ":path/:id", :arguments => [:id]
api_class_method :create, :post

Expand Down
11 changes: 11 additions & 0 deletions test/checkr/subscription_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ class SubscriptionTest < Test::Unit::TestCase
assert(subscription.is_a?(Subscription))
assert_equal(test_subscription[:id], subscription.id)
end

should 'be listable' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@mock.expects(:get).once.returns(test_response(test_subscription_list))

subscriptions = Subscription.all

assert(subscriptions.is_a?(APIList))
subscriptions.each do |subscription|
assert(subscription.is_a?(Subscription))
end
end
end

context 'Subscription instance' do
Expand Down
7 changes: 7 additions & 0 deletions test/test_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ def test_subscription
:candidate_id=>"e44aa283528e6fde7d542194"}
end

def test_subscription_list
{
:object => 'list',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new Ruby 1.9 hash syntax.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

:data => [test_subscription, test_subscription, test_subscription]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the new Ruby 1.9 hash syntax.

}
end

def test_geo
{:id=>"e44aa283528e6fde7d542194",
:object=>"geo",
Expand Down