Module: UniOne::Client::Webhook

Included in:
UniOne::Client
Defined in:
lib/unione/client/webhook.rb

Instance Method Summary collapse

Instance Method Details

#delete_webhook(url) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/unione/client/webhook.rb', line 24

def delete_webhook(url)
  params = { url: url }
  post 'webhook/delete.json', params
  validate_response({'type' => 'object', 'required' => ['status'], 'properties' => {
     'status' => {'type' => 'string'}
   }})
end

#get_webhook(url) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/unione/client/webhook.rb', line 14

def get_webhook(url)
  params = { url: url }
  post 'webhook/get.json', params
  get_webhook_schema = remove_fields_from_schema(webhook_schema, ['delivery_info', 'single_event'])
  validate_response({'type' => 'object', 'required' => ['status', 'object'], 'properties' => {
     'status' => {'type' => 'string'},
     'object' => get_webhook_schema
   }})
end

#set_webhook(webhook) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/unione/client/webhook.rb', line 6

def set_webhook(webhook)
  post 'webhook/set.json', webhook
  validate_response({'type' => 'object', 'required' => ['status', 'object'], 'properties' => {
     'status' => {'type' => 'string'},
     'object' => webhook_schema
   }})
end