class Blix::Rest::FormatParser

this is the base class for all the format parsers

Attributes

__custom_headers[RW]
_format[R]
_options[W]

Public Class Methods

_types() click to toggle source
# File lib/blix/rest/format_parser.rb, line 27
def self._types
  @_types || []
end
accept_types(types) click to toggle source

the accept header types that correspont to this parser.

# File lib/blix/rest/format_parser.rb, line 36
def self.accept_types(types)
  types = [types].flatten
  @_types = types
end

Public Instance Methods

_format=(val) click to toggle source
# File lib/blix/rest/format_parser.rb, line 23
def _format=(val)
  @_format = val.to_s.downcase
end
_options() click to toggle source
# File lib/blix/rest/format_parser.rb, line 19
def _options
  @_options || {}
end
_types() click to toggle source
# File lib/blix/rest/format_parser.rb, line 31
def _types
  self.class._types
end
format_error(message) click to toggle source

construct the body of an error messsage.

# File lib/blix/rest/format_parser.rb, line 42
def format_error(message)
  message.to_s
end
format_response(value, response) click to toggle source

set the response content / headers / status headers are the default headers if not set status is 200 if not set

# File lib/blix/rest/format_parser.rb, line 49
def format_response(value, response)
  response.content = value.to_s
end
set_default_headers(headers) click to toggle source
# File lib/blix/rest/format_parser.rb, line 9
def set_default_headers(headers)
  # headers[CACHE_CONTROL]= CACHE_NO_STORE
  # headers[PRAGMA]       = NO_CACHE
  # headers[CONTENT_TYPE] = CONTENT_TYPE_JSON
end