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