class TasksController

Overview

class TasksController < ActionController::Base

Defined in:

controllers/tasks.cr

Constant Summary

AFTER = {} of Nil => Nil

class TasksController < ActionController::Base

AROUND = {} of Nil => Nil

class TasksController < ActionController::Base

BEFORE = {find_task => {[show, update, destroy], nil}, set_request_id => {nil, nil}, set_date_header => {nil, nil}} of Nil => Nil

class TasksController < ActionController::Base

FORCE = {} of Nil => Nil

class TasksController < ActionController::Base

LOCAL_AFTER = {} of Nil => Nil

function => options

LOCAL_AROUND = {} of Nil => Nil

function => options

LOCAL_BEFORE = {find_task => {[show, update, destroy], nil}} of Nil => Nil

function => options

LOCAL_FORCE = {} of Nil => Nil

function => options

LOCAL_RESCUE = {JSON::SerializableError => {json_serializable_error, do |error| render(text: error.message, status: 500) end}, NotImplementedError => {not_implemented_error, do |exception| render(text: exception.message, status: 501) end}} of Nil => Nil

function => options

LOCAL_ROUTES = {options_ => {"options", "/", do response.headers["Access-Control-Allow-Origin"] = "*" response.headers["Access-Control-Allow-Methods"] = "GET, POST, PATCH, DELETE, HEAD, OPTIONS" response.headers["Access-Control-Allow-Headers"] = "Content-Type" end, false}, options__id => {"options", "/:id", do response.headers["Access-Control-Allow-Origin"] = "*" response.headers["Access-Control-Allow-Methods"] = "GET, POST, PATCH, DELETE, HEAD, OPTIONS" response.headers["Access-Control-Allow-Headers"] = "Content-Type" end, false}} of Nil => Nil

function => options

LOCAL_SKIP = {} of Nil => Nil

function => options

Log = ::Log.for("controller")
NAMESPACE = ["/tasks"]

default namespace based on class

RESCUE = {JSON::SerializableError => {json_serializable_error, do |error| render(text: error.message, status: 500) end}, NotImplementedError => {not_implemented_error, do |exception| render(text: exception.message, status: 501) end}} of Nil => Nil

class TasksController < ActionController::Base

ROUTES = {options_ => {"options", "/", do response.headers["Access-Control-Allow-Origin"] = "*" response.headers["Access-Control-Allow-Methods"] = "GET, POST, PATCH, DELETE, HEAD, OPTIONS" response.headers["Access-Control-Allow-Headers"] = "Content-Type" end, false}, options__id => {"options", "/:id", do response.headers["Access-Control-Allow-Origin"] = "*" response.headers["Access-Control-Allow-Methods"] = "GET, POST, PATCH, DELETE, HEAD, OPTIONS" response.headers["Access-Control-Allow-Headers"] = "Content-Type" end, false}, index => {"get", "/", nil, false}, show => {"get", "/:id", nil, false}, create => {"post", "/", nil, false}, update => {"patch", "/:id", nil, false}, destroy => {"delete", "/:id", nil, false}} of Nil => Nil

class TasksController < ActionController::Base

SKIP = {} of Nil => Nil

class TasksController < ActionController::Base

Class Method Summary

Instance Method Summary

Macro Summary

Instance methods inherited from class Application

set_date_header set_date_header, set_request_id set_request_id

Class methods inherited from class Application

context(method : String, route : String, route_params : Hash(String, String) | Nil = nil, headers : Hash(String, String) | Nil = nil, body : String | Bytes | IO | Nil = nil, &) context

Class Method Detail

def self.__init_routes__(router) #

Routes call the functions generated above


def self.__route_list__ #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.base_route #

Helper for obtaining base route


def self.context(method : String, route : String, route_params : Hash(String, String) | Nil = nil, headers : Hash(String, String) | Nil = nil, body : String | Bytes | IO | Nil = nil, &) #

class TasksController < ActionController::Base


[View source]
def self.create(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.delete__tasks__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.destroy(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.get__tasks_(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.get__tasks__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.index(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.options_(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Helper methods for performing redirect_to calls


def self.options__id(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.options__tasks_(context, head_request) #

Generate functions for each route


def self.options__tasks__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.patch__tasks__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.post__tasks_(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.show(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.update(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


Instance Method Detail

def base_route : String #

Helper for obtaining base route


def create #

POST /tasks/


[View source]
def destroy #

DELETE /tasks/:id


[View source]
def index #

CRUD methods GET /tasks/


[View source]
def json_serializable_error(error) #

Create functions as required for errors Skip the CRUD


def not_implemented_error(exception) #

Skip the CRUD


def options_ #

Create functions for named routes Skip the CRUD


def options__id #

Skip the CRUD


def show #

GET /tasks/:id


[View source]
def task : Task #

Lazy initialization via getter macro - https://crystal-lang.org/api/0.36.1/Object.html#getter(*names,&block)-macro


[View source]
def update #

PATCH /tasks/:id


[View source]

Macro Detail

macro __inherit_after_filters__ #

class TasksController < ActionController::Base


macro __inherit_around_filters__ #

class TasksController < ActionController::Base


macro __inherit_before_filters__ #

class TasksController < ActionController::Base


macro __inherit_force_filters__ #

class TasksController < ActionController::Base


macro __inherit_rescue_filters__ #

class TasksController < ActionController::Base


macro __inherit_routes_filters__ #

class TasksController < ActionController::Base


macro __inherit_skip_filters__ #

class TasksController < ActionController::Base