forked from stevan/Jackalope-REST
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stevan Little
committed
Jan 22, 2011
1 parent
ec2ee8d
commit a68b662
Showing
5 changed files
with
277 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package Test::Jackalope::Fixtures::Manager::REST; | ||
use Moose; | ||
use Resource::Pack; | ||
|
||
our $VERSION = '0.01'; | ||
our $AUTHORITY = 'cpan:STEVAN'; | ||
|
||
extends 'Test::Jackalope::Fixtures::Manager'; | ||
|
||
has '+name' => ( default => __PACKAGE__ ); | ||
has '+fixtures_root' => ( | ||
default => sub { | ||
Path::Class::File->new( __FILE__ )->parent->parent | ||
}, | ||
); | ||
|
||
sub BUILD { | ||
my $self = shift; | ||
resource $self => as { | ||
resource 'REST' => as { | ||
install_from( $self->fixtures_root->subdir('REST') ); | ||
|
||
file 'resource' => 'resource.json'; | ||
file 'resource_ref' => 'resource_ref.json'; | ||
file 'service_crud' => 'service_crud.json'; | ||
}; | ||
}; | ||
} | ||
|
||
__PACKAGE__->meta->make_immutable; | ||
|
||
no Moose; no Resource::Pack; 1; | ||
|
||
|
||
__END__ | ||
=pod | ||
=head1 NAME | ||
Test::Jackalope::Fixtures::Manager::REST - A Moosey solution to this problem | ||
=head1 SYNOPSIS | ||
use Test::Jackalope::Fixtures::Manager::REST; | ||
=head1 DESCRIPTION | ||
=head1 METHODS | ||
=over 4 | ||
=item B<> | ||
=back | ||
=head1 BUGS | ||
All complex software has bugs lurking in it, and this module is no | ||
exception. If you find a bug please either email me, or add the bug | ||
to cpan-RT. | ||
=head1 AUTHOR | ||
Stevan Little E<lt>stevan.little@iinteractive.comE<gt> | ||
=head1 COPYRIGHT AND LICENSE | ||
Copyright 2011 Infinity Interactive, Inc. | ||
L<http://www.iinteractive.com> | ||
This library is free software; you can redistribute it and/or modify | ||
it under the same terms as Perl itself. | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
[ | ||
{ | ||
"schema" : { "$ref" : "jackalope/rest/resource" }, | ||
"pass" : [ | ||
{ | ||
"id" : "id:1010", | ||
"body" : "Data", | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [] | ||
}, | ||
{ | ||
"id" : "id:1010", | ||
"body" : "Data", | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403" | ||
}, | ||
{ | ||
"id" : "id:something", | ||
"body" : { | ||
"first_name" : "Stevan", | ||
"last_name" : "Little", | ||
"age" : 37 | ||
}, | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [ | ||
{ "rel" : "self", "href" : "/", "method" : "GET" }, | ||
{ "rel" : "create", "href" : "/", "method" : "POST" }, | ||
{ "rel" : "read", "href" : "/1", "method" : "GET" }, | ||
{ "rel" : "update", "href" : "/1", "method" : "PUT" }, | ||
{ "rel" : "delete", "href" : "/1", "method" : "DELETE" } | ||
] | ||
} | ||
], | ||
"fail" : [ | ||
{ | ||
"id" : "id:1010", | ||
"body" : "Data", | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : {} | ||
}, | ||
{ | ||
"id" : [], | ||
"body" : "Data", | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [] | ||
}, | ||
{ | ||
"body" : "Data", | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [] | ||
}, | ||
{ | ||
"id" : "id:1010", | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [] | ||
}, | ||
{ | ||
"id" : "id:1010", | ||
"body" : "Data", | ||
"links" : [] | ||
} | ||
] | ||
}, | ||
{ | ||
"schema" : { | ||
"extends" : { "$ref" : "jackalope/rest/resource" }, | ||
"properties" : { | ||
"body" : { | ||
"type" : "object", | ||
"properties" : { | ||
"first_name" : { "type" : "string" }, | ||
"last_name" : { "type" : "string" }, | ||
"age" : { "type" : "integer", "greater_than" : 0 } | ||
} | ||
} | ||
} | ||
}, | ||
"pass" : [ | ||
{ | ||
"id" : "id:something", | ||
"body" : { | ||
"first_name" : "Stevan", | ||
"last_name" : "Little", | ||
"age" : 37 | ||
}, | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [ | ||
{ "rel" : "self", "href" : "/", "method" : "GET" }, | ||
{ "rel" : "create", "href" : "/", "method" : "POST" }, | ||
{ "rel" : "read", "href" : "/1", "method" : "GET" }, | ||
{ "rel" : "update", "href" : "/1", "method" : "PUT" }, | ||
{ "rel" : "delete", "href" : "/1", "method" : "DELETE" } | ||
] | ||
} | ||
], | ||
"fail" : [ | ||
{ | ||
"id" : "id:1010", | ||
"body" : "Data", | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [] | ||
}, | ||
{ | ||
"id" : "id:1012", | ||
"body" : { "first_name" : "Stevan", "last_name" : "Little" }, | ||
"version" : "4162F712-1DD2-11B2-B17E-C09EFE1DC403", | ||
"links" : [] | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[ | ||
{ | ||
"schema" : { "$ref" : "jackalope/rest/resource/ref" }, | ||
"pass" : [ | ||
{ "$id" : "1", "type_of" : "some/simple/schema" }, | ||
{ "$id" : "1", "type_of" : "some/simple/schema", "version" : "2i29219jkjklewioewjklewk" }, | ||
{ | ||
"$id" : "1", | ||
"type_of" : "some/simple/schema", | ||
"version" : "2i29219jkjklewioewjklewk", | ||
"link" : { "rel" : "read", "method" : "GET", "href" : "some/simple/1" } | ||
}, | ||
{ | ||
"$id" : "1", | ||
"type_of" : "some/simple/schema", | ||
"link" : { "rel" : "read", "method" : "GET", "href" : "some/simple/1" } | ||
} | ||
], | ||
"fail" : [ | ||
{ "$id" : "1" }, | ||
{ "type_of" : "some/simple/schema" }, | ||
{ | ||
"$id" : "1", | ||
"type_of" : "some/simple/schema", | ||
"link" : { "rel" : "read", "method" : "POST", "href" : "some/simple/1" } | ||
}, | ||
{ | ||
"$id" : "1", | ||
"type_of" : "some/simple/schema", | ||
"link" : { "rel" : "create", "method" : "GET", "href" : "some/simple/1" } | ||
}, | ||
null, | ||
true, | ||
false, | ||
1, | ||
1.5, | ||
"Hello", | ||
[], | ||
[ 1, 5, 6 ], | ||
{ "foo" : "bar" } | ||
] | ||
}, | ||
{ | ||
"schema" : { | ||
"extends" : { "$ref" : "jackalope/rest/resource/ref" }, | ||
"properties" : { | ||
"type_of" : { "type" : "string", "literal" : "some/simple/schema" } | ||
} | ||
}, | ||
"pass" : [ | ||
{ "$id" : "1", "type_of" : "some/simple/schema" }, | ||
{ "$id" : "1", "type_of" : "some/simple/schema", "version" : "2i29219jkjklewioewjklewk" } | ||
], | ||
"fail" : [ | ||
{ "$id" : "1", "type_of" : "some/other/simple/schema" }, | ||
{ "$id" : "1" }, | ||
{ "type_of" : "some/simple/schema" }, | ||
null, | ||
true, | ||
false, | ||
1, | ||
1.5, | ||
"Hello", | ||
[], | ||
[ 1, 5, 6 ], | ||
{ "foo" : "bar" } | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
{ | ||
"schema" : { "$ref" : "jackalope/rest/service/crud" }, | ||
"pass" : [ | ||
{ "foo" : "bar" } | ||
], | ||
"fail" : [ | ||
null, | ||
true, | ||
false, | ||
1, | ||
1.5, | ||
"Hello", | ||
[], | ||
[ 1, 5, 6 ] | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters