lib/mailgun/suppressions.rb in mailgun-ruby-1.2.6 vs lib/mailgun/suppressions.rb in mailgun-ruby-1.2.7
- old
+ new
@@ -43,15 +43,15 @@
extract_paging response
response
end
def get_bounce(address)
- @client.get("#{@domain}/bounces/#{address}", nil)
+ @client.get("#{@domain}/bounces/#{escape_address(address)}", nil)
end
def create_bounce(params = {})
- @client.post("#{@domain/bounces}", params)
+ @client.post("#{@domain}/bounces", params)
end
# Creates multiple bounces on the Mailgun API.
# If a bounce does not have a valid structure, it will be added to a list of unsendable bounces.
# The list of unsendable bounces will be returned at the end of this operation.
@@ -98,11 +98,11 @@
response = @client.post("#{@domain}/bounces", valid.to_json, { "Content-Type" => "application/json" })
return response, split_return
end
def delete_bounce(address)
- @client.delete("#{@domain}/bounces/#{address}")
+ @client.delete("#{@domain}/bounces/#{escape_address(address)}")
end
def delete_all_bounces
@client.delete("#{@domain}/bounces")
end
@@ -116,11 +116,11 @@
extract_paging response
response
end
def get_unsubscribe(address)
- @client.get("#{@domain}/unsubscribes/#{address}")
+ @client.get("#{@domain}/unsubscribes/#{escape_address(address)}")
end
def create_unsubscribe(params = {})
@client.post("#{@domain}/unsubscribes", params)
end
@@ -171,11 +171,11 @@
response = @client.post("#{@domain}/unsubscribes", valid.to_json, { "Content-Type" => "application/json" })
return response, split_return
end
def delete_unsubscribe(address, params = {})
- @client.delete("#{@domain}/unsubscribes/#{address}")
+ @client.delete("#{@domain}/unsubscribes/#{escape_address(address)}")
end
####
# Complaints Endpoint (/v3/:domain/complaints)
####
@@ -185,11 +185,11 @@
extract_paging response
response
end
def get_complaint(address)
- @client.get("#{@domain}/complaints/#{address}", nil)
+ @client.get("#{@domain}/complaints/#{escape_address(address)}", nil)
end
def create_complaint(params = {})
@client.post("#{@domain}/complaints", params)
end
@@ -237,13 +237,17 @@
response = @client.post("#{@domain}/complaints", valid.to_json, { "Content-Type" => "application/json" })
return response, split_return
end
def delete_complaint(address)
- @client.delete("#{@domain}/complaints/#{address}")
+ @client.delete("#{@domain}/complaints/#{escape_address(address)}")
end
private
+
+ def escape_address(address)
+ CGI.escape address
+ end
def get_from_paging(uri, params = {})
@client.get(uri, params)
end