Class: Factor::Connector::WebHookBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/builders/web_hook_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(vals = {}, &block) ⇒ WebHookBuilder

Returns a new instance of WebHookBuilder.



7
8
9
10
11
# File 'lib/builders/web_hook_builder.rb', line 7

def initialize(vals = {}, &block)
  @id = vals[:id].to_s
  @method = vals[:method] || 'POST'
  instance_eval(&block) if block
end

Instance Method Details

#buildObject



25
26
27
28
29
30
31
# File 'lib/builders/web_hook_builder.rb', line 25

def build
  wd = WebHookDefinition.new
  wd.id = @id
  wd.method = @method
  wd.start = @start
  wd
end

#id(val) ⇒ Object



13
14
15
# File 'lib/builders/web_hook_builder.rb', line 13

def id(val)
  @id = val.to_s
end

#method(val) ⇒ Object



17
18
19
# File 'lib/builders/web_hook_builder.rb', line 17

def method(val)
  @method = val
end

#start(&code) ⇒ Object



21
22
23
# File 'lib/builders/web_hook_builder.rb', line 21

def start(&code)
  @start = code
end