aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ComponentUI/TestModel/Foo/SearchSpec.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ComponentUI/TestModel/Foo/SearchSpec.pm')
-rw-r--r--lib/ComponentUI/TestModel/Foo/SearchSpec.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/ComponentUI/TestModel/Foo/SearchSpec.pm b/lib/ComponentUI/TestModel/Foo/SearchSpec.pm
new file mode 100644
index 0000000..4664ec6
--- /dev/null
+++ b/lib/ComponentUI/TestModel/Foo/SearchSpec.pm
@@ -0,0 +1,24 @@
+package ComponentUI::TestModel::Foo::SearchSpec;
+use Reaction::Class;
+use namespace::autoclean;
+
+use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
+
+with 'Reaction::InterfaceModel::Search::Spec';
+
+has 'first_name' => (isa => NonEmptySimpleStr, is => 'rw', required => 0);
+has 'last_name' => (isa => NonEmptySimpleStr, is => 'rw', required => 0);
+
+sub _build__search_spec {
+ my($self) = @_;
+ my %search;
+ $search{first_name} = $self->first_name if $self->has_first_name;
+ $search{last_name} = $self->last_name if $self->has_last_name;
+ return [\%search];
+}
+
+# no special packing/unpacking required for Foo
+sub _to_string_pack_value { $_[1] }
+sub _from_string_unpack_value { $_[1] }
+
+1;