Module: Blix::Rest

Defined in:
lib/blix/rest/format.rb,
lib/blix/rest.rb,
lib/blix/rest/cache.rb,
lib/blix/rest/route.rb,
lib/blix/rest/server.rb,
lib/blix/rest/session.rb,
lib/blix/rest/version.rb,
lib/blix/rest/controller.rb,
lib/blix/rest/redis_cache.rb,
lib/blix/rest/string_hash.rb,
lib/blix/rest/memory_cache.rb,
lib/blix/rest/format_parser.rb,
lib/blix/rest/request_mapper.rb,
lib/blix/rest/resource_cache.rb,
lib/blix/rest/response.rb

Overview

for now it does not seem neccessary.

Defined Under Namespace

Modules: ResourceCache, Session Classes: AuthorizationError, BadRequestError, BinaryData, Cache, Context, Controller, FormatParser, HtmlFormatParser, JsonFormatParser, MemoryCache, RateError, RawFormatParser, RawJsonString, RawResponse, RedisCache, RequestMapper, RequestMapperError, Response, Route, Server, ServiceError, StringHash, XmlFormatParser

Constant Summary collapse

MIME_TYPE_JSON =
'application/json'.freeze
CONTENT_TYPE =

EXPIRED_TOKEN_MESSAGE = ‘token expired’ INVALID_TOKEN_MESSAGE = ‘invalid token’

'content-type'.freeze
CONTENT_TYPE_JSON =
'application/json'.freeze
CONTENT_TYPE_HTML =
'text/html; charset=utf-8'.freeze
CONTENT_TYPE_XML =
'application/xml'.freeze
AUTH_HEADER =
'www-authenticate'.freeze
CACHE_CONTROL =
'cache-control'.freeze
CACHE_NO_STORE =
'no-store'.freeze
PRAGMA =
'pragma'.freeze
NO_CACHE =
'no-cache'.freeze
URL_ENCODED =
%r{^application/x-www-form-urlencoded}.freeze
JSON_ENCODED =

NOTE: “text/json” and “text/javascript” are deprecated forms

%r{^application/json}.freeze
HTML_ENCODED =
%r{^text/html}.freeze
XML_ENCODED =
%r{^application/xml}.freeze
HTTP_DATE_FORMAT =
'%a, %d %b %Y %H:%M:%S GMT'.freeze
HTTP_VERBS =
%w[GET HEAD POST PUT DELETE OPTIONS PATCH].freeze
HTTP_BODY_VERBS =
%w[POST PUT PATCH].freeze
VERSION =
"0.11.2"

Class Method Summary collapse

Class Method Details

.cache_disabledObject



52
53
54
# File 'lib/blix/rest.rb', line 52

def self.cache_disabled
  @_cache_disabled
end

.disable_cacheObject



56
57
58
# File 'lib/blix/rest.rb', line 56

def self.disable_cache
  @_cache_disabled = true
end

.environmentObject

the test/development/production environment



32
33
34
# File 'lib/blix/rest.rb', line 32

def self.environment
  @_environment ||= ENV['RACK_ENV'] || 'development'
end

.environment=(val) ⇒ Object



44
45
46
# File 'lib/blix/rest.rb', line 44

def self.environment=(val)
  @_environment = val.to_s
end

.environment?(val) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/blix/rest.rb', line 40

def self.environment?(val)
  environment == val.to_s
end

.full_path(path) ⇒ Object



347
348
349
# File 'lib/blix/rest/request_mapper.rb', line 347

def full_path(path)
  RequestMapper.full_path(path)
end

.initObject



36
37
38
# File 'lib/blix/rest.rb', line 36

def self.init
  RequestMapper.table  # compile the table
end

.loggerObject



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/blix/rest.rb', line 60

def self.logger
  @_logger ||= begin
    l = Logger.new(STDOUT)
    unless l.respond_to? :write   # common logger needs a write method
      def l.write(*args)
        self.<<(*args)
      end
    end
    l
  end
end

.logger=(val) ⇒ Object



48
49
50
# File 'lib/blix/rest.rb', line 48

def self.logger=(val)
  @_logger = val
end

.no_template_cache=(val) ⇒ Object



784
785
786
# File 'lib/blix/rest/controller.rb', line 784

def self.no_template_cache=(val)
  Controller.no_template_cache = val
end

.path_rootObject



343
344
345
# File 'lib/blix/rest/request_mapper.rb', line 343

def path_root
  RequestMapper.path_root
end

.set_erb_root(*args) ⇒ Object



780
781
782
# File 'lib/blix/rest/controller.rb', line 780

def self.set_erb_root(*args)
  Controller.set_erb_root(*args)
end

.set_path_root(*args) ⇒ Object



339
340
341
# File 'lib/blix/rest/request_mapper.rb', line 339

def set_path_root(*args)
  RequestMapper.set_path_root(*args)
end