Skip to content
Open
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
13 changes: 13 additions & 0 deletions lib/mailup/console/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ def recipient_groups(recipient_id, params = {})
@api.get("#{@api.path}/List/#{@id}/Recipient/#{recipient_id}/Groups", params: params)
end

# Delete all recipients in the specified group in this list
#
# @param [Integer] group_id The ID of the group.
#
# @return [JSON] Results and data including:
# * Removed [Integer]
#
# @see http://help.mailup.com/display/mailupapi/Manage+Lists+and+Groups#ManageListsandGroups-Removerecipientsfromagroup(bulkremovalfromagroup)
#
def delete_group_recipients(group_id)
@api.delete("#{@api.path}/List/#{@id}/Group/#{group_id}/Recipients")
end

# Retrieve pending recipients in the specified list.
#
# @param [Hash] params Optional params or filters:
Expand Down
2 changes: 1 addition & 1 deletion mailup.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]

gem.add_runtime_dependency 'oauth2', '~> 0.9', '>= 0.9.2'
gem.add_runtime_dependency 'oauth2', '~> 1.4', '>= 1.4'

gem.add_development_dependency "rspec"
gem.add_development_dependency "rake"
Expand Down
5 changes: 5 additions & 0 deletions spec/mailup/console/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
@mailup.console.list(1).recipient_groups(2)
end

it "should fire the correct DELETE request for delete_group_recipients" do
@mailup.console.list(1).api.should_receive(:delete).with("#{@mailup.console.list(1).api.path}/List/1/Group/1/Recipients")
@mailup.console.list(1).delete_group_recipients(1)
end

it "should fire the correct GET request for attachments" do
@mailup.console.list(1).api.should_receive(:get).with("#{@mailup.console.list(1).api.path}/List/1/Email/2/Attachment", {params: {}})
@mailup.console.list(1).attachments(2)
Expand Down