| 1 | package Megaport::Services; | ||
| 2 | 3 | ▶ | use parent 'Megaport::Internal::_Result'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 3 | ▶ | use 5.10.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 3 | ▶ | use Class::Tiny { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 3 | _request => { | |
| 10 | pkey => 'productUid', | ||
| 11 | method => 'GET', | ||
| 12 | path => '/products' | ||
| 13 | } | ||
| 14 | 3 | }; | |
| 15 | |||
| 16 | 3 | 1; | |
| 17 | =encoding utf-8 | ||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | Megaport::Services | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | This provide a simple read-only list of Megaport services owned by the logged in account. Details about the objects returned by the API can be found L<here|https://dev.megaport.com/#general-get-product-list>. | ||
| 25 | |||
| 26 | =head1 METHODS | ||
| 27 | |||
| 28 | =head2 list | ||
| 29 | |||
| 30 | # Optional array or arrayref | ||
| 31 | my @list = $services->list; | ||
| 32 | my $list = $services->list; | ||
| 33 | |||
| 34 | # Use search terms to find a partial list | ||
| 35 | my @fast = $services->list(portSpeed => 10000); | ||
| 36 | my @merican = $services->list(market => 'US'); | ||
| 37 | |||
| 38 | Returns a list or allows searching based on any field present in the object. | ||
| 39 | |||
| 40 | =head2 get | ||
| 41 | |||
| 42 | my $gs_port = $services->get(id => 'my-product-uid'); | ||
| 43 | my $first = $services->get(name => 'My First Megaport'); | ||
| 44 | |||
| 45 | Best used to search by C<id> but as with L<list/list>, any field can be used. This method uses L<List::Util/first> to return the first matching entry. The data is stored in a hash internally so the keys are unordered. Using this method with a search term like C<productType> will yield unexpected results. | ||
| 46 | |||
| 47 | =head1 AUTHOR | ||
| 48 | |||
| 49 | Cameron Daniel E<lt>cdaniel@cpan.orgE<gt> | ||
| 50 | |||
| 51 | =cut | ||