summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2009-12-04 09:51:31 +0100
committerfranck cuny <franck@lumberjaph.net>2009-12-04 09:51:31 +0100
commit3a1b11f0a8684c7d50d5ccae126f9027b526f10a (patch)
tree1e4260546b31423b77b2322f481a178cd3577c31
parentfix deserialisation (diff)
downloadmoosex-net-api-3a1b11f0a8684c7d50d5ccae126f9027b526f10a.tar.gz
move meta class and method to new file, add meta to handle tests
-rw-r--r--lib/MooseX/Net/API/Meta/Class.pm34
-rw-r--r--lib/MooseX/Net/API/Meta/Method.pm18
2 files changed, 52 insertions, 0 deletions
diff --git a/lib/MooseX/Net/API/Meta/Class.pm b/lib/MooseX/Net/API/Meta/Class.pm
new file mode 100644
index 0000000..80075f8
--- /dev/null
+++ b/lib/MooseX/Net/API/Meta/Class.pm
@@ -0,0 +1,34 @@
+package MooseX::Net::API::Meta::Class;
+
+use Moose::Role;
+use Moose::Meta::Class;
+use MooseX::Types::Moose qw(Str ArrayRef ClassName Object);
+
+has local_api_methods => (
+    traits     => ['Array'],
+    is         => 'ro',
+    isa        => ArrayRef [Str],
+    required   => 1,
+    default    => sub { [] },
+    auto_deref => 1,
+    handles    => { '_add_api_method' => 'push' },
+);
+has local_api_test_methods => (
+    traits     => ['Array'],
+    is         => 'ro',
+    isa        => ArrayRef [Str],
+    required   => 1,
+    default    => sub { [] },
+    auto_deref => 1,
+    handles    => { '_add_api_test_method' => 'push' },
+);
+
+sub _build_meta_class {
+    my $self = shift;
+    return Moose::Meta::Class->create_anon_class(
+        superclasses => [ $self->method_metaclass ],
+        cache        => 1,
+    );
+}
+
+1;
diff --git a/lib/MooseX/Net/API/Meta/Method.pm b/lib/MooseX/Net/API/Meta/Method.pm
new file mode 100644
index 0000000..74f9a07
--- /dev/null
+++ b/lib/MooseX/Net/API/Meta/Method.pm
@@ -0,0 +1,18 @@
+package MooseX::Net::API::Meta::Method;
+
+use Moose;
+extends 'Moose::Meta::Method';
+
+has description => ( is => 'ro', isa => 'Str' );
+has path        => ( is => 'ro', isa => 'Str', required => 1 );
+has method      => ( is => 'ro', isa => 'Str', required => 1 );
+has params      => ( is => 'ro', isa => 'ArrayRef', required => 0 );
+has required    => ( is => 'ro', isa => 'ArrayRef', required => 0 );
+
+sub new {
+    my $class = shift;
+    my %args  = @_;
+    $class->SUPER::wrap(@_);
+}
+
+1;