Class: Sendeez::Webhooks

Inherits:
Object
  • Object
show all
Defined in:
lib/sendeez/webhooks.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Webhooks

Returns a new instance of Webhooks.



5
6
7
# File 'lib/sendeez/webhooks.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#create(url, description: nil, events: nil, timeout: nil) ⇒ Object



9
10
11
12
13
14
# File 'lib/sendeez/webhooks.rb', line 9

def create(url, description: nil, events: nil, timeout: nil)
  body = { "url" => url }
  body["description"] = description if description
  body["events"] = events if events
  @client.request("POST", "/v1/webhooks", body: body, timeout: timeout)
end

#deliveries(id, timeout: nil) ⇒ Object



28
29
30
# File 'lib/sendeez/webhooks.rb', line 28

def deliveries(id, timeout: nil)
  @client.request("GET", "/v1/webhooks/#{URI.encode_www_form_component(id)}/deliveries", timeout: timeout)
end

#list(timeout: nil) ⇒ Object



16
17
18
# File 'lib/sendeez/webhooks.rb', line 16

def list(timeout: nil)
  @client.request("GET", "/v1/webhooks", timeout: timeout)
end

#remove(id, timeout: nil) ⇒ Object



32
33
34
# File 'lib/sendeez/webhooks.rb', line 32

def remove(id, timeout: nil)
  @client.request("DELETE", "/v1/webhooks/#{URI.encode_www_form_component(id)}", timeout: timeout)
end

#retrieve(id, timeout: nil) ⇒ Object



20
21
22
# File 'lib/sendeez/webhooks.rb', line 20

def retrieve(id, timeout: nil)
  @client.request("GET", "/v1/webhooks/#{URI.encode_www_form_component(id)}", timeout: timeout)
end

#test(id, timeout: nil) ⇒ Object



24
25
26
# File 'lib/sendeez/webhooks.rb', line 24

def test(id, timeout: nil)
  @client.request("POST", "/v1/webhooks/#{URI.encode_www_form_component(id)}/test", timeout: timeout)
end