File Coverage

blib/lib/Paymill/REST/Item/Subscription.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Paymill::REST::Item::Subscription;
2              
3 9     9   6889 use Moose;
  9         27  
  9         99  
4 9     9   71996 use MooseX::Types::DateTime::ButMaintained qw(DateTime);
  9         9526130  
  9         74  
5              
6             with 'Paymill::REST::Operations::Delete';
7              
8             has _factory => (is => 'ro', isa => 'Object');
9              
10             has id => (is => 'ro', isa => 'Str');
11             has livemode => (is => 'ro', isa => 'Bool');
12             has created_at => (is => 'ro', isa => DateTime, coerce => 1);
13             has updated_at => (is => 'ro', isa => DateTime, coerce => 1);
14             has canceled_at => (is => 'ro', isa => 'Undef|DateTime', coerce => 1);
15             has trial_start => (is => 'ro', isa => 'Undef|DateTime', coerce => 1);
16             has trial_end => (is => 'ro', isa => 'Undef|DateTime', coerce => 1);
17             has next_capture_at => (is => 'ro', isa => 'DateTime|Bool', coerce => 1);
18             has cancel_at_period_end => (is => 'ro', isa => 'Bool');
19             has app_id => (is => 'ro', isa => 'Undef|Str');
20              
21             has client => (
22             is => 'ro',
23             isa => 'Undef|Str|Object|HashRef',
24             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('client', @_) }
25             );
26             has payment => (
27             is => 'ro',
28             isa => 'Undef|Object|HashRef',
29             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('payment', @_) }
30             );
31             has offer => (
32             is => 'ro',
33             isa => 'Undef|Object|HashRef|ArrayRef',
34             trigger => sub { Paymill::REST::TypesAndTriggers::item_from_hashref('offer', @_) }
35             );
36              
37 9     9   20973 no Moose;
  9         30  
  9         84  
38             1;
39             __END__
40              
41             =encoding utf-8
42              
43             =head1 NAME
44              
45             Paymill::REST::Item::Subscription - Item class for a subscription
46              
47             =head1 SYNOPSIS
48              
49             my $subscription_api = Paymill::REST::Subscriptions->new;
50             $subscription = $subscription_api->find('sub_lk2j34h5lk34h5lkjh2');
51              
52             say $subscription->id; # Prints the id of the subscription
53              
54             =head1 DESCRIPTION
55              
56             Represents a subscription with all attributes and all sub items.
57              
58             =head1 ATTRIBUTES
59              
60             =over 4
61              
62             =item id
63              
64             String containing the identifier of the client
65              
66             =item livemode
67              
68             Boolean indicating whether this preauthorization has been made with the live keys or not
69              
70             =item created_at
71              
72             L<DateTime> object indicating the date of the creation as returned by the API
73              
74             =item updated_at
75              
76             L<DateTime> object indicating the date of the last update as returned by the API
77              
78             =item canceled_at
79              
80             L<DateTime> object indicating the cancellation date of the subcription
81              
82             =item trial_start
83              
84             L<DateTime> object indicating the date the trial period started
85              
86             =item trial_end
87              
88             L<DateTime> object indicating the date the trial period ended
89              
90             =item next_capture_at
91              
92             L<DateTime> object indicating the date of the next charging, or boolean if subscription is cancelled
93              
94             =item cancel_at_period_end
95              
96             Boolean indicating whether the subscription will be cancelled at the end of this period
97              
98             =item app_id
99              
100             String representing the app id that created this subscription
101              
102             =back
103              
104             =head1 SUB ITEMS
105              
106             =over 4
107              
108             =item client
109              
110             A client object.
111              
112             See also L<Paymill::REST::Item::Client>.
113              
114             =item offer
115              
116             An offer object.
117              
118             See also L<Paymill::REST::Item::Offer>.
119              
120             =item payment
121              
122             A payment object.
123              
124             See also L<Paymill::REST::Item::Payment>.
125              
126             =back
127              
128             =head1 AVAILABLE OPERATIONS
129              
130             =over 4
131              
132             =item delete
133              
134             L<Paymill::REST::Operations::Delete>
135              
136             =back
137              
138             =head1 SEE ALSO
139              
140             L<Paymill::REST> for more documentation.
141              
142             =head1 AUTHOR
143              
144             Matthias Dietrich E<lt>perl@rainboxx.deE<gt>
145              
146             =head1 COPYRIGHT
147              
148             Copyright 2013 - Matthias Dietrich
149              
150             =head1 LICENSE
151              
152             This library is free software; you can redistribute it and/or modify
153             it under the same terms as Perl itself.