[Bps-public-commit] rt-extension-rest2 branch, dev, created. 01097ac3f8b4ec357ffc58a3dd7ee5a07d46dfe7
Wallace Reis
wreis at bestpractical.com
Mon Jan 12 12:41:40 EST 2015
The branch, dev has been created
at 01097ac3f8b4ec357ffc58a3dd7ee5a07d46dfe7 (commit)
- Log -----------------------------------------------------------------
commit 5bded99ccb18ef9784e3e765982360722204e030
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jan 12 12:09:50 2015 -0200
Update README
diff --git a/README b/README
index 74efd22..09b7788 100644
--- a/README
+++ b/README
@@ -2,33 +2,173 @@ NAME
RT-Extension-REST2 - Adds a modern REST API to RT under /REST/2.0/
INSTALLATION
- "perl Makefile.PL"
- "make"
- "make install"
+ perl Makefile.PL
+ make
+ make install
May need root permissions
Edit your /opt/rt4/etc/RT_SiteConfig.pm
Add this line:
- Set(@Plugins, qw(RT::Extension::REST2));
-
- or add "RT::Extension::REST2" to your existing @Plugins line.
+ Plugin('RT::Extension::REST2');
Clear your mason cache
rm -rf /opt/rt4/var/mason_data/obj
Restart your webserver
+CONFIGURATION
+ $RESTPath
+ The relative path from $WebPath where you want to have the REST API
+ being served.
+
+ $RESTPath requires a leading / but no trailing /, or it can be
+ blank.
+
+ Defaults to /REST/2.0. Thus, if you have $WebPath set to /rt then
+ the base REST API URI will be like https://example.com/rt/REST/2.0.
+
+USAGE
+ Summary
+ Currently provided endpoints under /REST/2.0/ are:
+
+ GET /ticket/:id
+ PUT /ticket/:id <JSON body>
+ DELETE /ticket/:id
+ Sets ticket status to "deleted".
+
+ GET /queue/:id
+ PUT /queue/:id <JSON body>
+ DELETE /queue/:id
+ Disables the queue.
+
+ GET /user/:id
+ PUT /user/:id <JSON body>
+ DELETE /user/:id
+ Disables the user.
+
+ For queues and users, :id may be the numeric id or the unique name.
+
+ When a GET request is made, each endpoint returns a JSON representation
+ of the specified resource, or a 404 if not found.
+
+ When a PUT request is made, the request body should be a modified copy
+ (or partial copy) of the JSON representation of the specified resource,
+ and the record will be updated.
+
+ A DELETE request to a resource will delete or disable the underlying
+ record.
+
+ Creating
+ POST /ticket
+ POST /queue
+ POST /user
+
+ A POST request to a resource endpoint, without a specific id/name, will
+ create a new resource of that type. The request should have a JSON
+ payload similar to the ones returned for existing resources.
+
+ On success, the return status is 201 Created and a Location header
+ points to the new resource uri. On failure, the status code indicates
+ the nature of the issue, and a descriptive message is in the response
+ body.
+
+ Searching
+ Tickets
+ GET /tickets?query=<TicketSQL>
+ GET /tickets?simple=1;query=<simple search query>
+ POST /tickets
+ With the 'query' and optional 'simple' parameters
+
+ The query parameter expects TicketSQL by default unless a true value is
+ sent for the simple parameter.
+
+ Results are returned in the format described below.
+
+ Queues and users
+ POST /queues
+ POST /users
+
+ These resources accept a basic JSON structure as the search conditions
+ which specifies one or more fields to limit on (using specified
+ operators and values). An example:
+
+ curl -si -u user:pass https://rt.example.com/REST/2.0/queues -XPOST --data-binary '
+ [
+ { "field": "Name",
+ "operator": "LIKE",
+ "value": "Engineering" },
+
+ { "field": "Lifecycle",
+ "value": "helpdesk" }
+ ]
+ '
+
+ The JSON payload must be an array of hashes with the keys field and
+ value and optionally operator.
+
+ Results are returned in the format described below.
+
+ Example of plural resources (collections)
+ Resources which represent a collection of other resources use the
+ following standard JSON format:
+
+ {
+ "count" : 20,
+ "page" : 1,
+ "per_page" : 20,
+ "total" : 3810,
+ "items" : [
+ { … },
+ { … },
+ …
+ ]
+ }
+
+ Each item is nearly the same representation used when an individual
+ resource is requested.
+
+ Paging
+ All plural resources (such as /tickets) require pagination, controlled
+ by the query parameters page and per_page. The default page size is 20
+ items, but it may be increased up to 100 (or decreased if desired). Page
+ numbers start at 1.
+
+ Authentication
+ Authentication is limited to internal RT usernames and passwords,
+ provided via HTTP Basic auth. Most HTTP libraries already have a way of
+ providing basic auth credentials when making requests. Using curl, for
+ example:
+
+ curl -u username:password …
+
+ This sort of authentication should always be done over HTTPS/SSL for
+ security. You should only serve up the /REST/2.0/ endpoint over SSL.
+
+ Conditional requests (If-Modified-Since)
+ You can take advantage of the Last-Modified headers returned by most
+ single resource endpoints. Add a If-Modified-Since header to your
+ requests for the same resource, using the most recent Last-Modified
+ value seen, and the API may respond with a 304 Not Modified. You can
+ also use HEAD requests to check for updates without receiving the actual
+ content when there is a newer version.
+
+ Status codes
+ The REST API uses the full range of HTTP status codes, and your client
+ should handle them appropriately.
+
AUTHOR
- Thomas Sibley <trs at bestpractical.com>
+ Best Practical Solutions, LLC <modules at bestpractical.com>
BUGS
- 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
+ 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
+ This software is Copyright (c) 2015 by Best Practical Solutions, LLC.
This is free software, licensed under:
commit 765c529223fb30e0fe27ad20c0c3775177c4f1c2
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jan 12 15:35:19 2015 -0200
Bump perl version
RT 4.2 requires 5.10.1
diff --git a/lib/RT/Extension/REST2.pm b/lib/RT/Extension/REST2.pm
index 115bdbe..4c246e2 100644
--- a/lib/RT/Extension/REST2.pm
+++ b/lib/RT/Extension/REST2.pm
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use 5.010;
+use 5.010001;
package RT::Extension::REST2;
commit c431684fa71b8ba1432eaaa12a1768fb16c70a80
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jan 12 15:39:49 2015 -0200
Update META.yml
diff --git a/META.yml b/META.yml
index 724889b..c9eabec 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
---
-abstract: 'RT REST Extension'
+abstract: 'RT-Extension-REST2 Extension'
author:
- - 'Thomas Sibley <trs at bestpractical.com>'
+ - 'Best Practical Solutions, LLC <modules at bestpractical.com>'
build_requires:
ExtUtils::MakeMaker: 6.59
configure_requires:
@@ -17,18 +17,29 @@ name: RT-Extension-REST2
no_index:
directory:
- inc
+recommends:
+ JSON::XS: 0
requires:
+ Class::Method::Modifiers: 0
Encode: 0
JSON: 0
- Module::Pluggable: 0
+ Module::Path: 0
+ Module::Runtime: 0
Moose: 0
MooseX::NonMoose: 0
+ MooseX::Role::Parameterized: 0
Plack::Builder: 0
+ Plack::Middleware::RequestHeaders: 0
+ Plack::Middleware::ReverseProxyPath: 0
+ Pod::POM: 0
Scalar::Util: 0
- UNIVERSAL::require: 0
- Web::Machine: 0
+ Sub::Exporter: 0
+ Web::Machine: '0.12'
+ Web::Simple: 0
namespace::autoclean: 0
- perl: 5.10.0
+ perl: 5.10.1
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: 0.01
+version: '0.10'
+x_module_install_rtx_version: '0.37'
+x_requires_rt: 4.2.4
commit 01097ac3f8b4ec357ffc58a3dd7ee5a07d46dfe7
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jan 12 15:40:11 2015 -0200
Add repo info
diff --git a/META.yml b/META.yml
index c9eabec..9a91572 100644
--- a/META.yml
+++ b/META.yml
@@ -39,7 +39,9 @@ requires:
namespace::autoclean: 0
perl: 5.10.1
resources:
+ homepage: https://github.com/bestpractical/rt-extension-rest2/tree
license: http://opensource.org/licenses/gpl-license.php
+ repository: https://github.com/bestpractical/rt-extension-rest2.git
version: '0.10'
x_module_install_rtx_version: '0.37'
x_requires_rt: 4.2.4
diff --git a/Makefile.PL b/Makefile.PL
index 9e8859a..2171c7f 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -3,6 +3,8 @@ use inc::Module::Install;
RTx 'RT-Extension-REST2';
license 'gplv2';
+githubmeta('github');
+
requires_rt('4.2.4');
requires 'Encode';
diff --git a/inc/Module/Install/GithubMeta.pm b/inc/Module/Install/GithubMeta.pm
new file mode 100644
index 0000000..eabab2c
--- /dev/null
+++ b/inc/Module/Install/GithubMeta.pm
@@ -0,0 +1,53 @@
+#line 1
+package Module::Install::GithubMeta;
+
+use strict;
+use warnings;
+use Cwd;
+use base qw(Module::Install::Base);
+use vars qw($VERSION);
+
+$VERSION = '0.28';
+
+sub githubmeta {
+ my $self = shift;
+ return unless $Module::Install::AUTHOR;
+ return unless _under_git();
+ return unless $self->can_run('git');
+ my $remote = shift || 'origin';
+ local $ENV{LC_ALL}='C';
+ local $ENV{LANG}='C';
+ return unless my ($git_url) = `git remote show -n $remote` =~ /URL: (.*)$/m;
+ return unless $git_url =~ /github\.com/; # Not a Github repository
+ my $http_url = $git_url;
+ $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!;
+ $http_url =~ s![\w\-]+\@([^:]+):!https://$1/!;
+ $http_url =~ s!\.git$!/tree!;
+ $self->repository( $git_url );
+ $self->homepage( $http_url ) unless $self->homepage();
+ return 1;
+}
+
+sub _under_git {
+ return 1 if -e '.git';
+ my $cwd = getcwd;
+ my $last = $cwd;
+ my $found = 0;
+ while (1) {
+ chdir '..' or last;
+ my $current = getcwd;
+ last if $last eq $current;
+ $last = $current;
+ if ( -e '.git' ) {
+ $found = 1;
+ last;
+ }
+ }
+ chdir $cwd;
+ return $found;
+}
+
+'Github';
+__END__
+
+#line 113
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list