[Bps-public-commit] rt-extension-rest2 03/07: Abstract serialize_record to easily subclass for collection
sunnavy
sunnavy at bestpractical.com
Wed Jul 14 10:05:50 EDT 2021
This is an automated email from the git hooks/post-receive script.
sunnavy pushed a commit to branch saved-searches
in repository rt-extension-rest2.
commit 2c9b41c00269c02552a5dd38b431f2fb7662350e
Author: sunnavy <sunnavy at bestpractical.com>
AuthorDate: Tue May 25 23:05:27 2021 +0800
Abstract serialize_record to easily subclass for collection
This is initially for searches, which are stored in attributes, but we
don't want to show them as normal attributes.
---
lib/RT/Extension/REST2/Resource/Collection.pm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/RT/Extension/REST2/Resource/Collection.pm b/lib/RT/Extension/REST2/Resource/Collection.pm
index c27df40..7c74596 100644
--- a/lib/RT/Extension/REST2/Resource/Collection.pm
+++ b/lib/RT/Extension/REST2/Resource/Collection.pm
@@ -10,7 +10,7 @@ extends 'RT::Extension::REST2::Resource';
use Scalar::Util qw( blessed );
use Web::Machine::FSM::States qw( is_status_code );
use Module::Runtime qw( require_module );
-use RT::Extension::REST2::Util qw( serialize_record expand_uid format_datetime );
+use RT::Extension::REST2::Util qw( expand_uid format_datetime );
use POSIX qw( ceil );
use Encode;
@@ -84,7 +84,7 @@ sub serialize {
my @fields = defined $self->request->param('fields') ? split(/,/, $self->request->param('fields')) : ();
while (my $item = $collection->Next) {
- my $result = expand_uid( $item->UID );
+ my $result = $self->serialize_record( $item->UID );
# Allow selection of desired fields
if ($result) {
@@ -154,6 +154,12 @@ sub serialize {
return \%results;
}
+sub serialize_record {
+ my $self = shift;
+ my $record = shift;
+ return expand_uid($record);
+}
+
# XXX TODO: Bulk update via DELETE/PUT on a collection resource?
sub charsets_provided { [ 'utf-8' ] }
--
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.
More information about the Bps-public-commit
mailing list