class Podio::Hook

@see developers.podio.com/doc/hooks

Attributes

hookable_id[RW]
hookable_type[RW]

Public Class Methods

create(hookable_type, hookable_id, attributes) click to toggle source

@see developers.podio.com/doc/hooks/create-hook-215056

# File lib/podio/models/hook.rb, line 19
def create(hookable_type, hookable_id, attributes)
  response = Podio.connection.post do |req|
    req.url "/hook/#{hookable_type}/#{hookable_id}/"
    req.body = {:url => attributes[:url], :type => attributes[:type]}
  end

  response.body['hook_id']
end
delete(hook_id) click to toggle source

@see developers.podio.com/doc/hooks/delete-hook-215291

# File lib/podio/models/hook.rb, line 44
def delete(hook_id)
  Podio.connection.delete do |req|
    req.url "/hook/#{hook_id}"
  end
end
find_all_for(hookable_type, hookable_id) click to toggle source

@see developers.podio.com/doc/hooks/get-hooks-215285

# File lib/podio/models/hook.rb, line 51
def find_all_for(hookable_type, hookable_id)
  list Podio.connection.get("/hook/#{hookable_type}/#{hookable_id}/").body
end
validate(hook_id, code) click to toggle source

@see developers.podio.com/doc/hooks/validate-hook-verification-215241

# File lib/podio/models/hook.rb, line 36
def validate(hook_id, code)
  Podio.connection.post do |req|
    req.url "/hook/#{hook_id}/verify/validate"
    req.body = {:code => code}
  end
end
verify(hook_id) click to toggle source

@see developers.podio.com/doc/hooks/request-hook-verification-215232

# File lib/podio/models/hook.rb, line 29
def verify(hook_id)
  Podio.connection.post do |req|
    req.url "/hook/#{hook_id}/verify/request"
  end
end

Public Instance Methods

create() click to toggle source

@see developers.podio.com/doc/hooks/create-hook-215056

# File lib/podio/models/hook.rb, line 13
def create
  self.hook_id = self.class.create(self.hookable_type, self.hookable_id, attributes)
end