The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Moo::Google::Discovery - Methods for working with Google API discovery service

VERSION

version 0.03

METHODS

getRest

Retrieve the description of a particular version of an API

  my $d = Moo::Google::Discovery->new;
  $d->getRest({ api=> 'calendar', version => 'v3' });

Return result like

  $VAR1 = {
          'ownerDomain' => 'google.com',
          'version' => 'v2.4',
          'protocol' => 'rest',
          'icons' => 'HASH(0x29760c0)',
          'discoveryVersion' => 'v1',
          'id' => 'analytics:v2.4',
          'parameters' => 'HASH(0x29709c0)',
          'basePath' => '/analytics/v2.4/',
          'revision' => '20170321',
          'description' => 'Views and manages your Google Analytics data.',
          'servicePath' => 'analytics/v2.4/',
          'title' => 'Google Analytics API',
          'kind' => 'discovery#restDescription',
          'rootUrl' => 'https://www.googleapis.com/',
          'etag' => '"YWOzh2SDasdU84ArJnpYek-OMdg/uF7o_i10s0Ir7WGM7zLi8NwSHXI"',
          'ownerName' => 'Google',
          'auth' => 'HASH(0x2948880)',
          'resources' => 'HASH(0x296b218)',
          'batchPath' => 'batch',
          'name' => 'analytics',
          'documentationLink' => 'https://developers.google.com/analytics/',
          'baseUrl' => 'https://www.googleapis.com/analytics/v2.4/'
        };

discover_all

  Return details about all APIs

getRest

Return arrayref of all available API's (services)

    {
      'name' => 'youtube',
      'versions' => [ 'v3' ]
    },

Useful when printing list of supported API's in documentation

exists

Return 1 if service is supported by Google API discovery. Otherwise return 0

  warn $d->exists('calendar');  # 1
  warn $d->exists('someapi');  # 0

printSupported

  Print list of supported APIs in human-readible format (used in description of Google.pm)

availableVersions

  Show available versions of particular API

  $d->availableVersions('calendar');  # ['v3']
  $d->availableVersions('youtubeAnalytics');  # ['v1','v1beta1']

  Returns arrayref

return latest stable verion of API

  $d->availableVersions('calendar');  # ['v3']
  $d->latestStableVersion('calendar');  # 'v3'

  $d->availableVersions('tagmanager');  # ['v1','v2']
  $d->latestStableVersion('tagmanager');  # ['v2']

  $d->availableVersions('storage');  # ['v1','v1beta1', 'v1beta2']
  $d->latestStableVersion('storage');  # ['v1']

findAPIsWithDiffVers

Return only APIs with multiple versions available

searchInServices

  Search in services in "I'm lucky way"

  Must process case-insensitive way:
  e.g. Class is called CalendarList but resources is called calendarList in discovery

getMethodMeta

Download metadata from Google API discovery for particular class method

  $discovery->getResourceMeta('Moo::Google::Calendar::CalendarList::delete')

getResourceMeta

Download metadata from Google API discove for particular resource

  $discovery->getResourceMeta('Moo::Google::Calendar::Events')

listOfMethods

Return array of methods that are available for particular resource

  $discovery->listOfMethods('Moo::Google::Calendar::Events')

metaForAPI

  Same as getRest method but faster.
  Uses as cache discovery_full attribute to avoid multimple requests

  metaForAPI({ api => 'calendar', version => 'v3' });

MORE INFORMATION

https://developers.google.com/discovery/v1/reference/

AUTHOR

Pavel Serikov <pavelsr@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Pavel Serikov.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.