| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Games::EveOnline::EveCentral::Request::QuickLook; | 
| 2 |  |  |  |  |  |  | { | 
| 3 |  |  |  |  |  |  | $Games::EveOnline::EveCentral::Request::QuickLook::VERSION = '0.001'; | 
| 4 |  |  |  |  |  |  | } | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | # ABSTRACT: Create a request for the quicklook endpoint. | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 1 |  |  | 1 |  | 34377 | use Moo 1.003001; | 
|  | 1 |  |  |  |  | 17631 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 11 | 1 |  |  | 1 |  | 2616 | use MooX::Types::MooseLike 0.25; | 
|  | 1 |  |  |  |  | 1536 |  | 
|  | 1 |  |  |  |  | 53 |  | 
| 12 | 1 |  |  | 1 |  | 974 | use MooX::StrictConstructor 0.006; | 
|  | 1 |  |  |  |  | 12426 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 13 | 1 |  |  | 1 |  | 29668 | use MooX::Types::MooseLike::Base qw(AnyOf ArrayRef Int Str); | 
|  | 1 |  |  |  |  | 7833 |  | 
|  | 1 |  |  |  |  | 251 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 1 |  |  | 1 |  | 32 | use 5.012; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 56 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | extends 'Games::EveOnline::EveCentral::Request'; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 1 |  |  | 1 |  | 1176 | use Readonly 1.03; | 
|  | 1 |  |  |  |  | 3851 |  | 
|  | 1 |  |  |  |  | 532 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | Readonly::Scalar my $ENDPOINT => 'quicklook'; | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | has 'hours' => ( | 
| 26 |  |  |  |  |  |  | is => 'ro', | 
| 27 |  |  |  |  |  |  | isa => Int, | 
| 28 |  |  |  |  |  |  | default => 360 | 
| 29 |  |  |  |  |  |  | ); | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | has 'type_id' => ( | 
| 32 |  |  |  |  |  |  | is => 'ro', | 
| 33 |  |  |  |  |  |  | isa => Int, | 
| 34 |  |  |  |  |  |  | required => 1 | 
| 35 |  |  |  |  |  |  | ); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | has 'min_q' => ( | 
| 38 |  |  |  |  |  |  | is => 'ro', | 
| 39 |  |  |  |  |  |  | isa => Int, | 
| 40 |  |  |  |  |  |  | default => 1 | 
| 41 |  |  |  |  |  |  | ); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | has 'regions' => ( | 
| 44 |  |  |  |  |  |  | is => 'ro', | 
| 45 |  |  |  |  |  |  | isa => AnyOf[Int, ArrayRef[Int]], | 
| 46 |  |  |  |  |  |  | default => -1 | 
| 47 |  |  |  |  |  |  | ); | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | has 'system' => ( | 
| 50 |  |  |  |  |  |  | is => 'ro', | 
| 51 |  |  |  |  |  |  | isa => Int, | 
| 52 |  |  |  |  |  |  | default => -1 | 
| 53 |  |  |  |  |  |  | ); | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | has '_path' => ( | 
| 56 |  |  |  |  |  |  | is => 'lazy', | 
| 57 |  |  |  |  |  |  | isa => Str, | 
| 58 |  |  |  |  |  |  | ); | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | sub request { | 
| 63 | 1 |  |  | 1 | 1 | 689 | my $self = shift; | 
| 64 | 1 |  |  |  |  | 38 | my $path = $self->_path; | 
| 65 |  |  |  |  |  |  |  | 
| 66 | 1 |  |  |  |  | 19 | return $self->http_request($path); | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | sub _build__path { | 
| 72 | 3 |  |  | 3 |  | 24349 | my $self = shift; | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 3 |  |  |  |  | 12 | my $path = $ENDPOINT . '?'; | 
| 75 |  |  |  |  |  |  |  | 
| 76 | 3 |  |  |  |  | 16 | $path .= 'typeid=' . $self->type_id; | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 3 | 50 |  |  |  | 20 | if (defined $self->hours) { | 
| 79 | 3 |  |  |  |  | 8 | my $hours = $self->hours; | 
| 80 | 3 |  |  |  |  | 9 | $path .= "&sethours=$hours"; | 
| 81 |  |  |  |  |  |  | } | 
| 82 |  |  |  |  |  |  |  | 
| 83 | 3 | 50 |  |  |  | 19 | if (defined $self->min_q) { | 
| 84 | 3 |  |  |  |  | 16 | my $min_q = $self->min_q; | 
| 85 | 3 |  |  |  |  | 9 | $path .= "&setminQ=$min_q"; | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  |  | 
| 88 | 3 |  |  |  |  | 10 | my $system = $self->system; | 
| 89 | 3 | 100 | 66 |  |  | 27 | if (defined $system && $system > 0) { | 
| 90 | 1 |  |  |  |  | 3 | $path .= "&usesystem=$system"; | 
| 91 |  |  |  |  |  |  | } | 
| 92 |  |  |  |  |  |  |  | 
| 93 | 3 |  |  |  |  | 10 | my $regions = $self->regions; | 
| 94 | 3 | 100 | 66 |  |  | 19 | if (defined $regions && $regions > 0) { | 
| 95 | 2 | 100 |  |  |  | 9 | if (ref $regions eq 'ARRAY') { | 
| 96 | 1 |  |  |  |  | 2 | for my $region (@$regions) { | 
| 97 | 2 |  |  |  |  | 7 | $path .= "®ionlimit=$region"; | 
| 98 |  |  |  |  |  |  | } | 
| 99 |  |  |  |  |  |  | } | 
| 100 |  |  |  |  |  |  | else { | 
| 101 | 1 |  |  |  |  | 6 | $path .= "®ionlimit=$regions"; | 
| 102 |  |  |  |  |  |  | } | 
| 103 |  |  |  |  |  |  | } | 
| 104 |  |  |  |  |  |  |  | 
| 105 | 3 |  |  |  |  | 69 | return $path; | 
| 106 |  |  |  |  |  |  | } | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | 1; # End of Games::EveOnline::EveCentral::Request::QuickLook | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | __END__ | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =pod | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head1 NAME | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | Games::EveOnline::EveCentral::Request::QuickLook - Create a request for the quicklook endpoint. | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =head1 VERSION | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | version 0.001 | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | my $req = Games::EveOnline::EveCentral::Request::QuickLook->new( | 
| 126 |  |  |  |  |  |  | type_id => 34, # Mandatory. | 
| 127 |  |  |  |  |  |  | hours => 1, # defaults to 360 | 
| 128 |  |  |  |  |  |  | min_q => 10000, # defaults to 1 | 
| 129 |  |  |  |  |  |  | system => 30000142, | 
| 130 |  |  |  |  |  |  | regions => 10000002, # or [10000002, 10000003], | 
| 131 |  |  |  |  |  |  | )->request; | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | This class is used to create HTTP::Request objects suitable to call the | 
| 136 |  |  |  |  |  |  | `quicklook` method on EVE Central. | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | Please take care to only use valid type ids. | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | Examples: | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | =over 4 | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | =item * L<http://api.eve-central.com/api/quicklook?typeid=34> | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | =back | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | =for test_synopsis no strict 'vars' | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =head1 METHODS | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | =head2 request | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | Returns an HTTP::Request object which can be used to call the 'quicklook' | 
| 155 |  |  |  |  |  |  | endpoint. | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | =begin private | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | =end private | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | =head1 AUTHOR | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | Pedro Figueiredo, C<< <me at pedrofigueiredo.org> >> | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | =head1 BUGS | 
| 166 |  |  |  |  |  |  |  | 
| 167 |  |  |  |  |  |  | Please report any bugs or feature requests through the web interface at | 
| 168 |  |  |  |  |  |  | L<https://github.com/pfig/games-eveonline-evecentral/issues>.  I will be | 
| 169 |  |  |  |  |  |  | notified, and then you'll automatically be notified of progress on your bug as | 
| 170 |  |  |  |  |  |  | I make changes. | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | =head1 SUPPORT | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | You can find documentation for this module with the perldoc command. | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | perldoc Games::EveOnline::EveCentral | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | You can also look for information at: | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | =over 4 | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | =item * GitHub Issues (report bugs here) | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | L<https://github.com/pfig/games-eveonline-evecentral/issues> | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | =item * AnnoCPAN: Annotated CPAN documentation | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | L<http://annocpan.org/dist/Games-EveOnline-EveCentral> | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | =item * CPAN Ratings | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | L<http://cpanratings.perl.org/d/Games-EveOnline-EveCentral> | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | =item * CPAN | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | L<http://metacpan.org/module/Games::EveOnline::EveCentral> | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | =back | 
| 199 |  |  |  |  |  |  |  | 
| 200 |  |  |  |  |  |  | =head1 ACKNOWLEDGEMENTS | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | =over 4 | 
| 203 |  |  |  |  |  |  |  | 
| 204 |  |  |  |  |  |  | =item * The people behind EVE Central. | 
| 205 |  |  |  |  |  |  |  | 
| 206 |  |  |  |  |  |  | L<http://eve-central.com/> | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | =back | 
| 209 |  |  |  |  |  |  |  | 
| 210 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 211 |  |  |  |  |  |  |  | 
| 212 |  |  |  |  |  |  | Copyright 2013 Pedro Figueiredo. | 
| 213 |  |  |  |  |  |  |  | 
| 214 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 215 |  |  |  |  |  |  | under the terms of the Artistic License. | 
| 216 |  |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | See http://dev.perl.org/licenses/ for more information. | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | =head1 AUTHOR | 
| 220 |  |  |  |  |  |  |  | 
| 221 |  |  |  |  |  |  | Pedro Figueiredo <me@pedrofigueiredo.org> | 
| 222 |  |  |  |  |  |  |  | 
| 223 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 224 |  |  |  |  |  |  |  | 
| 225 |  |  |  |  |  |  | This software is copyright (c) 2013 by Pedro Figueiredo. | 
| 226 |  |  |  |  |  |  |  | 
| 227 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 228 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 229 |  |  |  |  |  |  |  | 
| 230 |  |  |  |  |  |  | =cut |