Class: Sms77::Resources::Hooks

Inherits:
Sms77::Resource show all
Defined in:
lib/sms77/resources/hooks.rb

Constant Summary

Constants inherited from Sms77::Resource

Sms77::Resource::BASE_PATH

Instance Attribute Summary

Attributes inherited from Sms77::Resource

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

Instance Method Summary collapse

Methods inherited from Sms77::Resource

get_endpoint, get_http_methods, #initialize

Constructor Details

This class inherits a constructor from Sms77::Resource

Instance Method Details

#read(params = {}) ⇒ Hash

Retrieve all webhooks

Parameters:

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

Returns:

  • (Hash)


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

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

#subscribe(params) ⇒ Hash

Register a new webhook

Parameters:

  • params (Hash)

Returns:

  • (Hash)


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

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

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

#unsubscribe(params) ⇒ Hash

Delete a webhook

Parameters:

  • params (Hash)

Returns:

  • (Hash)


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

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

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