class FastBound::Webhook

Constants

CREATE_AND_EDIT_ATTRS
ENDPOINTS

Public Class Methods

new(client) click to toggle source
# File lib/fastbound-ruby/webhook.rb, line 21
def initialize(client)
  @client = client
end

Public Instance Methods

create(webhook_data) click to toggle source
# File lib/fastbound-ruby/webhook.rb, line 25
def create(webhook_data)
  requires!(webhook_data, *CREATE_AND_EDIT_ATTRS[:required])

  endpoint = ENDPOINTS[:create]
  webhook_data = standardize_body_data(webhook_data, CREATE_AND_EDIT_ATTRS[:permitted])

  post_request(@client, endpoint, webhook_data)
end
delete(webhook_name) click to toggle source
# File lib/fastbound-ruby/webhook.rb, line 47
def delete(webhook_name)
  endpoint = ENDPOINTS[:delete] % webhook_name

  delete_request(@client, endpoint)
end
edit(webhook_name, webhook_data) click to toggle source
# File lib/fastbound-ruby/webhook.rb, line 34
def edit(webhook_name, webhook_data)
  endpoint = ENDPOINTS[:edit] % webhook_name
  webhook_data = standardize_body_data(webhook_data, CREATE_AND_EDIT_ATTRS[:permitted])

  put_request(@client, endpoint, webhook_data)
end
events() click to toggle source
# File lib/fastbound-ruby/webhook.rb, line 53
def events
  endpoint = ENDPOINTS[:events]

  get_request(@client, endpoint)
end
fetch(webhook_name) click to toggle source
# File lib/fastbound-ruby/webhook.rb, line 41
def fetch(webhook_name)
  endpoint = ENDPOINTS[:fetch] % webhook_name

  get_request(@client, endpoint)
end