Sha256: beeea75f621b8c78830663cabac9d95a1015c6d5fa46727b600f4434c269d26c
Contents?: true
Size: 670 Bytes
Versions: 1
Compression:
Stored size: 670 Bytes
Contents
module Ki class BaseRequest < Rack::Request include Middleware::Helpers::FormatOf def root? path == '/' end def doc? path == '/instadoc' end def json? content_type == 'application/json' || format_of(path) == 'json' end def to_ki_model_class self.path.to_s.gsub('/','').gsub(format_of(path), '').gsub('.', '').to_class end def to_action case request_method when 'GET' :find when 'POST' :create when 'PUT' :update when 'DELETE' :delete when 'SEARCH' :find else raise 'unkown action' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ki-0.4.5 | lib/ki/base_request.rb |