Module: Webservice

Defined in:
lib/webservice/base/response_handler.rb,
lib/webservice.rb,
lib/webservice/metal.rb,
lib/webservice/version.rb,
lib/webservice/base/base.rb

Overview

default (built-in) response handler

Defined Under Namespace

Modules: Helpers, Version Classes: Base, Metal, ResponseHandler

Constant Summary collapse

GET =

use (an reuse from Rack) some freezed string constants

HTTP verbs
Rack::GET
POST =
Rack::POST
PATCH =
Rack::PATCH
PUT =
Rack::PUT
DELETE =
Rack::DELETE
HEAD =
Rack::HEAD
OPTIONS =
Rack::OPTIONS
CONTENT_LENGTH =

HTTP headers

Rack::CONTENT_LENGTH
CONTENT_TYPE =
Rack::CONTENT_TYPE
LOCATION =

– more HTTP headers - not available from Rack

'Location'.freeze
LAST_MODIFIED =
'Last-Modified'.freeze
VERSION =
[Version::MAJOR,
Version::MINOR,
Version::PATCH].join('.')

Class Method Summary collapse

Class Method Details



19
20
21
# File 'lib/webservice/version.rb', line 19

def self.banner
  "webservice/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end

.load(code) ⇒ Object



38
39
40
41
42
# File 'lib/webservice.rb', line 38

def self.load( code )
  app_class = Class.new( Base )     ## create new app_class or just use Base itself - why? why not?
  app_class.class_eval( code )   ## note: use class_eval (NOT instance_eval)
  app_class
end

.load_file(path) ⇒ Object



33
34
35
36
# File 'lib/webservice.rb', line 33

def self.load_file( path )
  code = File.open( path, 'r:bom|utf-8' ).read
  self.load( code )
end

.rootObject



23
24
25
# File 'lib/webservice/version.rb', line 23

def self.root
  "#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
end

.versionObject



15
16
17
# File 'lib/webservice/version.rb', line 15

def self.version
  VERSION
end