Module: Laposta::Client::Webhooks

Included in:
Laposta::Client
Defined in:
lib/laposta/client/webhooks.rb

Instance Method Summary collapse

Instance Method Details

#create_webhook!(params = {}) ⇒ Object

Allowed attributes: Name Type Description


list_id string (mandatory) The ID of the list to which the webhook belongs event string (mandatory) When will the webhook be requested? (subscribed, modified of deactivated) url string (mandatory) The URL to be accessed blocked boolean (mandatory) Is the accessing of the webhook (temporarily) blocked? (true or false)




38
39
40
41
42
43
44
# File 'lib/laposta/client/webhooks.rb', line 38

def create_webhook!(params = {})
  cleaned = params.permit(:list_id,
                          :event,
                          :url,
                          :blocked)
  create("webhook", cleaned)
end

#delete_webhook!(webhook_id, params = {}) ⇒ Object

Parameters Name Type Description


webhook_id string The ID of the webhook to be deleted


Allowed attributes: Name Type Description


list_id string (mandatory) The ID of the list to which the webhook belongs




80
81
82
83
# File 'lib/laposta/client/webhooks.rb', line 80

def delete_webhook!(webhook_id, params = {})
  cleaned = params.permit(:list_id)
  delete("webhook/#{webhook_id}", cleaned)
end

#get_webhook(webhook_id, params = {}) ⇒ Object

Parameters Name Type Description


webhook_id string The ID of the webhookto be requested


Allowed attributes: Name Type Description


list_id string The ID of the list to which the webhook belongs




15
16
17
18
# File 'lib/laposta/client/webhooks.rb', line 15

def get_webhook(webhook_id, params = {})
  cleaned = params.permit(:list_id)
  get("webhook/#{webhook_id}", cleaned)
end

#get_webhooks_for_list(params = {}) ⇒ Object

Allowed attributes: Name Type Description


list_id string The ID of the list to which the webhook belongs




25
26
27
28
# File 'lib/laposta/client/webhooks.rb', line 25

def get_webhooks_for_list(params = {})
  cleaned = params.permit(:list_id)
  list("webhook", cleaned)
end

#update_webhook!(webhook_id, params = {}) ⇒ Object

Parameters Name Type Description


webhook_id string The ID of the webhook to be modified


Allowed attributes: Name Type Description


list_id string (mandatory) The ID of the list to which the webhook belongs event string When will the webhook be requested? (subscribed, modified or deactivated) url string The URL to be accessed blocked boolean Is the accessing of the webhook (temporarily) blocked? (true or false)




61
62
63
64
65
66
67
# File 'lib/laposta/client/webhooks.rb', line 61

def update_webhook!(webhook_id, params = {})
  cleaned = params.permit(:list_id,
                          :event,
                          :url,
                          :blocked)
  update("webhook/#{webhook_id}", cleaned)
end