CatalystX-ExtJS-REST
view release on metacpan or search on metacpan
lib/CatalystX/Controller/ExtJS/REST.pm view on Meta::CPAN
#
# This file is part of CatalystX-ExtJS-REST
#
# This software is Copyright (c) 2014 by Moritz Onken.
#
# This is free software, licensed under:
#
# The (three-clause) BSD License
#
package CatalystX::Controller::ExtJS::REST;
# ABSTRACT: RESTful interface to dbic objects
$CatalystX::Controller::ExtJS::REST::VERSION = '2.1.3';
use Moose;
extends qw(Catalyst::Controller::REST);
use MooseX::MethodAttributes;
use Config::Any;
use Scalar::Util ();
use Carp qw/ croak /;
use HTML::FormFu::ExtJS 0.076;
use Path::Class;
use HTML::Entities;
use Lingua::EN::Inflect;
use JSON;
use Try::Tiny;
use Moose::Util::TypeConstraints;
subtype 'PathClassDir', as 'Path::Class::Dir';
coerce 'PathClassDir', from 'ArrayRef', via { Path::Class::Dir->new( @{$_[0]} ) };
coerce 'PathClassDir', from 'Str', via { Path::Class::Dir->new( $_[0] ) };
subtype 'PathClassFile', as 'Path::Class::File';
coerce 'PathClassFile', from 'ArrayRef', via { Path::Class::File->new( @{$_[0]} ) };
coerce 'PathClassFile', from 'Str', via { Path::Class::File->new( $_[0] ) };
no Moose::Util::TypeConstraints;
__PACKAGE__->config(
actions => {
begin => {
ActionClass => '+CatalystX::Action::ExtJS::Deserialize',
},
end => {
ActionClass => 'Serialize',
},
list => {
Chained => '/',
NSListPathPart => undef,
Args => undef,
Direct => undef,
DirectArgs => 1,
},
base => {
Chained => '/',
NSPathPart => undef,
CaptureArgs => 1,
},
object => {
Chained => '/',
NSPathPart => undef,
Args => undef,
ActionClass => '+CatalystX::Action::ExtJS::REST',
Direct => undef,
},
object_GET => { Private => undef },
object_PUT => { Private => undef },
object_POST => { Private => undef },
object_DELETE => { Private => undef },
}
);
has '_extjs_config' => ( is => 'rw', isa => 'HashRef', builder => '_extjs_config_builder', lazy => 1 );
has 'form_base_path' => ( is => 'rw', lazy_build => 1, isa => 'PathClassDir', coerce => 1 );
has 'form_base_file' => ( is => 'rw', lazy_build => 1, isa => 'PathClassFile', coerce => 1 );
has 'list_base_path' => ( is => 'rw', lazy_build => 1, isa => 'PathClassDir', coerce => 1 );
has 'list_base_file' => ( is => 'rw', lazy_build => 1, isa => 'PathClassFile', coerce => 1 );
has 'list_options_file' => ( is => 'rw', lazy_build => 1, isa => 'PathClassFile|Undef', coerce => 1 );
has 'form_config_cache' => ( is => 'rw', isa => 'HashRef', clearer => 'clear_form_config_cache', default => sub {{}});
has 'default_resultset' => ( is => 'rw', isa => 'Str', lazy_build => 1 );
( run in 0.847 second using v1.01-cache-2.11-cpan-5fbc6bb55f2 )