| 1 | package Ticketmaster::API::Discovery; | ||
| 2 | |||
| 3 | use 5.006; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Ticketmaster::API::Discovery - search, look up and find event, attractions and venues | ||
| 10 | |||
| 11 | =head1 VERSION | ||
| 12 | |||
| 13 | Version 0.01 | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | our $VERSION = '0.01'; | ||
| 18 | use parent 'Ticketmaster::API'; | ||
| 19 | |||
| 20 | my $base_uri = 'discovery/%s'; | ||
| 21 | |||
| 22 | =head1 SYNOPSIS | ||
| 23 | |||
| 24 | Ticketmaster's Discovery API is used to search, look up and find events, attractions and venues. | ||
| 25 | |||
| 26 | For more information also see: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/ | ||
| 27 | |||
| 28 | use Ticketmaster::API::Discovery; | ||
| 29 | |||
| 30 | my $tm_api = Ticketmaster::API::Discovery->new(api_key => 'abc123'); | ||
| 31 | my $events = $tm_api->search_events(); | ||
| 32 | |||
| 33 | =head1 SUBROUTINES/METHODS | ||
| 34 | |||
| 35 | =head2 search_events | ||
| 36 | |||
| 37 | Returns the 20 most recent events for the authenticating user. | ||
| 38 | |||
| 39 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#srch-events | ||
| 40 | |||
| 41 | my $ret = $tm_api->search_events(); | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | sub search_events { | ||
| 46 | my $self = shift; | ||
| 47 | my $args = {@_}; | ||
| 48 | |||
| 49 | return $self->get_data(method => 'GET', path_template => "$base_uri/events.json", parameters => $args); | ||
| 50 | } | ||
| 51 | |||
| 52 | =head2 event_details | ||
| 53 | |||
| 54 | Returns the event details by event ID. | ||
| 55 | |||
| 56 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#event-details | ||
| 57 | |||
| 58 | my $ret = $tm_api->event_details(id => 1234, ...); | ||
| 59 | |||
| 60 | =over 2 | ||
| 61 | |||
| 62 | =item id | ||
| 63 | |||
| 64 | event id | ||
| 65 | |||
| 66 | =item ... | ||
| 67 | |||
| 68 | other options available in key/value pairs | ||
| 69 | |||
| 70 | =back | ||
| 71 | |||
| 72 | =cut | ||
| 73 | sub event_details { | ||
| 74 | my $self = shift; | ||
| 75 | my $args = {@_}; | ||
| 76 | |||
| 77 | my $id = delete $args->{id} || die("No event id provided\n"); | ||
| 78 | |||
| 79 | return $self->get_data(method => 'GET', path_template => "$base_uri/events/$id.json", parameters => $args); | ||
| 80 | } | ||
| 81 | |||
| 82 | =head2 event_images | ||
| 83 | |||
| 84 | Returns all event images by event ID. | ||
| 85 | |||
| 86 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#event-img | ||
| 87 | |||
| 88 | my $ret = $tm_api->event_images(id => 1234, ...); | ||
| 89 | |||
| 90 | =over 2 | ||
| 91 | |||
| 92 | =item id | ||
| 93 | |||
| 94 | event id | ||
| 95 | |||
| 96 | =item ... | ||
| 97 | |||
| 98 | other options available in key/value pairs | ||
| 99 | |||
| 100 | =back | ||
| 101 | |||
| 102 | =cut | ||
| 103 | sub event_images { | ||
| 104 | my $self = shift; | ||
| 105 | my $args = {@_}; | ||
| 106 | |||
| 107 | my $id = delete $args->{id} || die("No event id provided\n"); | ||
| 108 | |||
| 109 | return $self->get_data(method => 'GET', path_template => "$base_uri/events/$id/images.json", parameters => $args); | ||
| 110 | } | ||
| 111 | |||
| 112 | =head2 search_attractions | ||
| 113 | |||
| 114 | Returns available attactions | ||
| 115 | |||
| 116 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#search-attractions | ||
| 117 | |||
| 118 | my $ret = $tm_api->search_attractions(...); | ||
| 119 | |||
| 120 | =over 2 | ||
| 121 | |||
| 122 | =item ... | ||
| 123 | |||
| 124 | other options available in key/value pairs | ||
| 125 | |||
| 126 | =back | ||
| 127 | |||
| 128 | =cut | ||
| 129 | sub search_attractions { | ||
| 130 | my $self = shift; | ||
| 131 | my $args = {@_}; | ||
| 132 | |||
| 133 | return $self->get_data(method => 'GET', path_template => "$base_uri/attractions.json", parameters => $args); | ||
| 134 | } | ||
| 135 | |||
| 136 | =head2 attraction_details | ||
| 137 | |||
| 138 | Returns attraction deatils by attraction ID. | ||
| 139 | |||
| 140 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#attraction-details | ||
| 141 | |||
| 142 | my $ret = $tm_api->attraction_details(id => 1234, ...); | ||
| 143 | |||
| 144 | =over 2 | ||
| 145 | |||
| 146 | =item id | ||
| 147 | |||
| 148 | attraction id | ||
| 149 | |||
| 150 | =item ... | ||
| 151 | |||
| 152 | other options available in key/value pairs | ||
| 153 | |||
| 154 | =back | ||
| 155 | |||
| 156 | =cut | ||
| 157 | sub attraction_details { | ||
| 158 | my $self = shift; | ||
| 159 | my $args = {@_}; | ||
| 160 | |||
| 161 | my $id = delete $args->{id} || die("No attraction id provided\n"); | ||
| 162 | |||
| 163 | return $self->get_data(method => 'GET', path_template => "$base_uri/attractions/$id.json", parameters => $args); | ||
| 164 | } | ||
| 165 | |||
| 166 | =head2 search_categories | ||
| 167 | |||
| 168 | Returns available categories | ||
| 169 | |||
| 170 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#search-categories | ||
| 171 | |||
| 172 | my $ret = $tm_api->search_categories(...); | ||
| 173 | |||
| 174 | =over 2 | ||
| 175 | |||
| 176 | =item ... | ||
| 177 | |||
| 178 | other options available in key/value pairs | ||
| 179 | |||
| 180 | =back | ||
| 181 | |||
| 182 | =cut | ||
| 183 | sub search_categories { | ||
| 184 | my $self = shift; | ||
| 185 | my $args = {@_}; | ||
| 186 | |||
| 187 | return $self->get_data(method => 'GET', path_template => "$base_uri/categories.json", parameters => $args); | ||
| 188 | } | ||
| 189 | |||
| 190 | =head2 category_details | ||
| 191 | |||
| 192 | Returns category deatils by category ID. | ||
| 193 | |||
| 194 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#category-details | ||
| 195 | |||
| 196 | my $ret = $tm_api->category_details(id => 1234, ...); | ||
| 197 | |||
| 198 | =over 2 | ||
| 199 | |||
| 200 | =item id | ||
| 201 | |||
| 202 | category id | ||
| 203 | |||
| 204 | =item ... | ||
| 205 | |||
| 206 | other options available in key/value pairs | ||
| 207 | |||
| 208 | =back | ||
| 209 | |||
| 210 | =cut | ||
| 211 | sub category_details { | ||
| 212 | my $self = shift; | ||
| 213 | my $args = {@_}; | ||
| 214 | |||
| 215 | my $id = delete $args->{id} || die("No category id provided\n"); | ||
| 216 | |||
| 217 | return $self->get_data(method => 'GET', path_template => "$base_uri/categories/$id.json", parameters => $args); | ||
| 218 | } | ||
| 219 | |||
| 220 | =head2 search_venues | ||
| 221 | |||
| 222 | Returns available venues | ||
| 223 | |||
| 224 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#search-venues | ||
| 225 | |||
| 226 | my $ret = $tm_api->search_venues(...); | ||
| 227 | |||
| 228 | =over 2 | ||
| 229 | |||
| 230 | =item ... | ||
| 231 | |||
| 232 | other options available in key/value pairs | ||
| 233 | |||
| 234 | =back | ||
| 235 | |||
| 236 | =cut | ||
| 237 | sub search_venues { | ||
| 238 | my $self = shift; | ||
| 239 | my $args = {@_}; | ||
| 240 | |||
| 241 | return $self->get_data(method => 'GET', path_template => "$base_uri/venues.json", parameters => $args); | ||
| 242 | } | ||
| 243 | |||
| 244 | =head2 venue_details | ||
| 245 | |||
| 246 | Returns venue deatils by venue ID. | ||
| 247 | |||
| 248 | Also See: http://ticketmaster-api.github.io/products-and-docs/apis/discovery/#venue-details | ||
| 249 | |||
| 250 | my $ret = $tm_api->venue_details(id => 1234, ...); | ||
| 251 | |||
| 252 | =over 2 | ||
| 253 | |||
| 254 | =item id | ||
| 255 | |||
| 256 | venue id | ||
| 257 | |||
| 258 | =item ... | ||
| 259 | |||
| 260 | other options available in key/value pairs | ||
| 261 | |||
| 262 | =back | ||
| 263 | |||
| 264 | =cut | ||
| 265 | sub venue_details { | ||
| 266 | my $self = shift; | ||
| 267 | my $args = {@_}; | ||
| 268 | |||
| 269 | my $id = delete $args->{id} || die("No venue id provided\n"); | ||
| 270 | |||
| 271 | return $self->get_data(method => 'GET', path_template => "$base_uri/venues/$id.json", parameters => $args); | ||
| 272 | } | ||
| 273 | |||
| 274 | =head1 AUTHOR | ||
| 275 | |||
| 276 | Erik Tank, C<< <tank at jundy.com> >> | ||
| 277 | |||
| 278 | =head1 BUGS | ||
| 279 | |||
| 280 | Please report any bugs or feature requests to C<bug-ticketmaster-api-discovery at rt.cpan.org>, or through | ||
| 281 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Ticketmaster-API-Discovery>. I will be notified, and then you'll | ||
| 282 | automatically be notified of progress on your bug as I make changes. | ||
| 283 | |||
| 284 | |||
| 285 | |||
| 286 | |||
| 287 | =head1 SUPPORT | ||
| 288 | |||
| 289 | You can find documentation for this module with the perldoc command. | ||
| 290 | |||
| 291 | perldoc Ticketmaster::API::Discovery | ||
| 292 | |||
| 293 | |||
| 294 | You can also look for information at: | ||
| 295 | |||
| 296 | =over 4 | ||
| 297 | |||
| 298 | =item * RT: CPAN's request tracker (report bugs here) | ||
| 299 | |||
| 300 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Ticketmaster-API-Discovery> | ||
| 301 | |||
| 302 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 303 | |||
| 304 | L<http://annocpan.org/dist/Ticketmaster-API-Discovery> | ||
| 305 | |||
| 306 | =item * CPAN Ratings | ||
| 307 | |||
| 308 | L<http://cpanratings.perl.org/d/Ticketmaster-API-Discovery> | ||
| 309 | |||
| 310 | =item * Search CPAN | ||
| 311 | |||
| 312 | L<http://search.cpan.org/dist/Ticketmaster-API-Discovery/> | ||
| 313 | |||
| 314 | =back | ||
| 315 | |||
| 316 | |||
| 317 | =head1 ACKNOWLEDGEMENTS | ||
| 318 | |||
| 319 | |||
| 320 | =head1 LICENSE AND COPYRIGHT | ||
| 321 | |||
| 322 | Copyright 2016 Erik Tank. | ||
| 323 | |||
| 324 | This program is free software; you can redistribute it and/or modify it | ||
| 325 | under the terms of the the Artistic License (2.0). You may obtain a | ||
| 326 | copy of the full license at: | ||
| 327 | |||
| 328 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 329 | |||
| 330 | Any use, modification, and distribution of the Standard or Modified | ||
| 331 | Versions is governed by this Artistic License. By using, modifying or | ||
| 332 | distributing the Package, you accept this license. Do not use, modify, | ||
| 333 | or distribute the Package, if you do not accept this license. | ||
| 334 | |||
| 335 | If your Modified Version has been derived from a Modified Version made | ||
| 336 | by someone other than you, you are nevertheless required to ensure that | ||
| 337 | your Modified Version complies with the requirements of this license. | ||
| 338 | |||
| 339 | This license does not grant you the right to use any trademark, service | ||
| 340 | mark, tradename, or logo of the Copyright Holder. | ||
| 341 | |||
| 342 | This license includes the non-exclusive, worldwide, free-of-charge | ||
| 343 | patent license to make, have made, use, offer to sell, sell, import and | ||
| 344 | otherwise transfer the Package with respect to any patent claims | ||
| 345 | licensable by the Copyright Holder that are necessarily infringed by the | ||
| 346 | Package. If you institute patent litigation (including a cross-claim or | ||
| 347 | counterclaim) against any party alleging that the Package constitutes | ||
| 348 | direct or contributory patent infringement, then this Artistic License | ||
| 349 | to you shall terminate on the date that such litigation is filed. | ||
| 350 | |||
| 351 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||
| 352 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||
| 353 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
| 354 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||
| 355 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||
| 356 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||
| 357 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||
| 358 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 359 | |||
| 360 | |||
| 361 | =cut | ||
| 362 | |||
| 363 | 1; # End of Ticketmaster::API::Discovery |