blib/lib/Cikl/Smrt/Handlers/Alexa.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 15 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 61 CC 1 SCAR 6.9
CC
1
Cov
0%
name
2.0
_default_event_data
2.0
_fetcher
2.0
CRAP 2.0
1 package Cikl::Smrt::Handlers::Alexa;
2  
3 use strict;
4 use warnings;
5 use Cikl::Smrt::Fetchers::Http;
6 use Cikl::Smrt::Decoders::Zip;
7 use Cikl::Smrt::Parsers::ParseDelim;
8 use Cikl::Smrt::HandlerRole;
9 use namespace::autoclean;
10 use URI;
11 use Mouse;
12 with 'Cikl::Smrt::HandlerRole';
13  
14 # This file is initially a demonstration of a custom feed handler.
15  
16  
17 sub name {
18 return 'alexa';
19 };
20  
21 use constant ALEXA_ZIP => 'http://s3.amazonaws.com/alexa-static/top-1m.csv.zip';
22  
23 sub _default_event_data {
24 my $self = shift;
25 return {
26 group => 'everyone',
27 assessment => 'whitelist'
28 };
29 }
30  
31 sub _fetcher {
32 my $self = shift;
33 return Cikl::Smrt::Fetchers::Http->new(
34 proxy => $self->proxy(),
35 feedurl => URI->new(ALEXA_ZIP),
36 mirror => "/tmp"
37 );
38 }
39  
40 sub _parser {
41 my $self = shift;
42 return Cikl::Smrt::Parsers::ParseDelim->new(
43 delimiter => ',',
44 values => 'rank,address',
45 feed_limit => 10,
46 config => $self->global_config(),
47 );
48 }
49  
50 sub _decoder {
51 my $self = shift;
52 return Cikl::Smrt::Decoders::Zip->new(
53 zip_filename => 'top-1m.csv',
54 );
55 }
56  
57 __PACKAGE__->meta->make_immutable;
58  
59 1;