Class: Cypress::CallbackServer
- Inherits:
-
Object
- Object
- Cypress::CallbackServer
- Defined in:
- lib/cypress/callback_server.rb
Instance Attribute Summary collapse
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #callback_url ⇒ Object
-
#initialize(owner) ⇒ CallbackServer
constructor
A new instance of CallbackServer.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(owner) ⇒ CallbackServer
Returns a new instance of CallbackServer.
4 5 6 7 8 9 10 11 |
# File 'lib/cypress/callback_server.rb', line 4 def initialize(owner) @port = 9293 @webrick = WEBrick::HTTPServer.new(:Port => port) @webrick.mount_proc '/' do |req, res| owner.run_command JSON.parse(req.body) res.body = '' end end |
Instance Attribute Details
#port ⇒ Object (readonly)
Returns the value of attribute port.
3 4 5 |
# File 'lib/cypress/callback_server.rb', line 3 def port @port end |
Instance Method Details
#callback_url ⇒ Object
21 22 23 |
# File 'lib/cypress/callback_server.rb', line 21 def callback_url "http://localhost:9293" end |
#shutdown ⇒ Object
17 18 19 |
# File 'lib/cypress/callback_server.rb', line 17 def shutdown @webrick.shutdown end |
#start ⇒ Object
13 14 15 |
# File 'lib/cypress/callback_server.rb', line 13 def start @webrick.start end |