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

destroy_many uses a comma separated list of ids #242

Merged
merged 1 commit into from Jun 25, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/zendesk_api/actions.rb
Expand Up @@ -220,7 +220,7 @@ def destroy(client, attributes = {}, &block)
module DestroyMany
def destroy_many!(client, ids, association = Association.new(:class => self))
response = client.connection.delete("#{association.generate_path}/destroy_many") do |req|
req.params = { :ids => ids }
req.params = { :ids => ids.join(',') }

yield req if block_given?
end
Expand Down
2 changes: 1 addition & 1 deletion spec/core/bulk_actions_spec.rb
Expand Up @@ -10,7 +10,7 @@
end

it 'calls the destroy_many endpoint' do
assert_requested(:delete, %r{bulk_test_resources/destroy_many\?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3})
assert_requested(:delete, %r{bulk_test_resources/destroy_many\?ids=1,2,3$})
end

it 'returns a JobStatus' do
Expand Down
2 changes: 1 addition & 1 deletion spec/core/collection_spec.rb
Expand Up @@ -39,7 +39,7 @@
collection = ZendeskAPI::Collection.new(client, ZendeskAPI::BulkTestResource)
stub_json_request(:delete, %r{bulk_test_resources/destroy_many\?}, json(:job_status => {}))
collection.destroy_many!([1,2,3])
assert_requested(:delete, %r{bulk_test_resources/destroy_many\?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3$})
assert_requested(:delete, %r{bulk_test_resources/destroy_many\?ids=1,2,3$})
end

it "should defer #create to the resource class" do
Expand Down