Module: Webhooker::Model::ClassMethods

Defined in:
lib/webhooker/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#webhook_attributesObject

Returns the value of attribute webhook_attributes.



40
41
42
# File 'lib/webhooker/model.rb', line 40

def webhook_attributes
  @webhook_attributes
end

#webhook_attributes_methodObject

Returns the value of attribute webhook_attributes_method.



40
41
42
# File 'lib/webhooker/model.rb', line 40

def webhook_attributes_method
  @webhook_attributes_method
end

Instance Method Details

#webhooks(*args) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/webhooker/model.rb', line 42

def webhooks *args
  options = args.extract_options!
  (options[:on] || %i(create update destroy)).each do |action|
    send :"after_#{action}", :"_trigger_webhook_on_#{action}"
  end
  @webhook_attributes = options[:attributes].try(:map, &:to_s)
  @webhook_attributes_method = options[:attributes_method] || Webhooker.config.attributes_method
end