Class: Sendeez::Suppressions
- Inherits:
-
Object
- Object
- Sendeez::Suppressions
- Defined in:
- lib/sendeez/suppressions.rb
Instance Method Summary collapse
- #create(recipient, reason: nil, expires_at: nil, timeout: nil) ⇒ Object
-
#initialize(client) ⇒ Suppressions
constructor
A new instance of Suppressions.
- #list(timeout: nil) ⇒ Object
- #remove(id, timeout: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ Suppressions
Returns a new instance of Suppressions.
5 6 7 |
# File 'lib/sendeez/suppressions.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#create(recipient, reason: nil, expires_at: nil, timeout: nil) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/sendeez/suppressions.rb', line 9 def create(recipient, reason: nil, expires_at: nil, timeout: nil) body = { "recipient" => recipient } body["reason"] = reason if reason body["expires_at"] = expires_at if expires_at @client.request("POST", "/v1/suppressions", body: body, timeout: timeout) end |
#list(timeout: nil) ⇒ Object
16 17 18 |
# File 'lib/sendeez/suppressions.rb', line 16 def list(timeout: nil) @client.request("GET", "/v1/suppressions", timeout: timeout) end |
#remove(id, timeout: nil) ⇒ Object
20 21 22 |
# File 'lib/sendeez/suppressions.rb', line 20 def remove(id, timeout: nil) @client.request("DELETE", "/v1/suppressions/#{URI.encode_www_form_component(id)}", timeout: timeout) end |