Class: Easyhooks::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers, Validators
Defined in:
lib/easyhooks/base.rb

Direct Known Subclasses

Action, Trigger

Constant Summary

Constants included from Validators

Validators::ALLOWED_METHODS, Validators::ALLOWED_ON_VALUES, Validators::ALLOWED_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, hook, condition, payload, on_fail) ⇒ Base

Returns a new instance of Base.



13
14
15
16
17
18
19
20
# File 'lib/easyhooks/base.rb', line 13

def initialize(name, type, hook, condition, payload, on_fail)
  @name = validate_name(name)
  @type = validate_type(type)
  @hook = hook
  @condition = validate_callback(condition, 'if')
  @payload = validate_callback(payload, 'payload')
  @on_fail = validate_callback(on_fail, 'on_fail')
end

Instance Attribute Details

#conditionObject

Returns the value of attribute condition.



11
12
13
# File 'lib/easyhooks/base.rb', line 11

def condition
  @condition
end

#hookObject

Returns the value of attribute hook.



11
12
13
# File 'lib/easyhooks/base.rb', line 11

def hook
  @hook
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'lib/easyhooks/base.rb', line 11

def name
  @name
end

#on_failObject

Returns the value of attribute on_fail.



11
12
13
# File 'lib/easyhooks/base.rb', line 11

def on_fail
  @on_fail
end

#payloadObject

Returns the value of attribute payload.



11
12
13
# File 'lib/easyhooks/base.rb', line 11

def payload
  @payload
end

#typeObject

Returns the value of attribute type.



11
12
13
# File 'lib/easyhooks/base.rb', line 11

def type
  @type
end