Class: MailToHipChat::RackApp::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/mail_to_hip_chat/rack_app/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Builder

Returns a new instance of Builder.

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
15
# File 'lib/mail_to_hip_chat/rack_app/builder.rb', line 11

def initialize
  @chutes = []
  @mount_point = '/notifications/create'
  yield(self) if block_given?
end

Instance Attribute Details

#api_tokenObject

Returns the value of attribute api_token.



9
10
11
# File 'lib/mail_to_hip_chat/rack_app/builder.rb', line 9

def api_token
  @api_token
end

#mount_pointObject

Returns the value of attribute mount_point.



9
10
11
# File 'lib/mail_to_hip_chat/rack_app/builder.rb', line 9

def mount_point
  @mount_point
end

#roomsObject

Returns the value of attribute rooms.



9
10
11
# File 'lib/mail_to_hip_chat/rack_app/builder.rb', line 9

def rooms
  @rooms
end

#secretObject

Returns the value of attribute secret.



9
10
11
# File 'lib/mail_to_hip_chat/rack_app/builder.rb', line 9

def secret
  @secret
end

Instance Method Details

#to_appObject



21
22
23
24
25
26
27
28
29
# File 'lib/mail_to_hip_chat/rack_app/builder.rb', line 21

def to_app
  return @app if @app
  app = build_app
  mnt = mount_point
  @app = Rack::Builder.new do
    use Rack::CommonLogger
    map(mnt) { run app }
  end.to_app
end

#use_chute(chute_klass) ⇒ Object



17
18
19
# File 'lib/mail_to_hip_chat/rack_app/builder.rb', line 17

def use_chute(chute_klass)
  @chutes << chute_klass
end