File Coverage

blib/lib/WebService/Flattr/Response.pm
Criterion Covered Total %
statement 6 14 42.8
branch n/a
condition n/a
subroutine 2 8 25.0
pod 5 5 100.0
total 13 27 48.1


line stmt bran cond sub pod time code
1             package WebService::Flattr::Response;
2             {
3             $WebService::Flattr::Response::VERSION = '0.55';
4             }
5              
6 1     1   7 use strict;
  1         2  
  1         48  
7 1     1   6 use warnings;
  1         3  
  1         293  
8              
9             =head1 NAME
10              
11             WebService::Flattr::Response - Handles responses from WebService::Flattr
12              
13             =head1 VERSION
14              
15             version 0.55
16              
17             =head1 DESCRIPTION
18              
19             This module provides objects describing responses from Flattr's social
20             micro-payments API generated by L<< WebService::Flattr >>.
21              
22             =head1 METHODS
23              
24             =cut
25              
26             sub _new {
27 0     0     my $class = shift;
28 0           my $arg = shift;
29              
30 0           return bless $arg, $class;
31             }
32              
33             =head2 data
34              
35             This returns a data structure deserialised from the JSON part of the
36             response as defined by Flattr's API.
37              
38             =cut
39              
40             sub data {
41 0     0 1   shift->{data};
42             }
43              
44             =head2 http_response
45              
46             This returns an L<< HTTP::Response >> object.
47              
48             =cut
49              
50             sub http_response {
51 0     0 1   shift->{response};
52             }
53              
54             =head2 rate_limit
55              
56             This returns the number of rate limited requests per hour as defined by
57             the X-RateLimit-Limit header at L<<
58             http://developers.flattr.net/api/#rate-limiting >>.
59              
60             =cut
61              
62             sub rate_limit {
63 0     0 1   shift->{response}->headers->header('X-RateLimit-Limit');
64             }
65              
66             =head2 limit_remaining
67              
68             This returns the number of rate limited requests remaining as defined by
69             the X-RateLimit-Remaining header at L<<
70             http://developers.flattr.net/api/#rate-limiting >>.
71              
72             =cut
73              
74             sub limit_remaining {
75 0     0 1   shift->{response}->headers->header('X-RateLimit-Remaining');
76             }
77              
78             =head2 limit_reset
79              
80             This returns a Unix timestamp defining when Flattr will reset your rate
81             limit. Flattr do not specify the timezone used by this field.
82              
83             =cut
84              
85             sub limit_reset {
86 0     0 1   shift->{response}->headers->header('X-RateLimit-Reset');
87             }
88              
89             1;
90             __END__