File Coverage

lib/WebService/VaultPress/Partner/Request/GoldenTicket.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


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