Class: TheCity::WebHook

Inherits:
ApiObject show all
Defined in:
lib/api/web_hook.rb

Constant Summary collapse

Objects =
{:user => 'user', :group => 'group', :invitation => 'invitation',
:privilege => 'privilege', :checkin => 'checkin', :address => 'address',
:group_tag => 'group_tag', :fund => 'fund', :pledge => 'pledge', :donation => 'donation'}
Events =
{:create => 'create', :update => 'update', :destroy => 'destroy', :expire => 'expire'}

Instance Attribute Summary

Attributes inherited from ApiObject

#error_messages, #marked_for_destruction

Instance Method Summary collapse

Methods inherited from ApiObject

__tc_attributes, #delete, #initialize_from_json_object, #is_deleted?, #save, #set_attributes, tc_attr_accessor, #to_attributes

Constructor Details

#initialize(json_data = nil) ⇒ WebHook

Constructor.

Parameters:

  • json_data (optional) (defaults to: nil)

    JSON data of the web hook.



19
20
21
22
# File 'lib/api/web_hook.rb', line 19

def initialize(json_data = nil)
  @writer_object = WebHookWriter
  initialize_from_json_object(json_data) unless json_data.nil?
end

Instance Method Details

#nameObject

The name of the hook based on the event and object



26
27
28
# File 'lib/api/web_hook.rb', line 26

def name
  "#{self.object}::#{self.event}"
end