Class: SevenApi::Resources::Hooks

Inherits:
SevenApi::Resource show all
Defined in:
lib/seven_api/resources/hooks.rb

Constant Summary

Constants inherited from SevenApi::Resource

SevenApi::Resource::BASE_PATH

Instance Attribute Summary

Attributes inherited from SevenApi::Resource

#api_key, #builder, #conn, #endpoint, #http_methods, #request_methods, #sent_with

Instance Method Summary collapse

Methods inherited from SevenApi::Resource

get_endpoint, get_http_methods, #initialize

Constructor Details

This class inherits a constructor from SevenApi::Resource

Instance Method Details

#read(params = {}) ⇒ Hash

Retrieve all webhooks

Parameters:

  • params (Hash) (defaults to: {})

Returns:

  • (Hash)


19
20
21
# File 'lib/seven_api/resources/hooks.rb', line 19

def read(params = {})
  request(params.merge({ :action => SevenApi::Hooks::Action::READ }))
end

#subscribe(params) ⇒ Hash

Register a new webhook

Parameters:

  • params (Hash)

Returns:

  • (Hash)


26
27
28
29
30
# File 'lib/seven_api/resources/hooks.rb', line 26

def subscribe(params)
  SevenApi::Hooks::Validator::subscribe(params)

  request(params.merge({ :action => SevenApi::Hooks::Action::SUBSCRIBE }))
end

#unsubscribe(params) ⇒ Hash

Delete a webhook

Parameters:

  • params (Hash)

Returns:

  • (Hash)


35
36
37
38
39
# File 'lib/seven_api/resources/hooks.rb', line 35

def unsubscribe(params)
  SevenApi::Hooks::Validator::unsubscribe(params)

  request(params.merge({ :action => SevenApi::Hooks::Action::UNSUBSCRIBE }))
end