Response.pm

filter: Statementstmt 43.7% 7 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 22.2% 2 / 9 Podpod 57.1% 4 / 7 totaltotal 40.6% 13 / 32 CC 1 SCAR 5.8
CC
1
Cov
44%
new
2.0
is_success
2.0
usage_reports
2.0
CRAP 1.8
↑ Summary Client.pm »
1 package Net::ThreeScale::Response;
2  
3 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
7 0 my $class = shift;
8 0 my $self = {@_};
9 0 return bless $self, $class;
10 }
11  
12 0 ▶sub is_success{
Subroutine is_success: not called CC=1 SCAR=6.9
Pod documented
13 0 return $_[0]->{success};
14 }
15  
16 0 ▶sub usage_reports{
Subroutine usage_reports: not called CC=1 SCAR=6.9
Pod documented
17 0 return $_[0]->{usage_reports};
18 }
19  
20 0 ▶sub application_plan {
Subroutine application_plan: not called CC=1 SCAR=6.9
Pod undocumented
21 0 return $_[0]->{application_plan};
22 }
23  
24 0 ▶sub error_code{
Subroutine error_code: not called CC=1 SCAR=6.9
Pod documented
25 0 return $_[0]->{error_code};
26 }
27  
28 0 ▶sub error_message{
Subroutine error_message: not called CC=1 SCAR=6.9
Pod documented
29 0 return $_[0]->{error_message};
30 }
31  
32 0 ▶sub errors{
Subroutine errors: not called CC=1 SCAR=6.9
Pod undocumented
33 0 return $_[0]->{errors};
34 }
35 7 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<Net::ThreeScale::Client> module. See
70 L<Net::ThreeScale::Client> 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<Net::ThreeScale::Client>
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
↑ Summary Client.pm »