module Siresta::API::ClassMethods
Public Instance Methods
_gen_route(meth, path, formats, pipe, handler)
click to toggle source
generate route
# File lib/siresta/api.rb, line 97 def _gen_route(meth, path, formats, pipe, handler) send(meth, path) do _handle_request meth, path, formats, pipe, handler end end
data(k, v)
click to toggle source
declare data (atom)
# File lib/siresta/api.rb, line 109 def data(k, v) settings.siresta[:data][k] = Obfusk.atom v end
handle(name, &b)
click to toggle source
named handler
# File lib/siresta/api.rb, line 104 def handle(name, &b) define_method name, &b end
to_convert_from(format, handler = :__all__, &b)
click to toggle source
convert body from format
# File lib/siresta/api.rb, line 119 def to_convert_from(format, handler = :__all__, &b) (settings.siresta[:convert_from][format] ||= {})[handler] = b end
to_convert_params(handler, &b)
click to toggle source
convert params
# File lib/siresta/api.rb, line 124 def to_convert_params(handler, &b) settings.siresta[:convert_params][handler] = b end
to_convert_to(format, handler = :__all__, &b)
click to toggle source
convert body to format
# File lib/siresta/api.rb, line 129 def to_convert_to(format, handler = :__all__, &b) (settings.siresta[:convert_to][format] ||= {})[handler] = b end
to_validate_body(handler, &b)
click to toggle source
validate body
# File lib/siresta/api.rb, line 134 def to_validate_body(handler, &b) settings.siresta[:validate_body][handler] = b end
to_validate_params(handler, &b)
click to toggle source
validate params
# File lib/siresta/api.rb, line 139 def to_validate_params(handler, &b) settings.siresta[:validate_params][handler] = b end