summaryrefslogtreecommitdiff
path: root/lib/Net/HTTP/Spore/Role
diff options
context:
space:
mode:
authorBrian Phillips <bphillips@cpan.org>2012-12-04 22:27:23 -0600
committerAsh Berlin <ash_github@firemirror.com>2013-04-19 14:21:43 +0100
commit80232d581e7a82f0ec8bd85d269a1604fdbe58c7 (patch)
tree25e542e234b6e84980377f32e6bcb60fd9f6e29c /lib/Net/HTTP/Spore/Role
parentsupport for anonymous middlewares (diff)
downloadnet-http-spore-80232d581e7a82f0ec8bd85d269a1604fdbe58c7.tar.gz
clean up types
- Split out type declarations into separate class - Use namespaced types instead of global types (via MooseX::Types) - use declared types where possible, instead of quoted type names (i.e. isa => Str, instead of isa => 'Str') - Allow "authentication" attribute to coerce from a JSON::is_bool() value (instead of expecting it to be a 1 or a 0 all the time)
Diffstat (limited to 'lib/Net/HTTP/Spore/Role')
-rw-r--r--lib/Net/HTTP/Spore/Role/Description.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Net/HTTP/Spore/Role/Description.pm b/lib/Net/HTTP/Spore/Role/Description.pm
index 2723fef..cad1084 100644
--- a/lib/Net/HTTP/Spore/Role/Description.pm
+++ b/lib/Net/HTTP/Spore/Role/Description.pm
@@ -3,7 +3,9 @@ package Net::HTTP::Spore::Role::Description;
# ABSTRACT: attributes for API description
use Moose::Role;
+use MooseX::Types::Moose qw/ArrayRef/;
use MooseX::Types::URI qw/Uri/;
+use Net::HTTP::Spore::Meta::Types qw/Boolean/;
has base_url => (
is => 'rw',
@@ -14,19 +16,20 @@ has base_url => (
has formats => (
is => 'rw',
- isa => 'ArrayRef',
+ isa => ArrayRef,
predicate => 'has_formats',
);
has authentication => (
is => 'rw',
- isa => 'Bool',
+ isa => Boolean,
predicate => 'has_authentication',
+ coerce => 1,
);
has expected_status => (
is => 'rw',
- isa => 'Array',
+ isa => ArrayRef,
lazy => 1,
default => sub { [] },
);