File Coverage

blib/lib/WWW/Google/URLShortener/Analytics.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             package WWW::Google::URLShortener::Analytics;
2              
3             $WWW::Google::URLShortener::Analytics::VERSION = '0.21';
4             $WWW::Google::URLShortener::Analytics::AUTHORITY = 'cpan:MANWAR';
5              
6             =head1 NAME
7              
8             WWW::Google::URLShortener::Analytics - Placeholder for the analytics of short URL.
9              
10             =head1 VERSION
11              
12             Version 0.21
13              
14             =cut
15              
16 2     2   42 use 5.006;
  2         7  
17 2     2   9 use Moo;
  2         4  
  2         22  
18 2     2   662 use namespace::clean;
  2         5  
  2         15  
19              
20             has id => (is => 'ro');
21             has longUrl => (is => 'ro');
22             has kind => (is => 'ro');
23             has result => (is => 'ro');
24              
25             =head1 SYNOPSIS
26              
27             use strict; use warnings;
28             use WWW::Google::URLShortener;
29              
30             my $api_key = 'Your API Key';
31             my $short_url = 'Your Short URL';
32             my $google = WWW::Google::URLShortener->new( 'api_key' => $api_key );
33             my $analytics = $google->get_analytics($short_url);
34              
35             print "Id: ", $analytics->id, "\n";
36             print "Long URL: ", $analytics->longUrl, "\n";
37             print "Kind: ", $analytics->kind, "\n";
38             foreach my $result (@{$analytics->result}) {
39             print "Type: ", $result->type, "\n";
40             print "Short URL Clicks: ", $result->shortUrlClicks, "\n";
41             print "Long URL Clicks: ", $result->longUrlClicks, "\n";
42             print "Countries:\n";
43             foreach my $country (@{$result->countries}) {
44             print $country->as_string, "\n";
45             }
46             print "Browsers:\n";
47             foreach my $browser (@{$result->browsers}) {
48             print $browser->as_string, "\n";
49             }
50             print "Platforms:\n";
51             foreach my $platform (@{$result->platforms}) {
52             print $platform->as_string, "\n";
53             }
54             print "Referrers:\n";
55             foreach my $referrer (@{$result->referrers}) {
56             print $referrer->as_string, "\n";
57             }
58             }
59              
60             =head1 METHODS
61              
62             =head2 id()
63              
64             Returns the id of the analytics.
65              
66             =head2 longUrl()
67              
68             Returns the long URL of the analytics.
69              
70             =head2 kind()
71              
72             Returns the kind of the analytics.
73              
74             =head2 result()
75              
76             Returns tle reference to the list of result L of the analytics.
77              
78             =head1 AUTHOR
79              
80             Mohammad S Anwar, C<< >>
81              
82             =head1 REPOSITORY
83              
84             L
85              
86             =head1 BUGS
87              
88             Please report any bugs or feature requests to C
89             rt.cpan.org>, or through the web interface at L.
90             I will be notified, and then you'll automatically be notified of progress on your
91             bug as I make changes.
92              
93             =head1 SUPPORT
94              
95             You can find documentation for this module with the perldoc command.
96              
97             perldoc WWW::Google::URLShortener::Analytics
98              
99             You can also look for information at:
100              
101             =over 4
102              
103             =item * RT: CPAN's request tracker (report bugs here)
104              
105             L
106              
107             =item * AnnoCPAN: Annotated CPAN documentation
108              
109             L
110              
111             =item * CPAN Ratings
112              
113             L
114              
115             =item * Search CPAN
116              
117             L
118              
119             =back
120              
121             =head1 LICENSE AND COPYRIGHT
122              
123             Copyright (C) 2011 - 2015 Mohammad S Anwar.
124              
125             This program is free software; you can redistribute it and/or modify it under
126             the terms of the the Artistic License (2.0). You may obtain a copy of the full
127             license at:
128              
129             L
130              
131             Any use, modification, and distribution of the Standard or Modified Versions is
132             governed by this Artistic License.By using, modifying or distributing the Package,
133             you accept this license. Do not use, modify, or distribute the Package, if you do
134             not accept this license.
135              
136             If your Modified Version has been derived from a Modified Version made by someone
137             other than you,you are nevertheless required to ensure that your Modified Version
138             complies with the requirements of this license.
139              
140             This license does not grant you the right to use any trademark, service mark,
141             tradename, or logo of the Copyright Holder.
142              
143             This license includes the non-exclusive, worldwide, free-of-charge patent license
144             to make, have made, use, offer to sell, sell, import and otherwise transfer the
145             Package with respect to any patent claims licensable by the Copyright Holder that
146             are necessarily infringed by the Package. If you institute patent litigation
147             (including a cross-claim or counterclaim) against any party alleging that the
148             Package constitutes direct or contributory patent infringement,then this Artistic
149             License to you shall terminate on the date that such litigation is filed.
150              
151             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
152             CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
153             WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
154             NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
155             REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
156             INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
157             OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
158              
159             =cut
160              
161             1; # End of WWW::Google::URLShortener::Analytics