Class: CiscoSpark::Webhook

Inherits:
Base
  • Object
show all
Defined in:
lib/webhook.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #delete, #refresh, #update

Constructor Details

#initialize(data) ⇒ Webhook

Returns a new instance of Webhook.



4
5
6
7
8
# File 'lib/webhook.rb', line 4

def initialize(data)
  @api_endpoint = 'webhooks'
  @update_fields = [:name]
  super
end

Instance Attribute Details

#appIdObject

Returns the value of attribute appId.



3
4
5
# File 'lib/webhook.rb', line 3

def appId
  @appId
end

#createdObject

Returns the value of attribute created.



3
4
5
# File 'lib/webhook.rb', line 3

def created
  @created
end

#createdByObject

Returns the value of attribute createdBy.



3
4
5
# File 'lib/webhook.rb', line 3

def createdBy
  @createdBy
end

#eventObject

Returns the value of attribute event.



3
4
5
# File 'lib/webhook.rb', line 3

def event
  @event
end

#filterObject

Returns the value of attribute filter.



3
4
5
# File 'lib/webhook.rb', line 3

def filter
  @filter
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/webhook.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/webhook.rb', line 3

def name
  @name
end

#orgIdObject

Returns the value of attribute orgId.



3
4
5
# File 'lib/webhook.rb', line 3

def orgId
  @orgId
end

#ownedByObject

Returns the value of attribute ownedBy.



3
4
5
# File 'lib/webhook.rb', line 3

def ownedBy
  @ownedBy
end

#resourceObject

Returns the value of attribute resource.



3
4
5
# File 'lib/webhook.rb', line 3

def resource
  @resource
end

#secretObject

Returns the value of attribute secret.



3
4
5
# File 'lib/webhook.rb', line 3

def secret
  @secret
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/webhook.rb', line 3

def status
  @status
end

#targetUrlObject

Returns the value of attribute targetUrl.



3
4
5
# File 'lib/webhook.rb', line 3

def targetUrl
  @targetUrl
end

Class Method Details

.create(payload = {}) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/webhook.rb', line 19

def create(payload = {})
  res = CiscoSpark.rest('POST', '/webhooks', payload: payload)
  if res.ok
    webhook = CiscoSpark::Webhook.new(JSON.parse(res.body))
    return webhook
  end
  nil
end

.get(id) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/webhook.rb', line 10

def get(id)
  res = CiscoSpark.rest('GET', "/webhooks/#{id}")
  if res.ok
    webhook = CiscoSpark::Webhook.new(JSON.parse(res.body))
    return webhook
  end
  nil
end