Class: RubyHome::HTTP::Application
- Inherits:
-
Object
- Object
- RubyHome::HTTP::Application
- Defined in:
- lib/ruby_home/http/application.rb
Instance Method Summary collapse
Instance Method Details
#bind_address ⇒ Object
17 18 19 |
# File 'lib/ruby_home/http/application.rb', line 17 def bind_address '0.0.0.0' end |
#port ⇒ Object
13 14 15 |
# File 'lib/ruby_home/http/application.rb', line 13 def port @_port ||= Integer(ENV['PORT'] && !ENV['PORT'].empty? ? ENV['PORT'] : 4567) end |
#rack_builder ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby_home/http/application.rb', line 21 def rack_builder ::Rack::Builder.new do use ::Rack::CommonLogger map('/accessories', &Proc.new { run AccessoriesController }) map('/characteristics', &Proc.new { run CharacteristicsController }) map('/pair-setup', &Proc.new { run PairSetupsController }) map('/pair-verify', &Proc.new { run PairVerifiesController }) map('/pairings', &Proc.new { run PairingsController }) end end |
#run ⇒ Object
6 7 8 9 10 11 |
# File 'lib/ruby_home/http/application.rb', line 6 def run RubyHome::Rack::Handler::HAPServer.run rack_builder, Port: port, Host: bind_address, ServerSoftware: 'RubyHome' end |