| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::ThreeScale::Response; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 7 |  |  | 7 |  | 60 | use warnings; | 
|  | 7 |  |  |  |  | 24 |  | 
|  | 7 |  |  |  |  | 328 |  | 
| 4 | 7 |  |  | 7 |  | 53 | use strict; | 
|  | 7 |  |  |  |  | 20 |  | 
|  | 7 |  |  |  |  | 1686 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | sub new { | 
| 7 | 0 |  |  | 0 | 0 |  | my $class = shift; | 
| 8 | 0 |  |  |  |  |  | my $self = {@_}; | 
| 9 | 0 |  |  |  |  |  | return bless $self, $class; | 
| 10 |  |  |  |  |  |  | } | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub is_success{ | 
| 13 | 0 |  |  | 0 | 1 |  | return $_[0]->{success}; | 
| 14 |  |  |  |  |  |  | } | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | sub usage_reports{ | 
| 17 | 0 |  |  | 0 | 1 |  | return $_[0]->{usage_reports}; | 
| 18 |  |  |  |  |  |  | } | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | sub application_plan { | 
| 21 | 0 |  |  | 0 | 0 |  | return $_[0]->{application_plan}; | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | sub error_code{ | 
| 25 | 0 |  |  | 0 | 1 |  | return $_[0]->{error_code}; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub error_message{ | 
| 29 | 0 |  |  | 0 | 1 |  | return $_[0]->{error_message}; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | sub errors{ | 
| 33 | 0 |  |  | 0 | 0 |  | return $_[0]->{errors}; | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  | 1; | 
| 36 |  |  |  |  |  |  | =head1 NAME | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | Net::ThreeScale::Response - object encapsulating a response to a 3Scale API v2.0 call | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | $response = $client->authorize(app_id=>$app_id, app_key=>$app_key); | 
| 43 |  |  |  |  |  |  | if($response->is_success){ | 
| 44 |  |  |  |  |  |  | my @usage = @{$response->usage_reports()}; | 
| 45 |  |  |  |  |  |  | }else{ | 
| 46 |  |  |  |  |  |  | print STDERR "An error occurred with code ", $response->error_code, ":" ,$response->error,"\n"; | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | A response object is returned from various calls in the 3Scale API, the following fields are of relevance: | 
| 52 |  |  |  |  |  |  | Objects are constructed within the API, you should not create them yourself. | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | =over 4 | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =item $r->is_success | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | Indicates if the operation which generated the response was successfull. Successful responses will | 
| 59 |  |  |  |  |  |  | have an associated transaction within the response. | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =item $r->usage_reports | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | A list of usage reports returned by 3Scale indicating how much of the user's | 
| 64 |  |  |  |  |  |  | quota has been used. | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =item $r->error_code | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | Returns the error code  (as a string) which was genrerated by this response, these correspond | 
| 69 |  |  |  |  |  |  | to constants exported by the L module. See | 
| 70 |  |  |  |  |  |  | L for a list of available response codes. | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =item $r->error_message | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | Returns a textual description of the error returned by the server. | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =back | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | L | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =head1 AUTHOR | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | (c) Owen Cliffe 2008, Eugene Oden 2010. | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =head1 CONTRIBUTORS | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =over | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =item * | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | Dave Lambley | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =item * | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | Ed Freyfogle | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =item * | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | Marc Metten | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =back |