Class: GuestyAPI::Webhooks
Instance Method Summary
collapse
#initialize
Instance Method Details
#create(params:) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/guesty_api/webhooks.rb', line 21
def create(params:)
response = @client.post url: '/webhooks', data: params
check_response! response
single_entity response
end
|
#delete(id:) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/guesty_api/webhooks.rb', line 37
def delete(id:)
response = @client.delete url: "/webhooks/#{id}"
check_response! response
true
end
|
#list ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/guesty_api/webhooks.rb', line 5
def list
response = @client.get url: '/webhooks'
check_response! response
response.parsed_response.map { |payload| entity_class.new payload }
end
|
#retrieve(id:) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/guesty_api/webhooks.rb', line 13
def retrieve(id:)
response = @client.get url: "/webhooks/#{id}"
check_response! response
single_entity response
end
|
#update(id:, params:) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/guesty_api/webhooks.rb', line 29
def update(id:, params:)
response = @client.put url: "/webhooks/#{id}", data: params
check_response! response
true
end
|