Class: Podio::Hook
Instance Attribute Summary collapse
#attributes, #error_code, #error_message, #error_parameters, #error_propagate
Class Method Summary
collapse
Instance Method Summary
collapse
#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, list, member, #new_record?, #persisted?, property, #to_param
Instance Attribute Details
#hookable_id ⇒ Object
Returns the value of attribute hookable_id.
9
10
11
|
# File 'lib/podio/models/hook.rb', line 9
def hookable_id
@hookable_id
end
|
#hookable_type ⇒ Object
Returns the value of attribute hookable_type.
9
10
11
|
# File 'lib/podio/models/hook.rb', line 9
def hookable_type
@hookable_type
end
|
Class Method Details
.create(hookable_type, hookable_id, attributes) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/podio/models/hook.rb', line 16
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) ⇒ Object
38
39
40
41
42
|
# File 'lib/podio/models/hook.rb', line 38
def delete(hook_id)
Podio.connection.delete do |req|
req.url "/hook/#{hook_id}"
end
end
|
.find_all_for(hookable_type, hookable_id) ⇒ Object
44
45
46
|
# File 'lib/podio/models/hook.rb', line 44
def find_all_for(hookable_type, hookable_id)
list Podio.connection.get("/hook/#{hookable_type}/#{hookable_id}/").body
end
|
.validate(hook_id, code) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/podio/models/hook.rb', line 31
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) ⇒ Object
25
26
27
28
29
|
# File 'lib/podio/models/hook.rb', line 25
def verify(hook_id)
Podio.connection.post do |req|
req.url "/hook/#{hook_id}/verify/request"
end
end
|
Instance Method Details
#create ⇒ Object
11
12
13
|
# File 'lib/podio/models/hook.rb', line 11
def create
self.hook_id = self.class.create(self.hookable_type, self.hookable_id, attributes)
end
|