Make the generated action method fit better into what the StompTestApp::Controller...
[catagits/CatalystX-DynamicComponent.git] / t / lib / SomeModelClass.pm
index e956815..f3184f8 100644 (file)
@@ -1,6 +1,14 @@
+package SomeModelClassInterface;
+use Moose::Role;
+use namespace::autoclean;
+
+requires 'say_hello';
+
 package SomeModelClass;
 use Moose;
 use CatalystX::ControllerGeneratingModel;
+use DemoTypeLibrary qw/MessageDocument/;
+use MooseX::Lexical::Types qw/MessageDocument/;
 use namespace::autoclean;
 
 # Note trivial calling convention.
@@ -9,9 +17,23 @@ use namespace::autoclean;
 # Introspection should only reflect methods which satisfy the calling convention
 # This is left as an exercise to the reader. :)
 
+# Note command syntax not actually needed, this could be a normal sub,
+# but doing so makes the eventual merge harder..
+
 command say_hello => sub {
-    my ($self, $name) = @_;
-    return("Hello $name");
+    my ($self, $document) = @_;
+
+    my $name = $document->{name};
+    return({ type => 'say_hello_response',
+
+            body => "Hello $name" });
+};
+
+with 'SomeModelClassInterface';
+
+before 'say_hello' => sub {
+    my $self = shift;
+    my MessageDocument $message = shift;
 };
 
 __PACKAGE__->meta->make_immutable;