APT.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 14 / 14 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« APT/VideoCreativeService.pm ↑ Summary APT/Account.pm »
1 package Yahoo::Marketing::APT;
2 # Copyright (c) 2010 Yahoo! Inc. All rights reserved.
3 # The copyrights to the contents of this file are licensed under the Perl Artistic License (ver. 15 Aug 1997)
4  
5 44 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 44 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 44 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 Yahoo::Marketing::APT - an interface for Yahoo! Search Marketing's APT Web Services.
12  
13 =head1 VERSION
14  
15 Version 6.01
16  
17 =cut
18  
19 # not using 3 part version #s,
20 # see http://www.perlmonks.org/?node_id=520850
21 44 our $VERSION = '6.01';
22  
23 =head1 SYNOPSIS
24  
25 This collection of modules makes interacting with Yahoo! Search Marketing's APT Web Services as easy as possible.
26  
27 B<Note that this version (0.x) is intended to be used with V0 of the APT web services.>
28  
29 Sample Usage:
30  
31 use Yahoo::Marketing::APT::Site;
32 use Yahoo::Marketing::APT::SiteService;
33  
34 my $service = Yahoo::Marketing::APT::SiteService->new;
35  
36 # setup your credentials
37  
38 $service->username( 'your username' );
39 $service->password( 'your password' );
40 $service->license( 'your license' );
41 $service->account( 'your account ID' );
42 $service->endpoint( 'https://sandbox.apt.yahooapis.com/services/V6' );
43  
44 # OR
45  
46 $service->parse_config( section => 'sandbox' );
47  
48  
49 # create a site object, and add it
50  
51 my $site = Yahoo::Marketing::APT::Site->new
52 ->name( $site_name )
53 ->url( 'http://my.someurl.com' )
54 ->description( 'some description text' )
55 ;
56  
57 my $site_response = $service->addSite( site => $site );
58  
59 # added site will have ID set
60  
61 my $added_site = $site_response->site;
62 ...
63  
64 =head1 VERSIONING
65  
66 This version of Yahoo::Marketing::APT is intended to be used with V0 of Yahoo's Marketing API.
67  
68 =head1 OVERVIEW
69  
70 Yahoo! Search Marketing's APT API allows you to manage your search marketing APT account in an automated fashion rather than manually.
71  
72 This Yahoo::Marketing::APT module is a set of sub-classes of Yahoo::Marketing. Therefore, Yahoo::Marketing is a prerequisite of this module. And Yahoo::Marketing::APT inherits all the features from Yahoo::Marketing. see
73  
74 L<http://search.cpan.org/dist/Yahoo-Marketing/>
75  
76 The calls you can make to the various services are documented on YSM's Technology Solutions Portal. See
77  
78 L<http://help.yahoo.com/l/us/yahoo/apt/webservices/index.html>
79  
80 =head1 EXPORT
81  
82 No exported functions
83  
84 =head1 METHODS
85  
86 There are no methods available in Yahoo::Marketing::APT directly. All functionality is exposed by the various Service modules and complex types.
87  
88 See perldoc Yahoo::Marketing::Service for service use
89  
90 And perldoc Yahoo::Marketing::ComplexTypes for Complex Type documentation
91  
92 =head1 EXAMPLES
93  
94 =head2 Example Code
95  
96 Please see Perl example code at Yahoo! Developer Network:
97  
98 http://help.yahoo.com/l/us/yahoo/apt/webservices/sample_code/index.html
99  
100 =head2 Example 1 - creating a site (from SiteService)
101  
102 my $site_service = Yahoo::Marketing::APT::SiteService->new
103 ->parse_config( section => 'sandbox' );
104 # create a site
105 my $site_response = $site_service->addSite( site =>
106 Yahoo::Marketing::APT::Site->new
107 ->name( 'my site' )
108 ->url( 'http://www.somethingaboutmysite.com' )
109 );
110 my $site = $site_response->site;
111  
112 # $site now contains the newly created site.
113 # $site->ID will be set to the ID assigned to the new site.
114  
115  
116 =head2 Example 2 - updating folders (from FolderService)
117  
118 my $folder_service = Yahoo::Marketing::APT::FolderService->new
119 ->parse_config( section => 'sandbox' );
120 my @responses = $folder_service->updateFolders(
121 folders => [ Yahoo::Marketing::APT::Folder->new
122 ->ID( '10456' ) # ID of existing folder
123 ->name( 'new folder name 1' )
124 ,
125 Yahoo::Marketing::APT::Folder->new
126 ->ID( '10982' ) # ID of existing folder
127 ->name( 'new folder name 2' )
128 ,
129 ] );
130 my $folder1 = $responses[0]->folder;
131 my $folder2 = $responses[1]->folder;
132  
133  
134 =head2 Example 3 - submitting a request for a report (from ReportService)
135  
136 my $report_service = Yahoo::Marketing::APT::ReportService->new->parse_config( section => 'sandbox' );
137  
138 # get available reports
139 my @reports = $report_service->getAvailableReports();
140 foreach my $report (@reports) {
141 print ("context: " . $report->context . "; name: " . $report->name . "\n");
142 }
143  
144 # submit the report request, we choose one report name on Account context level.
145 my $report_request = Yahoo::Marketing::APT::ReportRequest->new
146 ->contextID( $report_service->account )
147 ->reportName( 'SalesCompensation' )
148 ->dateRange( 'Yesterday' )
149 ;
150 my $report_id = $report_service->addSavedReportRequest(
151 reportRequest => $report_request,
152 );
153  
154 # $report_id now contains the ID for this submitted report.
155  
156  
157 =head2 Example 4 - clearing the location cache from the command line
158  
159 The following code will clear the location cache from the command line on a *nix machine.
160  
161 perl -MYahoo::Marketing::APT::Service -e 'my $ysm_ws = Yahoo::Marketing::APT::Service->new->clear_cache;'
162  
163 On windows, using double quotes instead of single quotes should work.
164  
165 =head2 Example Config File
166  
167 Config files are expected to be in YAML format. See perldoc YAML.
168  
169 default_account is optional. If present, it will be set when a config file
170 is loaded B<only if an account has not already been set!>
171  
172 Please note: masterAccountID is not required in Yahoo APT Web Services Request SOAP header,
173 so master_account entry is optional for config file in Yahoo::Marketing::APT.
174  
175 ---
176 default:
177 default_account: 12345678
178 endpoint: https://endpoint.host/services
179 license: your-ews-license
180 password: secretpassword
181 uri: http://apt.yahooapis.com/V6
182 username: defaultusername
183 version: V6
184 sandbox:
185 default_account: 21921327
186 endpoint: https://sandbox.apt.yahooapis.com/services
187 license: 90837ada-3b26-c2e5-6d59-61d7f2fb578e
188 password: mypassword
189 uri: http://apt.yahooapis.com/V6
190 username: mytestusername
191 version: V6
192  
193  
194 =head1 DEBUGGING
195  
196 If you'd like to see the SOAP requests and responses, or other debugging information available from SOAP::Lite, you can turn
197 it on just as you would for SOAP::Lite. See perldoc SOAP::Trace. As an example, if you wanted to see all trace information
198 available, you could add the following to whatever module or script you use Yahoo::Marketing in:
199  
200 use SOAP::Lite +trace;
201  
202  
203  
204 =head1 AUTHOR
205  
206 Johnny Shen C<< <nycperl at yahoo.com> >>
207  
208 =head1 BUGS
209  
210 Please report any bugs or feature requests to
211 C<bug-yahoo-marketing-apt at rt.cpan.org>, or through the web interface at
212 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Yahoo-Marketing-APT>.
213 I will be notified, and then you'll automatically be notified of progress on
214 your bug as I make changes.
215  
216 =head1 SUPPORT
217  
218 You can find documentation for this module with the perldoc command.
219  
220 perldoc Yahoo::Marketing::APT
221  
222 You can also look for information at:
223  
224 =over 4
225  
226 =item * AnnoCPAN: Annotated CPAN documentation
227  
228 L<http://annocpan.org/dist/Yahoo-Marketing-APT>
229  
230 =item * CPAN Ratings
231  
232 L<http://cpanratings.perl.org/d/Yahoo-Marketing-APT>
233  
234 =item * RT: CPAN's request tracker
235  
236 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Yahoo-Marketing-APT>
237  
238 =item * Search CPAN
239  
240 L<http://search.cpan.org/dist/Yahoo-Marketing-APT>
241  
242 =back
243  
244 =head1 ACKNOWLEDGEMENTS
245  
246 Thanks Jeff Lavallee, C<< <jeff at zeroclue.com> >>, the author of Yahoo::Marketing. Without his great work for Yahoo::Marketing, these APT sub modules won't have been possible.
247  
248 =head1 COPYRIGHT & LICENSE
249  
250 Copyright (c) 2008 Yahoo! Inc. All rights reserved.
251 The copyrights to the contents of this file are licensed under the Perl Artistic License (ver. 15 Aug 1997)
252  
253  
254 =cut
255  
256  
257 44 1; # End of Yahoo::Marketing::APT
258  
« APT/VideoCreativeService.pm ↑ Summary APT/Account.pm »