Class: TrustedSearch::V2::HookSubscription

Inherits:
ApiVersion2 show all
Defined in:
lib/trustedsearch/v2/hook_subscriptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApiVersion2

#base_path, #request

Methods inherited from APIResource

#base_path, #class_name, #delete, #end_point, #get, #get_time, #has_keys, #post, #process, #put, #request, #sign_request

Constructor Details

#initializeHookSubscription

Returns a new instance of HookSubscription.



6
7
8
# File 'lib/trustedsearch/v2/hook_subscriptions.rb', line 6

def initialize
  @resource = 'hook-subscriptions'
end

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



4
5
6
# File 'lib/trustedsearch/v2/hook_subscriptions.rb', line 4

def resource
  @resource
end

Instance Method Details

#create(data = nil) ⇒ Object

Create a new subscription



24
25
26
27
28
# File 'lib/trustedsearch/v2/hook_subscriptions.rb', line 24

def create(data = nil)
  method_url = @resource
  params = {}
  return self.post(method_url, params, data)
end

#destroy(id = nil) ⇒ Object

Delete/Destroy a subscription



38
39
40
41
# File 'lib/trustedsearch/v2/hook_subscriptions.rb', line 38

def destroy(id = nil)
  method_url = @resource + "/" + id
  return self.delete(method_url)
end

#indexObject

Retrieve an array of all hook subscriptions



11
12
13
14
# File 'lib/trustedsearch/v2/hook_subscriptions.rb', line 11

def index()
  method_url = @resource
  return self.get(method_url)
end

#show(id = nil) ⇒ Object

Show the details of a single hook



17
18
19
20
21
# File 'lib/trustedsearch/v2/hook_subscriptions.rb', line 17

def show(id = nil)
  method_url = @resource + "/" + id
  params = {}
  return self.get(method_url, params)
end

#update(id = nil, data) ⇒ Object

Update a subscription



31
32
33
34
35
# File 'lib/trustedsearch/v2/hook_subscriptions.rb', line 31

def update(id = nil, data)
  method_url = @resource + "/" + id
  params = {}
  return self.put(method_url, params, data)
end