| 1 | package WebService::VaultPress::Partner::Response; | ||
| 2 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 2 | our $VERSION = '0.05'; | |
| 5 | 2 | $VERSION = eval $VERSION; | |
| 6 | |||
| 7 | 2 | has api_call => ( is => 'ro', isa => 'Str' ); | |
| 8 | 2 | has ticket => ( is => 'ro', isa => 'Str' ); | |
| 9 | 2 | has unused => ( is => 'ro', isa => 'Int' ); | |
| 10 | 2 | has basic => ( is => 'ro', isa => 'Int' ); | |
| 11 | 2 | has premium => ( is => 'ro', isa => 'Int' ); | |
| 12 | 2 | has email => ( is => 'ro', isa => 'Str' ); | |
| 13 | 2 | has lname => ( is => 'ro', isa => 'Str' ); | |
| 14 | 2 | has fname => ( is => 'ro', isa => 'Str' ); | |
| 15 | 2 | has created => ( is => 'ro', isa => 'Str' ); | |
| 16 | 2 | has type => ( is => 'ro', isa => 'Str' ); | |
| 17 | 2 | has redeemed => ( is => 'ro', isa => 'Str' ); | |
| 18 | |||
| 19 | 2 | __PACKAGE__->meta->make_immutable; | |
| 20 | |||
| 21 | 2 | 1; | |
| 22 | |||
| 23 | =head1 NAME | ||
| 24 | |||
| 25 | WebService::VaultPress::Partner::Response - The VaultPress Partner API Client Response Object | ||
| 26 | |||
| 27 | =head1 VERSION | ||
| 28 | |||
| 29 | version 0.05 | ||
| 30 | |||
| 31 | =head1 SYNOPSIS | ||
| 32 | |||
| 33 | #!/usr/bin/perl | ||
| 34 | use warnings; | ||
| 35 | use strict; | ||
| 36 | use lib 'lib'; | ||
| 37 | use WebService::VaultPress::Partner; | ||
| 38 | |||
| 39 | |||
| 40 | my $vp = WebService::VaultPress::Partner->new( | ||
| 41 | key => 'Your API Key Goes Here', | ||
| 42 | ); | ||
| 43 | |||
| 44 | my $result = eval { $vp->GetUsage }; | ||
| 45 | |||
| 46 | if ( $@ ) { | ||
| 47 | print "->GetUsage had an error: $@"; | ||
| 48 | } else { | ||
| 49 | printf( "%7s => %5d\n", $_, $result->$_ ) for qw/ unused basic premium /; | ||
| 50 | } | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | my @results = $vp->GetHistory; | ||
| 55 | |||
| 56 | if ( $@ ) { | ||
| 57 | print "->GetHistory had an error: $@"; | ||
| 58 | } else { | ||
| 59 | for my $res ( @results ) { | ||
| 60 | printf( "| %-20s | %-20s | %-30s | %-19s | %-19s | %-7s |\n", $res->fname, | ||
| 61 | $res->lname, $res->email, $res->created, $res->redeemed, $res->type ); | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | # Give Alan Shore a 'Golden Ticket' to VaultPress | ||
| 66 | |||
| 67 | my $ticket = eval { $vp->CreateGoldenTicket( | ||
| 68 | fname => 'Alan', | ||
| 69 | lname => 'Shore', | ||
| 70 | email => 'alan.shore@gmail.com', | ||
| 71 | ); }; | ||
| 72 | |||
| 73 | if ( $@ ) { | ||
| 74 | print "->CreateGoldenTicket had an error: $@"; | ||
| 75 | } else { | ||
| 76 | print "You can sign up for your VaultPress account <a href=\"" | ||
| 77 | . $ticket->ticket ."\">Here!</a>\n"; | ||
| 78 | } | ||
| 79 | |||
| 80 | =head1 DESCRIPTION | ||
| 81 | |||
| 82 | This document outlines the methods available through the | ||
| 83 | WebService::VaultPress::Partner::Response class. You should not instantiate | ||
| 84 | an object of this class yourself when using WebService::VaultPress::Partner, | ||
| 85 | it is returned in response to a request. Please extend this class when | ||
| 86 | adding new methods to WebService::VaultPress::Partner. | ||
| 87 | |||
| 88 | WebService::VaultPress::Partner is a set of Perl modules that provide a simple and | ||
| 89 | consistent Client API to the VaultPress Partner API. The main focus of | ||
| 90 | the library is to provide classes and functions that allow you to quickly | ||
| 91 | access VaultPress from Perl applications. | ||
| 92 | |||
| 93 | The modules consist of the WebService::VaultPress::Partner module itself as well as a | ||
| 94 | handful of WebService::VaultPress::Partner::Request modules as well as a response object, | ||
| 95 | WebService::VaultPress::Partner::Response, that provides consistent error and success | ||
| 96 | methods. | ||
| 97 | |||
| 98 | =head1 METHODS | ||
| 99 | |||
| 100 | =over 4 | ||
| 101 | |||
| 102 | =item api_call | ||
| 103 | |||
| 104 | =over 4 | ||
| 105 | |||
| 106 | =item Set By | ||
| 107 | |||
| 108 | WebService::VaultPress::Partner->CreateGoldenTicket | ||
| 109 | WebService::VaultPress::Partner->GetHistory | ||
| 110 | WebService::VaultPress::Partner->GetRedeemedHistory | ||
| 111 | WebService::VaultPress::Partner->GetUsage | ||
| 112 | |||
| 113 | =item Value Description | ||
| 114 | |||
| 115 | The name of the request type for which this is a response of. "CreateGoldenTicket" | ||
| 116 | or a response to ->CreateGoldenTicket, "GetHistory" for a response to ->GetHistory | ||
| 117 | and so on. | ||
| 118 | |||
| 119 | =back | ||
| 120 | |||
| 121 | =item ticket | ||
| 122 | |||
| 123 | =over 4 | ||
| 124 | |||
| 125 | =item Set By | ||
| 126 | |||
| 127 | WebService::VaultPress::Partner->CreateGoldenTicket | ||
| 128 | |||
| 129 | =item Value Description | ||
| 130 | |||
| 131 | Upon a successful execution and return of ->CreateGoldenTicket this will hold a string | ||
| 132 | for whose value is theURL for the user to redeem her Golden Ticket. | ||
| 133 | |||
| 134 | =back | ||
| 135 | |||
| 136 | =item unused | ||
| 137 | |||
| 138 | =over 4 | ||
| 139 | |||
| 140 | =item Set By | ||
| 141 | |||
| 142 | WebService::VaultPress::Partner->GetUsage | ||
| 143 | |||
| 144 | =item Value Description | ||
| 145 | |||
| 146 | Upon a successful execution and return of ->GetUsage this will hold an | ||
| 147 | integer whose value is the number of Golden Tickets created for which there | ||
| 148 | has yet to be a redemption. | ||
| 149 | |||
| 150 | =back | ||
| 151 | |||
| 152 | =item basic | ||
| 153 | |||
| 154 | =over 4 | ||
| 155 | |||
| 156 | =item Set By | ||
| 157 | |||
| 158 | WebService::VaultPress::Partner->GetUsage | ||
| 159 | |||
| 160 | =item Value Description | ||
| 161 | |||
| 162 | Upon a successful execution and return of ->GetUsage this will hold an | ||
| 163 | integer whose value is the number of Golden Tickets created for which there | ||
| 164 | was redemption of as an account type 'basic'. | ||
| 165 | |||
| 166 | =back | ||
| 167 | |||
| 168 | =item premium | ||
| 169 | |||
| 170 | =over 4 | ||
| 171 | |||
| 172 | =item Set By | ||
| 173 | |||
| 174 | WebService::VaultPress::Partner->GetUsage | ||
| 175 | |||
| 176 | =item Value Description | ||
| 177 | |||
| 178 | Upon a successful execution and return of ->GetUsage this will hold an | ||
| 179 | integer whose value is the number of Golden Tickets created for which there | ||
| 180 | was redemption of as an account type 'premium'. | ||
| 181 | |||
| 182 | =back | ||
| 183 | |||
| 184 | =item email | ||
| 185 | |||
| 186 | =over 4 | ||
| 187 | |||
| 188 | =item Set By | ||
| 189 | |||
| 190 | WebService::VaultPress::Partner->GetHistory | ||
| 191 | WebService::VaultPress::Partner->GetRedeemedHistory | ||
| 192 | |||
| 193 | =item Value Description | ||
| 194 | |||
| 195 | Upon successful execution and return of ->GetHistory or ->GetRedeemedHistory | ||
| 196 | this will hold a string whose value is the email address of the user for whom a | ||
| 197 | Golden Ticket was issued. | ||
| 198 | |||
| 199 | =back | ||
| 200 | |||
| 201 | =item fname | ||
| 202 | |||
| 203 | =over 4 | ||
| 204 | |||
| 205 | =item Set By | ||
| 206 | |||
| 207 | WebService::VaultPress::Partner->GetHistory | ||
| 208 | WebService::VaultPress::Partner->GetRedeemedHistory | ||
| 209 | |||
| 210 | =item Value Description | ||
| 211 | |||
| 212 | Upon successful execution and return of ->GetHistory or ->GetRedeemedHistory | ||
| 213 | this will hold a string whose value is the first name of the user for whom a | ||
| 214 | Golden Ticket was issued. | ||
| 215 | |||
| 216 | =back | ||
| 217 | |||
| 218 | =item lname | ||
| 219 | |||
| 220 | =over 4 | ||
| 221 | |||
| 222 | =item Set By | ||
| 223 | |||
| 224 | WebService::VaultPress::Partner->GetHistory | ||
| 225 | WebService::VaultPress::Partner->GetRedeemedHistory | ||
| 226 | |||
| 227 | =item Value Description | ||
| 228 | |||
| 229 | Upon successful execution and return of ->GetHistory or ->GetRedeemedHistory | ||
| 230 | this will hold a string whose value is the last name of the user for whom a | ||
| 231 | Golden Ticket was issued. | ||
| 232 | |||
| 233 | =back | ||
| 234 | |||
| 235 | =item created | ||
| 236 | |||
| 237 | =over 4 | ||
| 238 | |||
| 239 | =item Set By | ||
| 240 | |||
| 241 | WebService::VaultPress::Partner->GetHistory | ||
| 242 | WebService::VaultPress::Partner->GetRedeemedHistory | ||
| 243 | |||
| 244 | =item Value Description | ||
| 245 | |||
| 246 | Upon successful execution and return of ->GetHistory or ->GetRedeemedHistory | ||
| 247 | this will hold a string whose value is the date and time when the Golden Ticket | ||
| 248 | was created. The format is 'YYYY-MM-DD HH:MM:SS' | ||
| 249 | |||
| 250 | =back | ||
| 251 | |||
| 252 | =item <ype | ||
| 253 | |||
| 254 | =over 4 | ||
| 255 | |||
| 256 | =item Set By | ||
| 257 | |||
| 258 | WebService::VaultPress::Partner->GetHistory | ||
| 259 | WebService::VaultPress::Partner->GetRedeemedHistory | ||
| 260 | |||
| 261 | =item Value Description | ||
| 262 | |||
| 263 | Upon successful execution and return of ->GetHistory or ->GetRedeemedHistory | ||
| 264 | this will hold a string whose value is the type of service for which the Golden Ticket | ||
| 265 | was redeemed for. 'basic' or 'premium'. In a case where the Golden Ticket has | ||
| 266 | not been redeemed this will be "". | ||
| 267 | |||
| 268 | =back | ||
| 269 | |||
| 270 | =item redeemed | ||
| 271 | |||
| 272 | =over 4 | ||
| 273 | |||
| 274 | =item Set By | ||
| 275 | |||
| 276 | WebService::VaultPress::Partner->GetHistory | ||
| 277 | WebService::VaultPress::Partner->GetRedeemedHistory | ||
| 278 | |||
| 279 | =item Value Description | ||
| 280 | |||
| 281 | Upon successful execution and return of ->GetHistory or ->GetRedeemedHistory | ||
| 282 | this will hold a string whose value is the date and time when the Golden Ticket | ||
| 283 | was created. The format is 'YYYY-MM-DD HH:MM:SS' | ||
| 284 | |||
| 285 | If the Golden Ticket has not been redeemed the value will be '0000-00-00 00:00:00'. | ||
| 286 | |||
| 287 | GetRedeemedHistory will not return results in the set which has not been redeemed. | ||
| 288 | |||
| 289 | =back | ||
| 290 | |||
| 291 | =back | ||
| 292 | |||
| 293 | =head1 SEE ALSO | ||
| 294 | |||
| 295 | WebService::VaultPress::Partner VaultPress::Partner::Request::History VaultPress::Partner::Usage | ||
| 296 | WebService::VaultPress::Partner::GoldenTicket | ||
| 297 | |||
| 298 | =head1 AUTHOR | ||
| 299 | |||
| 300 | SymKat I<E<lt>symkat@symkat.comE<gt>> | ||
| 301 | |||
| 302 | =head1 COPYRIGHT AND LICENSE | ||
| 303 | |||
| 304 | This is free software licensed under a I<BSD-Style> License. Please see the | ||
| 305 | LICENSE file included in this package for more detailed information. | ||
| 306 | |||
| 307 | =head1 AVAILABILITY | ||
| 308 | |||
| 309 | The latest version of this software is available through GitHub at | ||
| 310 | https://github.com/mediatemple/webservice-vaultpress-partner/ | ||
| 311 | |||
| 312 | =cut | ||