Class: Vantiv::Certification::PaypageServer
- Inherits:
-
Object
- Object
- Vantiv::Certification::PaypageServer
- Defined in:
- lib/vantiv/certification/paypage_server.rb
Instance Method Summary collapse
-
#initialize(threaded: true) ⇒ PaypageServer
constructor
A new instance of PaypageServer.
- #root_path ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(threaded: true) ⇒ PaypageServer
Returns a new instance of PaypageServer.
8 9 10 11 12 |
# File 'lib/vantiv/certification/paypage_server.rb', line 8 def initialize(threaded: true) @threaded = threaded @template = "#{Vantiv.root}/lib/vantiv/certification/views/index.html.erb" @static_file_dir = "#{Vantiv.root}/tmp/e-protect" end |
Instance Method Details
#root_path ⇒ Object
28 29 30 |
# File 'lib/vantiv/certification/paypage_server.rb', line 28 def root_path "http://localhost:#{port}" end |
#start ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vantiv/certification/paypage_server.rb', line 14 def start if threaded @server_thread = Thread.new do compile_template server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => document_root Thread.current.thread_variable_set(:server, server) trap('INT') { server.shutdown } server.start end else start_server end end |
#stop ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/vantiv/certification/paypage_server.rb', line 32 def stop if threaded server_thread.thread_variable_get(:server).shutdown Thread.kill(server_thread) else stop_server end end |