Class: Outpost::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/outpost/hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Hook

Returns a new instance of Hook.



9
10
11
12
# File 'lib/outpost/hook.rb', line 9

def initialize(options={})
  @path = options[:path]
  @data = options[:data] || { touch: true }
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



7
8
9
# File 'lib/outpost/hook.rb', line 7

def data
  @data
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/outpost/hook.rb', line 7

def path
  @path
end

Instance Method Details

#publishObject

Publish the message



15
16
17
18
19
20
21
22
# File 'lib/outpost/hook.rb', line 15

def publish
  response = connection.post do |request|
    request.url @path
    request.params = @data
  end

  response
end