NAME

Google::RestApi::SubResource - Base class for Google API sub-resources.

DESCRIPTION

SubResource provides a common base class for API sub-resource modules (Comment, Reply, Permission, Event, Label, etc.). It eliminates duplicated api() methods by providing a generic URI builder that assembles _uri_base() + /$id + /$child_uri and delegates to the parent object's api().

Subclasses must override two methods:

  • _uri_base() - returns the URI path segment (e.g. 'comments', 'events')

  • _parent_accessor() - returns the accessor name for the parent object (e.g. 'file', 'calendar')

See "Chained API Calls" in Google::RestApi for a walkthrough of how the chained api() delegation works.

METHODS

api(%args)

Generic URI builder. Assembles the URI from _uri_base(), the object's ID (if set), and any child uri passed in %args. Delegates to the parent object's api() via the accessor returned by _parent_accessor().

_resource_name()

Returns the short class name (e.g. 'Comment', 'TaskList'). Used in error messages from require_id(). Override if the default derived name is not suitable (e.g. Acl overrides to 'ACL').

_uri_base()

Pure virtual. Subclass must return the URI path segment for this resource.

_parent_accessor()

Pure virtual. Subclass must return the method name that accesses the parent object.

AUTHORS

  • Robin Murray mvsjes@cpan.org

COPYRIGHT

Copyright (c) 2019-2026 Robin Murray. All rights reserved.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.