class Particle::Webhook

Domain model for one Particle device

Public Class Methods

create_path() click to toggle source
# File lib/particle/webhook.rb, line 53
def self.create_path
  "v1/webhooks"
end
list_path() click to toggle source
# File lib/particle/webhook.rb, line 49
def self.list_path
  "v1/webhooks"
end
new(client, attributes) click to toggle source
Calls superclass method Particle::Model::new
# File lib/particle/webhook.rb, line 7
def initialize(client, attributes)
  super(client, attributes)
end

Public Instance Methods

create() click to toggle source

Add a Particle webhook

# File lib/particle/webhook.rb, line 38
def create
  new_webhook = @client.create_webhook(@attributes)
  @attributes = new_webhook.attributes
  self
end
error() click to toggle source

The error from the web server to a test message If nil, check response

# File lib/particle/webhook.rb, line 23
def error
  get_attributes unless @loaded
  @error
end
get_attributes() click to toggle source

Force reloading the attributes for the webhook

# File lib/particle/webhook.rb, line 29
def get_attributes
  @loaded = true
  result = @client.webhook_attributes(self)
  @response = result[:response]
  @error = result[:error]
  @attributes = result[:webhook]
end
path() click to toggle source
# File lib/particle/webhook.rb, line 57
def path
  "/v1/webhooks/#{id}"
end
remove() click to toggle source

Remove a Particle webhook

# File lib/particle/webhook.rb, line 45
def remove
  @client.remove_webhook(self)
end
response() click to toggle source

The response of the web server to a test message If nil, check error

# File lib/particle/webhook.rb, line 16
def response
  get_attributes unless @loaded
  @response
end