Class: RulesIO::RailsConfigurator

Inherits:
Object
  • Object
show all
Defined in:
lib/rulesio/railtie.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRailsConfigurator

Returns a new instance of RailsConfigurator.



7
8
9
10
11
# File 'lib/rulesio/railtie.rb', line 7

def initialize
  @webhook_url = 'https://www.rules.io/events/'
  @middlewares = {}
  @disable = false
end

Instance Attribute Details

#controller_data(data) ⇒ Object

Returns the value of attribute controller_data.



6
7
8
# File 'lib/rulesio/railtie.rb', line 6

def controller_data
  @controller_data
end

#disableObject

Returns the value of attribute disable.



6
7
8
# File 'lib/rulesio/railtie.rb', line 6

def disable
  @disable
end

#middlewaresObject

Returns the value of attribute middlewares.



6
7
8
# File 'lib/rulesio/railtie.rb', line 6

def middlewares
  @middlewares
end

#queue(queue, options = {}) ⇒ Object

Returns the value of attribute queue.



6
7
8
# File 'lib/rulesio/railtie.rb', line 6

def queue
  @queue
end

#queue_optionsObject

Returns the value of attribute queue_options.



6
7
8
# File 'lib/rulesio/railtie.rb', line 6

def queue_options
  @queue_options
end

#token(token) ⇒ Object

Returns the value of attribute token.



6
7
8
# File 'lib/rulesio/railtie.rb', line 6

def token
  @token
end

#webhook_url(webhook_url) ⇒ Object

Returns the value of attribute webhook_url.



6
7
8
# File 'lib/rulesio/railtie.rb', line 6

def webhook_url
  @webhook_url
end

Instance Method Details

#configurationObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/rulesio/railtie.rb', line 42

def configuration
  {
    :webhook_url => @webhook_url,
    :disable_sending_events => @disable,
    :token => @token,
    :queue => @queue,
    :queue_options => @queue_options,
    :controller_data => @controller_data
  }
end

#disable_sending_eventsObject



30
31
32
# File 'lib/rulesio/railtie.rb', line 30

def disable_sending_events
  @disable = true
end

#girl_friday_options(options) ⇒ Object



38
39
40
# File 'lib/rulesio/railtie.rb', line 38

def girl_friday_options(options)
  @girl_friday_options = options
end

#middleware(middleware, &block) ⇒ Object



21
22
23
# File 'lib/rulesio/railtie.rb', line 21

def middleware(middleware, &block)
  @middlewares[middleware] = MiddlewareConfigurator.apply(self, &block)
end