Class: ContextIO::Lite::WebhookCollection

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

Instance Attribute Summary

Attributes included from API::ResourceCollection

#api, #resource_url, #where_constraints

Instance Method Summary collapse

Methods included from API::ResourceCollection

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

Instance Method Details

#create(callback_url, errback_url, options = {}) ⇒ Object



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

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

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

  result_hash.delete('success')

  resource_class.new(api, result_hash)
end