[Bps-public-commit] rtx-rest branch, master, updated. 882e1ac0dff887defba73766b3a418e0bab4a185

Wallace Reis wreis at bestpractical.com
Mon Dec 15 13:47:25 EST 2014


The branch, master has been updated
       via  882e1ac0dff887defba73766b3a418e0bab4a185 (commit)
       via  dc41b049646cd554b54be0cd056efab748b9fa22 (commit)
       via  494d1fd277b68b5dce37e6eb066ba54fca98f323 (commit)
      from  fd0748c15add2ef490d891616865f99e476986e4 (commit)

Summary of changes:
 .gitignore                                             |  1 -
 META.yml                                               |  2 +-
 Makefile.PL                                            |  6 +++---
 README                                                 | 12 ++++++------
 TODO                                                   | 14 ++++++++++++++
 lib/{RTx/REST.pm => RT/Extension/REST2.pm}             | 18 ++++++++++--------
 lib/{RTx/REST => RT/Extension/REST2}/Resource.pm       |  2 +-
 .../REST => RT/Extension/REST2}/Resource/Collection.pm |  6 +++---
 .../REST2}/Resource/Collection/ProcessPOSTasGET.pm     |  2 +-
 .../REST2}/Resource/Collection/QueryByJSON.pm          |  6 +++---
 .../Extension/REST2}/Resource/Download/CF.pm           |  4 ++--
 lib/RT/Extension/REST2/Resource/Queue.pm               | 15 +++++++++++++++
 lib/RT/Extension/REST2/Resource/Queues.pm              | 13 +++++++++++++
 .../REST => RT/Extension/REST2}/Resource/Record.pm     | 10 +++++-----
 .../Extension/REST2}/Resource/Record/Deletable.pm      |  2 +-
 .../REST2}/Resource/Record/DeletableByDisabling.pm     |  4 ++--
 .../Extension/REST2}/Resource/Record/Readable.pm       |  4 ++--
 .../Extension/REST2}/Resource/Record/Writable.pm       |  6 +++---
 .../REST2}/Resource/Role/RequestBodyIsJSON.pm          |  4 ++--
 .../REST => RT/Extension/REST2}/Resource/Ticket.pm     | 10 +++++-----
 .../REST => RT/Extension/REST2}/Resource/Tickets.pm    |  8 ++++----
 lib/{RTx/REST => RT/Extension/REST2}/Resource/User.pm  | 10 +++++-----
 lib/{RTx/REST => RT/Extension/REST2}/Resource/Users.pm |  6 +++---
 lib/{RTx/REST => RT/Extension/REST2}/Util.pm           |  6 +++---
 lib/RTx/REST/Resource/Queue.pm                         | 15 ---------------
 lib/RTx/REST/Resource/Queues.pm                        | 13 -------------
 26 files changed, 107 insertions(+), 92 deletions(-)
 rename lib/{RTx/REST.pm => RT/Extension/REST2.pm} (94%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource.pm (91%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Collection.pm (94%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Collection/ProcessPOSTasGET.pm (83%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Collection/QueryByJSON.pm (85%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Download/CF.pm (91%)
 create mode 100644 lib/RT/Extension/REST2/Resource/Queue.pm
 create mode 100644 lib/RT/Extension/REST2/Resource/Queues.pm
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Record.pm (82%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Record/Deletable.pm (87%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Record/DeletableByDisabling.pm (70%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Record/Readable.pm (85%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Record/Writable.pm (91%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Role/RequestBodyIsJSON.pm (90%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Ticket.pm (60%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Tickets.pm (81%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/User.pm (67%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Resource/Users.pm (72%)
 rename lib/{RTx/REST => RT/Extension/REST2}/Util.pm (95%)
 delete mode 100644 lib/RTx/REST/Resource/Queue.pm
 delete mode 100644 lib/RTx/REST/Resource/Queues.pm

- Log -----------------------------------------------------------------
commit 494d1fd277b68b5dce37e6eb066ba54fca98f323
Author: Wallace Reis <wreis at bestpractical.com>
Date:   Tue Sep 16 16:31:40 2014 -0300

    Add notes for TODO

diff --git a/TODO b/TODO
index 0ecd31a..f39e009 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,21 @@
 Find TODOs in the code via `ag TODO`.
 
+* Testing
+* Rename to RT::Extension::REST2
+* Implement main endpoints:
+  - /tickets
+  - /users
+  - /groups
+  - /queues
+  - /articles
+  - /customfields
+  - /scrips
+  - /roles
+  - /templates
+* Rename REST->app method: to_app and possibly add to_psgi_app alias
+* Implement Basic HTTP authen
+* Remove any session mocking
+
 XXX TODO: Include Links in record serializations
 XXX TODO: Serialized resources for CFs, Links, Groups
 XXX TODO: History + attachments

commit dc41b049646cd554b54be0cd056efab748b9fa22
Author: Wallace Reis <wreis at bestpractical.com>
Date:   Tue Sep 16 18:11:32 2014 -0300

    Rename REST->app function

diff --git a/TODO b/TODO
index f39e009..52fc908 100644
--- a/TODO
+++ b/TODO
@@ -12,7 +12,6 @@ Find TODOs in the code via `ag TODO`.
   - /scrips
   - /roles
   - /templates
-* Rename REST->app method: to_app and possibly add to_psgi_app alias
 * Implement Basic HTTP authen
 * Remove any session mocking
 
diff --git a/lib/RTx/REST.pm b/lib/RTx/REST.pm
index 5504c07..6cc6564 100644
--- a/lib/RTx/REST.pm
+++ b/lib/RTx/REST.pm
@@ -178,7 +178,9 @@ sub resource {
     )->to_app;
 }
 
-sub app {
+sub to_psgi_app { shift->to_app(@_) }
+
+sub to_app {
     my $class = shift;
     return sub {
         my ($env) = @_;
@@ -220,7 +222,7 @@ sub app {
 sub PSGIWrap {
     my ($class, $app) = @_;
     builder {
-        mount "/REST/2.0"   => $class->app;
+        mount "/REST/2.0"   => $class->to_app;
         mount "/"           => $app;
     };
 }

commit 882e1ac0dff887defba73766b3a418e0bab4a185
Author: Wallace Reis <wreis at bestpractical.com>
Date:   Mon Dec 15 15:17:23 2014 -0200

    Rename to RT::Extension::REST2

diff --git a/.gitignore b/.gitignore
index 30a15b4..fef4d9a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@ pm_to_blib*
 .lwpcookies
 cover_db
 pod2htm*.tmp
-/RTx-REST*
 *.bak
 *.swp
 /MYMETA.*
diff --git a/META.yml b/META.yml
index 89b5048..724889b 100644
--- a/META.yml
+++ b/META.yml
@@ -13,7 +13,7 @@ license: gplv2
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
   version: 1.4
-name: RTx-REST
+name: RT-Extension-REST2
 no_index:
   directory:
     - inc
diff --git a/Makefile.PL b/Makefile.PL
index 8417b11..ff9b102 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,8 +1,8 @@
 use inc::Module::Install;
 
-RTx 'RTx-REST';
-all_from 'lib/RTx/REST.pm';
-readme_from 'lib/RTx/REST.pm';
+RTx 'RT-Extension-REST2';
+all_from 'lib/RT/Extension/REST2.pm';
+readme_from 'lib/RT/Extension/REST2.pm';
 license  'gplv2';
 
 requires_rt('4.2.4');
diff --git a/README b/README
index e3ba8d3..74efd22 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 NAME
-    RTx-REST - Adds a modern REST API to RT under /REST/2.0/
+    RT-Extension-REST2 - Adds a modern REST API to RT under /REST/2.0/
 
 INSTALLATION
     "perl Makefile.PL"
@@ -10,9 +10,9 @@ INSTALLATION
     Edit your /opt/rt4/etc/RT_SiteConfig.pm
         Add this line:
 
-            Set(@Plugins, qw(RTx::REST));
+            Set(@Plugins, qw(RT::Extension::REST2));
 
-        or add "RTx::REST" to your existing @Plugins line.
+        or add "RT::Extension::REST2" to your existing @Plugins line.
 
     Clear your mason cache
             rm -rf /opt/rt4/var/mason_data/obj
@@ -23,9 +23,9 @@ AUTHOR
     Thomas Sibley <trs at bestpractical.com>
 
 BUGS
-    All bugs should be reported via email to bug-RTx-REST at rt.cpan.org
-    <mailto:bug-RTx-REST at rt.cpan.org> or via the web at rt.cpan.org
-    <http://rt.cpan.org/Public/Dist/Display.html?Name=RTx-REST>.
+    All bugs should be reported via email to bug-RT-Extension-REST2 at rt.cpan.org
+    <mailto:bug-RT-Extension-REST2 at rt.cpan.org> or via the web at rt.cpan.org
+    <http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-REST2>.
 
 LICENSE AND COPYRIGHT
     This software is Copyright (c) 2013 by Best Practical Solutions
diff --git a/TODO b/TODO
index 52fc908..f783fad 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
 Find TODOs in the code via `ag TODO`.
 
 * Testing
-* Rename to RT::Extension::REST2
 * Implement main endpoints:
   - /tickets
   - /users
diff --git a/lib/RTx/REST.pm b/lib/RT/Extension/REST2.pm
similarity index 95%
rename from lib/RTx/REST.pm
rename to lib/RT/Extension/REST2.pm
index 6cc6564..55b00d7 100644
--- a/lib/RTx/REST.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 use 5.010;
 
-package RTx::REST;
+package RT::Extension::REST2;
 
 our $VERSION = '0.01';
 
@@ -14,7 +14,7 @@ use Web::Machine;
 
 =head1 NAME
 
-RTx-REST - Adds a modern REST API to RT under /REST/2.0/
+RT-Extension-REST2 - Adds a modern REST API to RT under /REST/2.0/
 
 =head1 USAGE
 
@@ -174,7 +174,7 @@ sub resources {
 
 sub resource {
     Web::Machine->new(
-        resource => "RTx::REST::Resource::$_[0]",
+        resource => "RT::Extension::REST2::Resource::$_[0]",
     )->to_app;
 }
 
@@ -251,7 +251,7 @@ May need root permissions
 
 Add this line:
 
-    Plugin('RTx::REST');
+    Plugin('RT::Extension::REST2');
 
 =item Clear your mason cache
 
@@ -268,9 +268,9 @@ Thomas Sibley <trs at bestpractical.com>
 =head1 BUGS
 
 All bugs should be reported via email to
-L<bug-RTx-REST at rt.cpan.org|mailto:bug-RTx-REST at rt.cpan.org>
+L<bug-RT-Extension-REST2 at rt.cpan.org|mailto:bug-RT-Extension-REST2 at rt.cpan.org>
 or via the web at
-L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RTx-REST>.
+L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-REST2>.
 
 =head1 LICENSE AND COPYRIGHT
 
diff --git a/lib/RTx/REST/Resource.pm b/lib/RT/Extension/REST2/Resource.pm
similarity index 91%
rename from lib/RTx/REST/Resource.pm
rename to lib/RT/Extension/REST2/Resource.pm
index b128e18..4e34614 100644
--- a/lib/RTx/REST/Resource.pm
+++ b/lib/RT/Extension/REST2/Resource.pm
@@ -1,4 +1,4 @@
-package RTx::REST::Resource;
+package RT::Extension::REST2::Resource;
 use strict;
 use warnings;
 
diff --git a/lib/RTx/REST/Resource/Collection.pm b/lib/RT/Extension/REST2/Resource/Collection.pm
similarity index 94%
rename from lib/RTx/REST/Resource/Collection.pm
rename to lib/RT/Extension/REST2/Resource/Collection.pm
index 0706762..daf733e 100644
--- a/lib/RTx/REST/Resource/Collection.pm
+++ b/lib/RT/Extension/REST2/Resource/Collection.pm
@@ -1,17 +1,17 @@
-package RTx::REST::Resource::Collection;
+package RT::Extension::REST2::Resource::Collection;
 use strict;
 use warnings;
 
 use Moose;
 use namespace::autoclean;
 
-extends 'RTx::REST::Resource';
+extends 'RT::Extension::REST2::Resource';
 
 use Scalar::Util qw( blessed );
 use Web::Machine::Util qw( bind_path create_date );
 use Web::Machine::FSM::States qw( is_status_code );
 use Module::Runtime qw( require_module );
-use RTx::REST::Util qw( serialize_record );
+use RT::Extension::REST2::Util qw( serialize_record );
 
 has 'collection_class' => (
     is          => 'ro',
diff --git a/lib/RTx/REST/Resource/Collection/ProcessPOSTasGET.pm b/lib/RT/Extension/REST2/Resource/Collection/ProcessPOSTasGET.pm
similarity index 83%
rename from lib/RTx/REST/Resource/Collection/ProcessPOSTasGET.pm
rename to lib/RT/Extension/REST2/Resource/Collection/ProcessPOSTasGET.pm
index a479e0b..a4ab62c 100644
--- a/lib/RTx/REST/Resource/Collection/ProcessPOSTasGET.pm
+++ b/lib/RT/Extension/REST2/Resource/Collection/ProcessPOSTasGET.pm
@@ -1,4 +1,4 @@
-package RTx::REST::Resource::Collection::ProcessPOSTasGET;
+package RT::Extension::REST2::Resource::Collection::ProcessPOSTasGET;
 use strict;
 use warnings;
 
diff --git a/lib/RTx/REST/Resource/Collection/QueryByJSON.pm b/lib/RT/Extension/REST2/Resource/Collection/QueryByJSON.pm
similarity index 85%
rename from lib/RTx/REST/Resource/Collection/QueryByJSON.pm
rename to lib/RT/Extension/REST2/Resource/Collection/QueryByJSON.pm
index e0362fe..31d505f 100644
--- a/lib/RTx/REST/Resource/Collection/QueryByJSON.pm
+++ b/lib/RT/Extension/REST2/Resource/Collection/QueryByJSON.pm
@@ -1,4 +1,4 @@
-package RTx::REST::Resource::Collection::QueryByJSON;
+package RT::Extension::REST2::Resource::Collection::QueryByJSON;
 use strict;
 use warnings;
 
@@ -7,8 +7,8 @@ use namespace::autoclean;
 
 use JSON ();
 
-with 'RTx::REST::Resource::Collection::ProcessPOSTasGET';
-with 'RTx::REST::Resource::Role::RequestBodyIsJSON'
+with 'RT::Extension::REST2::Resource::Collection::ProcessPOSTasGET';
+with 'RT::Extension::REST2::Resource::Role::RequestBodyIsJSON'
      => { type => 'ARRAY' };
 
 requires 'collection';
diff --git a/lib/RTx/REST/Resource/Download/CF.pm b/lib/RT/Extension/REST2/Resource/Download/CF.pm
similarity index 91%
rename from lib/RTx/REST/Resource/Download/CF.pm
rename to lib/RT/Extension/REST2/Resource/Download/CF.pm
index 06b5987..5c48762 100644
--- a/lib/RTx/REST/Resource/Download/CF.pm
+++ b/lib/RT/Extension/REST2/Resource/Download/CF.pm
@@ -1,11 +1,11 @@
-package RTx::REST::Resource::Download::CF;
+package RT::Extension::REST2::Resource::Download::CF;
 use strict;
 use warnings;
 
 use Moose;
 use namespace::autoclean;
 
-extends 'RTx::REST::Resource::Record';
+extends 'RT::Extension::REST2::Resource::Record';
 
 has 'content_type' => (
     is          => 'ro',
diff --git a/lib/RT/Extension/REST2/Resource/Queue.pm b/lib/RT/Extension/REST2/Resource/Queue.pm
new file mode 100644
index 0000000..0c169eb
--- /dev/null
+++ b/lib/RT/Extension/REST2/Resource/Queue.pm
@@ -0,0 +1,15 @@
+package RT::Extension::REST2::Resource::Queue;
+use strict;
+use warnings;
+
+use Moose;
+use namespace::autoclean;
+
+extends 'RT::Extension::REST2::Resource::Record';
+with 'RT::Extension::REST2::Resource::Record::Readable';
+with 'RT::Extension::REST2::Resource::Record::DeletableByDisabling';
+with 'RT::Extension::REST2::Resource::Record::Writable';
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/lib/RT/Extension/REST2/Resource/Queues.pm b/lib/RT/Extension/REST2/Resource/Queues.pm
new file mode 100644
index 0000000..82d9431
--- /dev/null
+++ b/lib/RT/Extension/REST2/Resource/Queues.pm
@@ -0,0 +1,13 @@
+package RT::Extension::REST2::Resource::Queues;
+use strict;
+use warnings;
+
+use Moose;
+use namespace::autoclean;
+
+extends 'RT::Extension::REST2::Resource::Collection';
+with 'RT::Extension::REST2::Resource::Collection::QueryByJSON';
+
+__PACKAGE__->meta->make_immutable;
+
+1;
diff --git a/lib/RTx/REST/Resource/Record.pm b/lib/RT/Extension/REST2/Resource/Record.pm
similarity index 82%
rename from lib/RTx/REST/Resource/Record.pm
rename to lib/RT/Extension/REST2/Resource/Record.pm
index 217a58d..607be90 100644
--- a/lib/RTx/REST/Resource/Record.pm
+++ b/lib/RT/Extension/REST2/Resource/Record.pm
@@ -1,11 +1,11 @@
-package RTx::REST::Resource::Record;
+package RT::Extension::REST2::Resource::Record;
 use strict;
 use warnings;
 
 use Moose;
 use namespace::autoclean;
 
-extends 'RTx::REST::Resource';
+extends 'RT::Extension::REST2::Resource';
 
 use Scalar::Util qw( blessed );
 use Web::Machine::Util qw( bind_path create_date );
@@ -69,9 +69,9 @@ sub last_modified {
 sub allowed_methods {
     my $self = shift;
     my @ok;
-    push @ok, 'GET', 'HEAD' if $self->DOES("RTx::REST::Resource::Record::Readable");
-    push @ok, 'DELETE'      if $self->DOES("RTx::REST::Resource::Record::Deletable");
-    push @ok, 'PUT', 'POST' if $self->DOES("RTx::REST::Resource::Record::Writable");
+    push @ok, 'GET', 'HEAD' if $self->DOES("RT::Extension::REST2::Resource::Record::Readable");
+    push @ok, 'DELETE'      if $self->DOES("RT::Extension::REST2::Resource::Record::Deletable");
+    push @ok, 'PUT', 'POST' if $self->DOES("RT::Extension::REST2::Resource::Record::Writable");
     return \@ok;
 }
 
diff --git a/lib/RTx/REST/Resource/Record/Deletable.pm b/lib/RT/Extension/REST2/Resource/Record/Deletable.pm
similarity index 87%
rename from lib/RTx/REST/Resource/Record/Deletable.pm
rename to lib/RT/Extension/REST2/Resource/Record/Deletable.pm
index d684866..9eed813 100644
--- a/lib/RTx/REST/Resource/Record/Deletable.pm
+++ b/lib/RT/Extension/REST2/Resource/Record/Deletable.pm
@@ -1,4 +1,4 @@
-package RTx::REST::Resource::Record::Deletable;
+package RT::Extension::REST2::Resource::Record::Deletable;
 use strict;
 use warnings;
 
diff --git a/lib/RTx/REST/Resource/Record/DeletableByDisabling.pm b/lib/RT/Extension/REST2/Resource/Record/DeletableByDisabling.pm
similarity index 70%
rename from lib/RTx/REST/Resource/Record/DeletableByDisabling.pm
rename to lib/RT/Extension/REST2/Resource/Record/DeletableByDisabling.pm
index a5ecb7e..d88da79 100644
--- a/lib/RTx/REST/Resource/Record/DeletableByDisabling.pm
+++ b/lib/RT/Extension/REST2/Resource/Record/DeletableByDisabling.pm
@@ -1,11 +1,11 @@
-package RTx::REST::Resource::Record::DeletableByDisabling;
+package RT::Extension::REST2::Resource::Record::DeletableByDisabling;
 use strict;
 use warnings;
 
 use Moose::Role;
 use namespace::autoclean;
 
-with 'RTx::REST::Resource::Record::Deletable';
+with 'RT::Extension::REST2::Resource::Record::Deletable';
 
 sub delete_resource {
     my $self = shift;
diff --git a/lib/RTx/REST/Resource/Record/Readable.pm b/lib/RT/Extension/REST2/Resource/Record/Readable.pm
similarity index 85%
rename from lib/RTx/REST/Resource/Record/Readable.pm
rename to lib/RT/Extension/REST2/Resource/Record/Readable.pm
index 2ba09d4..6003f2a 100644
--- a/lib/RTx/REST/Resource/Record/Readable.pm
+++ b/lib/RT/Extension/REST2/Resource/Record/Readable.pm
@@ -1,4 +1,4 @@
-package RTx::REST::Resource::Record::Readable;
+package RT::Extension::REST2::Resource::Record::Readable;
 use strict;
 use warnings;
 
@@ -11,7 +11,7 @@ requires 'current_user';
 requires 'base_uri';
 
 use JSON ();
-use RTx::REST::Util qw( serialize_record );
+use RT::Extension::REST2::Util qw( serialize_record );
 
 sub serialize {
     my $self = shift;
diff --git a/lib/RTx/REST/Resource/Record/Writable.pm b/lib/RT/Extension/REST2/Resource/Record/Writable.pm
similarity index 91%
rename from lib/RTx/REST/Resource/Record/Writable.pm
rename to lib/RT/Extension/REST2/Resource/Record/Writable.pm
index 5d2bda7..e6272ba 100644
--- a/lib/RTx/REST/Resource/Record/Writable.pm
+++ b/lib/RT/Extension/REST2/Resource/Record/Writable.pm
@@ -1,13 +1,13 @@
-package RTx::REST::Resource::Record::Writable;
+package RT::Extension::REST2::Resource::Record::Writable;
 use strict;
 use warnings;
 
 use Moose::Role;
 use namespace::autoclean;
 use JSON ();
-use RTx::REST::Util qw( deserialize_record error_as_json );
+use RT::Extension::REST2::Util qw( deserialize_record error_as_json );
 
-with 'RTx::REST::Resource::Role::RequestBodyIsJSON'
+with 'RT::Extension::REST2::Resource::Role::RequestBodyIsJSON'
      => { type => 'HASH' };
 
 requires 'record';
diff --git a/lib/RTx/REST/Resource/Role/RequestBodyIsJSON.pm b/lib/RT/Extension/REST2/Resource/Role/RequestBodyIsJSON.pm
similarity index 90%
rename from lib/RTx/REST/Resource/Role/RequestBodyIsJSON.pm
rename to lib/RT/Extension/REST2/Resource/Role/RequestBodyIsJSON.pm
index 5c410fb..2d571cc 100644
--- a/lib/RTx/REST/Resource/Role/RequestBodyIsJSON.pm
+++ b/lib/RT/Extension/REST2/Resource/Role/RequestBodyIsJSON.pm
@@ -1,4 +1,4 @@
-package RTx::REST::Resource::Role::RequestBodyIsJSON;
+package RT::Extension::REST2::Resource::Role::RequestBodyIsJSON;
 use strict;
 use warnings;
 
@@ -6,7 +6,7 @@ use MooseX::Role::Parameterized;
 use namespace::autoclean;
 
 use JSON ();
-use RTx::REST::Util qw( error_as_json );
+use RT::Extension::REST2::Util qw( error_as_json );
 use Moose::Util::TypeConstraints qw( enum );
 
 parameter 'type' => (
diff --git a/lib/RTx/REST/Resource/Ticket.pm b/lib/RT/Extension/REST2/Resource/Ticket.pm
similarity index 60%
rename from lib/RTx/REST/Resource/Ticket.pm
rename to lib/RT/Extension/REST2/Resource/Ticket.pm
index b09ba9e..99b26d8 100644
--- a/lib/RTx/REST/Resource/Ticket.pm
+++ b/lib/RT/Extension/REST2/Resource/Ticket.pm
@@ -1,14 +1,14 @@
-package RTx::REST::Resource::Ticket;
+package RT::Extension::REST2::Resource::Ticket;
 use strict;
 use warnings;
 
 use Moose;
 use namespace::autoclean;
 
-extends 'RTx::REST::Resource::Record';
-with 'RTx::REST::Resource::Record::Readable';
-with 'RTx::REST::Resource::Record::Deletable';
-with 'RTx::REST::Resource::Record::Writable';
+extends 'RT::Extension::REST2::Resource::Record';
+with 'RT::Extension::REST2::Resource::Record::Readable';
+with 'RT::Extension::REST2::Resource::Record::Deletable';
+with 'RT::Extension::REST2::Resource::Record::Writable';
 
 sub forbidden {
     my $self = shift;
diff --git a/lib/RTx/REST/Resource/Tickets.pm b/lib/RT/Extension/REST2/Resource/Tickets.pm
similarity index 81%
rename from lib/RTx/REST/Resource/Tickets.pm
rename to lib/RT/Extension/REST2/Resource/Tickets.pm
index 9ca56f8..5f1f5b7 100644
--- a/lib/RTx/REST/Resource/Tickets.pm
+++ b/lib/RT/Extension/REST2/Resource/Tickets.pm
@@ -1,15 +1,15 @@
-package RTx::REST::Resource::Tickets;
+package RT::Extension::REST2::Resource::Tickets;
 use strict;
 use warnings;
 
 use Moose;
 use namespace::autoclean;
 
-extends 'RTx::REST::Resource::Collection';
-with 'RTx::REST::Resource::Collection::ProcessPOSTasGET';
+extends 'RT::Extension::REST2::Resource::Collection';
+with 'RT::Extension::REST2::Resource::Collection::ProcessPOSTasGET';
 
 use Encode qw( decode_utf8 );
-use RTx::REST::Util qw( error_as_json );
+use RT::Extension::REST2::Util qw( error_as_json );
 use RT::Search::Simple;
 
 has 'query' => (
diff --git a/lib/RTx/REST/Resource/User.pm b/lib/RT/Extension/REST2/Resource/User.pm
similarity index 67%
rename from lib/RTx/REST/Resource/User.pm
rename to lib/RT/Extension/REST2/Resource/User.pm
index 6459383..9d35b48 100644
--- a/lib/RTx/REST/Resource/User.pm
+++ b/lib/RT/Extension/REST2/Resource/User.pm
@@ -1,14 +1,14 @@
-package RTx::REST::Resource::User;
+package RT::Extension::REST2::Resource::User;
 use strict;
 use warnings;
 
 use Moose;
 use namespace::autoclean;
 
-extends 'RTx::REST::Resource::Record';
-with 'RTx::REST::Resource::Record::Readable';
-with 'RTx::REST::Resource::Record::DeletableByDisabling';
-with 'RTx::REST::Resource::Record::Writable';
+extends 'RT::Extension::REST2::Resource::Record';
+with 'RT::Extension::REST2::Resource::Record::Readable';
+with 'RT::Extension::REST2::Resource::Record::DeletableByDisabling';
+with 'RT::Extension::REST2::Resource::Record::Writable';
 
 around 'serialize' => sub {
     my $orig = shift;
diff --git a/lib/RTx/REST/Resource/Users.pm b/lib/RT/Extension/REST2/Resource/Users.pm
similarity index 72%
rename from lib/RTx/REST/Resource/Users.pm
rename to lib/RT/Extension/REST2/Resource/Users.pm
index f079759..13f4752 100644
--- a/lib/RTx/REST/Resource/Users.pm
+++ b/lib/RT/Extension/REST2/Resource/Users.pm
@@ -1,12 +1,12 @@
-package RTx::REST::Resource::Users;
+package RT::Extension::REST2::Resource::Users;
 use strict;
 use warnings;
 
 use Moose;
 use namespace::autoclean;
 
-extends 'RTx::REST::Resource::Collection';
-with 'RTx::REST::Resource::Collection::QueryByJSON';
+extends 'RT::Extension::REST2::Resource::Collection';
+with 'RT::Extension::REST2::Resource::Collection::QueryByJSON';
 
 sub searchable_fields {
     my $class = $_[0]->collection->RecordClass;
diff --git a/lib/RTx/REST/Util.pm b/lib/RT/Extension/REST2/Util.pm
similarity index 95%
rename from lib/RTx/REST/Util.pm
rename to lib/RT/Extension/REST2/Util.pm
index 9b3b26b..44f0329 100644
--- a/lib/RTx/REST/Util.pm
+++ b/lib/RT/Extension/REST2/Util.pm
@@ -1,4 +1,4 @@
-package RTx::REST::Util;
+package RT::Extension::REST2::Util;
 use strict;
 use warnings;
 
@@ -36,7 +36,7 @@ sub expand_uid {
     return {
         type    => $class,
         id      => $id,
-        _url    => RTx::REST->base_uri . "/$class/$id",
+        _url    => RT::Extension::REST2->base_uri . "/$class/$id",
     };
 }
 
@@ -106,7 +106,7 @@ sub serialize_record {
                     $content = {
                         content_type => $ocfv->ContentType,
                         filename     => $content,
-                        _url         => RTx::REST->base_uri . "/download/cf/" . $ocfv->id,
+                        _url         => RT::Extension::REST2->base_uri . "/download/cf/" . $ocfv->id,
                     };
                 }
                 push @$values, $content;
diff --git a/lib/RTx/REST/Resource/Queue.pm b/lib/RTx/REST/Resource/Queue.pm
deleted file mode 100644
index d647738..0000000
--- a/lib/RTx/REST/Resource/Queue.pm
+++ /dev/null
@@ -1,15 +0,0 @@
-package RTx::REST::Resource::Queue;
-use strict;
-use warnings;
-
-use Moose;
-use namespace::autoclean;
-
-extends 'RTx::REST::Resource::Record';
-with 'RTx::REST::Resource::Record::Readable';
-with 'RTx::REST::Resource::Record::DeletableByDisabling';
-with 'RTx::REST::Resource::Record::Writable';
-
-__PACKAGE__->meta->make_immutable;
-
-1;
diff --git a/lib/RTx/REST/Resource/Queues.pm b/lib/RTx/REST/Resource/Queues.pm
deleted file mode 100644
index d19355f..0000000
--- a/lib/RTx/REST/Resource/Queues.pm
+++ /dev/null
@@ -1,13 +0,0 @@
-package RTx::REST::Resource::Queues;
-use strict;
-use warnings;
-
-use Moose;
-use namespace::autoclean;
-
-extends 'RTx::REST::Resource::Collection';
-with 'RTx::REST::Resource::Collection::QueryByJSON';
-
-__PACKAGE__->meta->make_immutable;
-
-1;

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list