| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WebService::VaultPress::Partner::Request::History; | 
| 2 | 2 |  |  | 2 |  | 33609 | use Moose; | 
|  | 2 |  |  |  |  | 637515 |  | 
|  | 2 |  |  |  |  | 19 |  | 
| 3 | 2 |  |  | 2 |  | 15553 | use Moose::Util::TypeConstraints; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 22 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | our $VERSION = '0.05'; | 
| 6 |  |  |  |  |  |  | $VERSION = eval $VERSION; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | my $abs_int     = subtype as 'Int', where { $_ >= 0 }; | 
| 9 |  |  |  |  |  |  | my $limited_int = subtype as 'Int', where { $_ >= 1 and $_ <= 500  }; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | has api => ( | 
| 12 |  |  |  |  |  |  | is       => 'ro', | 
| 13 |  |  |  |  |  |  | isa      => 'Str', | 
| 14 |  |  |  |  |  |  | default  => 'https://partner-api.vaultpress.com/gtm/1.0/usage' | 
| 15 |  |  |  |  |  |  | ); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | has limit => ( | 
| 18 |  |  |  |  |  |  | is       => 'ro', | 
| 19 |  |  |  |  |  |  | isa      => $limited_int, | 
| 20 |  |  |  |  |  |  | default  => 100, | 
| 21 |  |  |  |  |  |  | ); | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | has offset => ( | 
| 24 |  |  |  |  |  |  | is       => 'ro', | 
| 25 |  |  |  |  |  |  | isa      => $abs_int, | 
| 26 |  |  |  |  |  |  | default  => 0, | 
| 27 |  |  |  |  |  |  | ); | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | __PACKAGE__->meta->make_immutable; | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | 1; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =head1 NAME | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | WebService::VaultPress::Partner::Request::History - The VaultPress Partner API Client History Request Object | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | =head1 VERSION | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | version 0.05 | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | #!/usr/bin/perl | 
| 44 |  |  |  |  |  |  | use warnings; | 
| 45 |  |  |  |  |  |  | use strict; | 
| 46 |  |  |  |  |  |  | use lib 'lib'; | 
| 47 |  |  |  |  |  |  | use WebService::VaultPress::Partner; | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | my $vp = WebService::VaultPress::Partner->new( | 
| 51 |  |  |  |  |  |  | key => 'Your API Key Goes Here', | 
| 52 |  |  |  |  |  |  | ); | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | my $result = eval { $vp->GetUsage }; | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | if ( $@ ) { | 
| 57 |  |  |  |  |  |  | print "->GetUsage had an error: $@"; | 
| 58 |  |  |  |  |  |  | } else { | 
| 59 |  |  |  |  |  |  | printf( "%7s => %5d\n", $_, $result->$_ ) for qw/ unused basic premium /; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | my @results = $vp->GetHistory; | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | if ( $@ ) { | 
| 67 |  |  |  |  |  |  | print "->GetHistory had an error: $@"; | 
| 68 |  |  |  |  |  |  | } else { | 
| 69 |  |  |  |  |  |  | for my $res ( @results ) { | 
| 70 |  |  |  |  |  |  | printf( "| %-20s | %-20s | %-30s | %-19s | %-19s | %-7s |\n", $res->fname, | 
| 71 |  |  |  |  |  |  | $res->lname, $res->email, $res->created, $res->redeemed, $res->type ); | 
| 72 |  |  |  |  |  |  | } | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | # Give Alan Shore a 'Golden Ticket' to VaultPress | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | my $ticket = eval { $vp->CreateGoldenTicket( | 
| 78 |  |  |  |  |  |  | fname => 'Alan', | 
| 79 |  |  |  |  |  |  | lname => 'Shore', | 
| 80 |  |  |  |  |  |  | email => 'alan.shore@gmail.com', | 
| 81 |  |  |  |  |  |  | ); }; | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | if ( $@ ) { | 
| 84 |  |  |  |  |  |  | print "->CreateGoldenTicket had an error: $@"; | 
| 85 |  |  |  |  |  |  | } else { | 
| 86 |  |  |  |  |  |  | print "You can sign up for your VaultPress account <a href=\"" | 
| 87 |  |  |  |  |  |  | . $ticket->ticket ."\">Here!</a>\n"; | 
| 88 |  |  |  |  |  |  | } | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | This document outlines the methods available through the | 
| 93 |  |  |  |  |  |  | WebService::VaultPress::Partner::Request::History class.  You should not instantiate | 
| 94 |  |  |  |  |  |  | an object of this class yourself when using WebService::VaultPress::Partner, | 
| 95 |  |  |  |  |  |  | it is created by the arguments to ->GetHistory and ->GetRedeemedHistory. | 
| 96 |  |  |  |  |  |  | Its primary purpose is to use Moose's type and error systems to throw errors | 
| 97 |  |  |  |  |  |  | when required  parameters are not passed. | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | WebService::VaultPress::Partner is a set of Perl modules which provides a simple and | 
| 100 |  |  |  |  |  |  | consistent Client API to the VaultPress Partner API.  The main focus of | 
| 101 |  |  |  |  |  |  | the library is to provide classes and functions that allow you to quickly | 
| 102 |  |  |  |  |  |  | access VaultPress from Perl applications. | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | The modules consist of the WebService::VaultPress::Partner module itself as well as a | 
| 105 |  |  |  |  |  |  | handful of WebService::VaultPress::Partner::Request modules as well as a response object, | 
| 106 |  |  |  |  |  |  | WebService::VaultPress::Partner::Response, that provides consistent error and success | 
| 107 |  |  |  |  |  |  | methods. | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =head1 METHODS | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =over 4 | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =item api | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =over 4 | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =item Set By | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | WebService::VaultPress::Partner->GetHistory( key => value, ⦠) | 
| 120 |  |  |  |  |  |  | WebService::VaultPress::Partner->GetRedeemedHistory( key => value, ⦠) | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =item Required | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | This key is not required. | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | =item Default Value | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | Unless explicitly set the value for this method is "https://partner-api.vaultpress.com/gtm/1.0/usage" | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | =item Value Description | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | This method provides WebService::VaultPress::Partner with the URL which will be used for the API | 
| 133 |  |  |  |  |  |  | call. | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =back | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | =item limit | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =over 4 | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =item Set By | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | WebService::VaultPress::Partner->GetHistory( key => value, ⦠) | 
| 144 |  |  |  |  |  |  | WebService::VaultPress::Partner->GetRedeemedHistory( key => value, ⦠) | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | =item Required | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | This key is not required. | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =item Default Value | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | Unless explicitly set this value defaults to 100. | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | =item Value Description | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | This method provides WebService::VaultPress::Partner with the number of entries to be returned | 
| 157 |  |  |  |  |  |  | by the ->GetHistory and ->GetRedeemedHistory API calls.  The number MUST be | 
| 158 |  |  |  |  |  |  | within the inclusive range of 1 to 500. | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | =back | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =item offset | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | =over 4 | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | =item Set By | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | WebService::VaultPress::Partner->GetHistory( key => value, ⦠) | 
| 169 |  |  |  |  |  |  | WebService::VaultPress::Partner->GetRedeemedHistory( key => value, ⦠) | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | =item Required | 
| 172 |  |  |  |  |  |  |  | 
| 173 |  |  |  |  |  |  | This key is not required. | 
| 174 |  |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  | =item Default Value | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  | Unless explicitly set this value defaults to 0. | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | =item Value Description | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | This method provides WebService::VaultPress::Partner with the offset to use by the ->GetHistory | 
| 182 |  |  |  |  |  |  | and ->GetRedeemedHistory API calls.  The number must be a positive integer. | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | The offset is how many records to skip before fetching the number of records | 
| 185 |  |  |  |  |  |  | specified by limit.  For example, ( limit => 100, offset => 100 ) will fetch the | 
| 186 |  |  |  |  |  |  | 101th to the 200th record.  ( limit => 100 ) will fetch the 1st to 100th record. | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | =back | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | =back | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | WebService::VaultPress::Partner VaultPress::Partner::Response VaultPress::Partner::Request::History | 
| 195 |  |  |  |  |  |  | WebService::VaultPress::Partner::Usage | 
| 196 |  |  |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | =head1 AUTHOR | 
| 198 |  |  |  |  |  |  |  | 
| 199 |  |  |  |  |  |  | SymKat I<E<lt>symkat@symkat.comE<gt>> | 
| 200 |  |  |  |  |  |  |  | 
| 201 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 202 |  |  |  |  |  |  |  | 
| 203 |  |  |  |  |  |  | This is free software licensed under a I<BSD-Style> License.  Please see the | 
| 204 |  |  |  |  |  |  | LICENSE file included in this package for more detailed information. | 
| 205 |  |  |  |  |  |  |  | 
| 206 |  |  |  |  |  |  | =head1 AVAILABILITY | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | The latest version of this software is available through GitHub at | 
| 209 |  |  |  |  |  |  | https://github.com/mediatemple/webservice/vaultpress-partner/ | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | =cut |