Class: Shifter
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Shifter
- Defined in:
- lib/rest_shifter/shifter.rb
Class Method Summary collapse
Class Method Details
.build_services ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rest_shifter/shifter.rb', line 37 def self.build_services @services.each do |service| if service.request_accept.to_s == '' send(service.method_used.to_sym, service.path) do yield self, service end else send(service.method_used.to_sym, service.path, :provides => service.request_accept.to_s) do yield self, service end end end end |
.run_ssl!(port, cert, key) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rest_shifter/shifter.rb', line 10 def self.run_ssl! port, cert, key = { :Port => port.to_i, :Host => bind, :SSLEnable => true, :SSLCertificate => OpenSSL::X509::Certificate.new(File.open(cert).read), :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(key).read), :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE } Rack::Handler::WEBrick.run self, do |server| [:INT, :TERM].each { |sig| trap(sig) { server.stop } } server.threaded = settings.threaded if server.respond_to? :threaded= set :running, true end end |