lib/Mail/Chimp2.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 43 CC 2 SCAR 12.0
CC
2
Cov
0%
BUILD
6.0
commands
2.0
BEGIN
2.0
CRAP 3.3
1 package Mail::Chimp2;
2  
3 use 5.012;
4 use Mouse;
5  
6 # ABSTRACT: Mailchimp V2 API
7  
8 our $VERSION = '0.5'; # VERSION
9  
10 with 'Web::API';
11 use Data::Dump;
12  
13  
14 has 'dc' => (
15 is => 'rw',
16 isa => 'Str',
17 default => sub { 'us1' },
18 );
19  
20 has 'commands' => (
21 is => 'rw',
22 default => sub {
23 {
24 # campaign handling
25 campaigns_list => { path => 'campaigns/list' },
26  
27 # list handling
28 lists_list => { path => 'lists/list' },
29 lists_members => {
30 path => 'lists/members',
31 mandatory => ['id']
32 },
33 lists_batch_subscribe => {
34 path => 'lists/batch-subscribe',
35 mandatory => [ 'id', 'batch' ]
36 },
37 lists_subscribe => {
38 path => 'lists/subscribe',
39 mandatory => [ 'id', 'email' ]
40 },
41 lists_unsubscribe => {
42 path => 'lists/unsubscribe',
43 mandatory => [ 'id', 'email' ]
44 },
45  
46 };
47 });
48  
49  
50 sub commands {
51 my ($self) = @_;
52 return $self->commands;
53 }
54  
55  
56 sub BUILD {
57 my ($self) = @_;
58  
59 my ($_key, $_dc) = split(/-/, $self->api_key);
60 $self->dc($_dc) if $_dc;
61 $self->user_agent(__PACKAGE__ . ' ' . $Mail::Chimp2::VERSION);
62 $self->strict_ssl(1);
63 $self->content_type('application/json');
64 $self->default_method('POST');
65 $self->extension('json');
66 $self->base_url('https://' . $self->dc . '.api.mailchimp.com/2.0');
67 $self->auth_type('hash_key');
68 $self->api_key_field('apikey');
69  
70 return $self;
71 }
72  
73  
74 __PACKAGE__->meta->make_immutable(); # End of Mail::Chimp2
75  
76 __END__