summary refs log tree commit diff
path: root/lib/MooseX/Net/API.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2009-12-09 10:57:51 +0100
committerfranck cuny <franck@lumberjaph.net>2009-12-09 10:57:51 +0100
commitf95098be1e6473d218f25678678d1c8ff289c55a (patch)
tree199af4eb22c8f946807c32012f8be494113b8a50 /lib/MooseX/Net/API.pm
parentChecking in changes prior to tagging of version 0.03. Changelog diff is: (diff)
downloadmoosex-net-api-f95098be1e6473d218f25678678d1c8ff289c55a.tar.gz
some cleaning
Diffstat (limited to '')
-rw-r--r--lib/MooseX/Net/API.pm25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/MooseX/Net/API.pm b/lib/MooseX/Net/API.pm
index 26710cc..e1c1f82 100644
--- a/lib/MooseX/Net/API.pm
+++ b/lib/MooseX/Net/API.pm
@@ -10,9 +10,8 @@ use Moose::Exporter;
 use MooseX::Net::API::Error;
 use MooseX::Net::API::Meta::Class;
 use MooseX::Net::API::Meta::Method;
-with qw/
-    MooseX::Net::API::Role::Serialize 
-    MooseX::Net::API::Role::Deserialize/;
+use MooseX::Net::API::Role::Serialize;
+use MooseX::Net::API::Role::Deserialize;
 
 our $VERSION = '0.03';
 
@@ -23,8 +22,6 @@ my $list_content_type = {
 };
 
 # XXX uri builder
-# XXX encoding
-# XXX decoding
 
 Moose::Exporter->setup_import_methods(
     with_caller => [qw/net_api_method net_api_declare/], );
@@ -110,10 +107,18 @@ sub net_api_declare {
         $auth_method = delete $options{authentication_method};
     }
 
-    if ($options{deserialisation} ) {
+    if ( $options{deserialisation} ) {
         $deserialize_method = delete $options{deserialize_order};
-    }else{
-        MooseX::Net::API::Role::Deserialize->meta->apply($caller->meta);
+    }
+    else {
+        MooseX::Net::API::Role::Deserialize->meta->apply( $caller->meta );
+    }
+
+    if ( $options{serialisation} ) {
+        $deserialize_method = delete $options{serialize_order};
+    }
+    else {
+        MooseX::Net::API::Role::Serialize->meta->apply( $caller->meta );
     }
 }
 
@@ -201,7 +206,7 @@ sub net_api_method {
                     @deserialize_order );
             }
             else {
-                $content = _do_deserialization( $self, $res->content,
+                $content = $self->_do_deserialization( $res->content,
                     @deserialize_order );
             }
 
@@ -268,7 +273,7 @@ sub _request {
     }
     elsif ( $method =~ /^(?:POST|PUT)$/ ) {
         $req = HTTP::Request->new( $method => $uri );
-        my $content = _do_serialization($self, $args, $format);
+        my $content = $self->_do_serialization( $args, $format);
         $req->content( $content );
     }
     else {