Class: ContextIO::WebhookCollection

Inherits:
Object
  • Object
show all
Includes:
API::ResourceCollection
Defined in:
lib/contextio/webhook_collection.rb

Instance Attribute Summary

Attributes included from API::ResourceCollection

#resource_url, #where_constraints

Instance Method Summary collapse

Methods included from API::ResourceCollection

#[], #each, #empty?, #size, #where

Instance Method Details

#create(success_callback_url, failure_callback_url, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/contextio/webhook_collection.rb', line 13

def create(success_callback_url, failure_callback_url, options={})
  api_args = options.merge(
    'callback_url' => success_callback_url,
    'failure_notif_url' => failure_callback_url
  )

  result_hash = api.request(:post, resource_url, api_args)

  result_hash.delete('success')

  resource_class.new(api, result_hash)
end