Class: RESTRack::WebService
Instance Method Summary collapse
-
#call(env) ⇒ Object
Handle requests in the Rack way.
-
#initialize ⇒ WebService
constructor
Establish the namespace pointer.
Constructor Details
permalink #initialize ⇒ WebService
Establish the namespace pointer.
5 6 7 8 |
# File 'lib/restrack/web_service.rb', line 5 def initialize RESTRack::CONFIG[:SERVICE_NAME] = self.class.to_s.split('::')[0].to_sym @request_hook = RESTRack::Hooks.new if RESTRack.const_defined?(:Hooks) end |
Instance Method Details
permalink #call(env) ⇒ Object
Handle requests in the Rack way.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/restrack/web_service.rb', line 11 def call( env ) resource_request = RESTRack::ResourceRequest.new( :request => Rack::Request.new(env) ) unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:PRE_PROCESSOR_DISABLED) and RESTRack::CONFIG[:PRE_PROCESSOR_DISABLED]) @request_hook.pre_processor(resource_request) end response = RESTRack::Response.new(resource_request) unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:POST_PROCESSOR_DISABLED) and RESTRack::CONFIG[:POST_PROCESSOR_DISABLED]) @request_hook.post_processor(response) end return response.output end |