File Coverage

blib/lib/Net/Iugu.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package Net::Iugu;
2             $Net::Iugu::VERSION = '0.000002';
3 8     8   515365 use Moo;
  8         108355  
  8         46  
4             extends 'Net::Iugu::Request';
5              
6 8     8   13635 use Net::Iugu::Customers;
  8         20  
  8         334  
7 8     8   3488 use Net::Iugu::PaymentMethods;
  8         19  
  8         195  
8 8     8   2730 use Net::Iugu::Invoices;
  8         16  
  8         199  
9 8     8   2880 use Net::Iugu::MarketPlace;
  0            
  0            
10             use Net::Iugu::Plans;
11             use Net::Iugu::Subscriptions;
12             use Net::Iugu::Transfers;
13              
14             has 'token' => (
15             is => 'ro',
16             required => 1,
17             );
18              
19             has 'customers' => (
20             is => 'ro',
21             lazy => 1,
22             builder => sub { Net::Iugu::Customers->new( token => shift->token ) },
23             );
24              
25             has 'payment_methods' => (
26             is => 'ro',
27             lazy => 1,
28             builder => sub { Net::Iugu::PaymentMethods->new( token => shift->token ) },
29             );
30              
31             has 'invoices' => (
32             is => 'ro',
33             lazy => 1,
34             builder => sub { Net::Iugu::Invoices->new( token => shift->token ) },
35             );
36              
37             has 'market_place' => (
38             is => 'ro',
39             lazy => 1,
40             builder => sub { Net::Iugu::MarketPlace->new( token => shift->token ) },
41             );
42              
43             has 'plans' => (
44             is => 'ro',
45             lazy => 1,
46             builder => sub { Net::Iugu::Plans->new( token => shift->token ) },
47             );
48              
49             has 'subscriptions' => (
50             is => 'ro',
51             lazy => 1,
52             builder => sub { Net::Iugu::Subscriptions->new( token => shift->token ) },
53             );
54              
55             has 'transfers' => (
56             is => 'ro',
57             lazy => 1,
58             builder => sub { Net::Iugu::Transfers->new( token => shift->token ) },
59             );
60              
61             sub create_token {
62             my ( $self, $data ) = @_;
63              
64             my $uri = $self->base_uri . '/payment_token';
65              
66             return $self->request( POST => $uri, $data );
67             }
68              
69             sub charge {
70             my ( $self, $data ) = @_;
71              
72             my $uri = $self->base_uri . '/charge';
73              
74             return $self->request( POST => $uri, $data );
75             }
76              
77             1;
78              
79             # ABSTRACT: Perl modules for integration with Iugu payment web services
80              
81             __END__