Class: HelloAPI

Inherits:
K8::Action show all
Defined in:
lib/keight/skeleton/app/api/hello.rb

Overview

or My::Action

Instance Attribute Summary

Attributes inherited from K8::BaseAction

#req, #resp, #sess

Instance Method Summary collapse

Methods inherited from K8::BaseAction

#handle_action, #initialize

Constructor Details

This class inherits a constructor from K8::BaseAction

Instance Method Details

#do_createObject



21
22
23
24
# File 'lib/keight/skeleton/app/api/hello.rb', line 21

def do_create()
  form = @req.params_form   # or @req.params_json
  {"action"=>"create", "form"=>form}
end

#do_delete(id) ⇒ Object



35
36
37
# File 'lib/keight/skeleton/app/api/hello.rb', line 35

def do_delete(id)
  {"action"=>"delete", "id"=>id}
end

#do_indexObject

or if you want support ‘/hello.json’ and ‘/hello/123.json’: mapping ‘ext’ , :GET=>:do_index, :POST=>:do_create mapping ‘/idext’ , :GET=>:do_show, :PUT=>:do_update, :DELETE=>:do_delete



16
17
18
19
# File 'lib/keight/skeleton/app/api/hello.rb', line 16

def do_index()
  query = @req.params_query   # QUERY_STRING
  {"action"=>"index", "query"=>query}
end

#do_show(id) ⇒ Object



26
27
28
# File 'lib/keight/skeleton/app/api/hello.rb', line 26

def do_show(id)
  {"action"=>"show", "id"=>id}
end

#do_update(id) ⇒ Object



30
31
32
33
# File 'lib/keight/skeleton/app/api/hello.rb', line 30

def do_update(id)
  form = @req.params_form   # or @req.params_json
  {"action"=>"update", "id"=>id, "form"=>form}
end