File Coverage

lib/Net/API/Stripe/Billing/UsageRecord.pm
Criterion Covered Total %
statement 19 25 76.0
branch n/a
condition n/a
subroutine 7 13 53.8
pod 6 6 100.0
total 32 44 72.7


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/UsageRecord.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/usage_records
11             BEGIN
12             {
13             use strict;
14 2     2   22094637 use warnings;
  2         14  
  2         58  
15 2     2   11 use parent qw( Net::API::Stripe::Generic );
  2         3  
  2         99  
16 2     2   11 use vars qw( $VERSION );
  2         5  
  2         11  
17 2     2   184 our( $VERSION ) = 'v0.100.0';
  2         3  
  2         118  
18 2     2   38 };
19              
20             use strict;
21 2     2   11 use warnings;
  2         3  
  2         39  
22 2     2   10  
  2         3  
  2         331  
23              
24 0     0 1    
25              
26 0     0 1    
27              
28 0     0 1    
29             1;
30 0     0 1    
31              
32 0     0 1   =encoding utf8
33              
34 0     0 1   =head1 NAME
35              
36             Net::API::Stripe::Billing::UsageRecord - A Stripe Usage Record Object
37              
38             =head1 SYNOPSIS
39              
40             my $usage_record = $stripe->usage_record({
41             quantity => 1,
42             subscription_item => $subscription_item_object,
43             # Can be a unix timestamp or an iso 8601 date
44             timestamp => '2020-04-01',
45             });
46              
47             =head1 VERSION
48              
49             v0.100.0
50              
51             =head1 DESCRIPTION
52              
53             Usage records allow you to report customer usage and metrics to Stripe for metered billing of subscription plans.
54              
55             =head1 CONSTRUCTOR
56              
57             =head2 new( %ARG )
58              
59             Creates a new L<Net::API::Stripe::Billing::UsageRecord> object.
60             It may also take an hash like arguments, that also are method of the same name.
61              
62             =head1 METHODS
63              
64             =head2 id string
65              
66             Unique identifier for the object.
67              
68             =head2 object string, value is "usage_record"
69              
70             String representing the object’s type. Objects of the same type share the same value.
71              
72             =head2 livemode boolean
73              
74             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
75              
76             =head2 quantity positive integer or zero
77              
78             The usage quantity for the specified date.
79              
80             =head2 subscription_item string
81              
82             The ID of the subscription item this usage record contains data for.
83              
84             =head2 timestamp timestamp
85              
86             The timestamp when this usage occurred.
87              
88             =head1 API SAMPLE
89              
90             {
91             "id": "mbur_fake123456789",
92             "object": "usage_record",
93             "livemode": false,
94             "quantity": 100,
95             "subscription_item": "si_fake123456789",
96             "timestamp": 1571397911
97             }
98              
99             =head1 HISTORY
100              
101             =head2 v0.1
102              
103             Initial version
104              
105             =head1 AUTHOR
106              
107             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
108              
109             =head1 SEE ALSO
110              
111             Stripe API documentation:
112              
113             L<https://stripe.com/docs/api/usage_records>, L<https://stripe.com/docs/billing/subscriptions/metered-billing>
114              
115             =head1 COPYRIGHT & LICENSE
116              
117             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
118              
119             You can use, copy, modify and redistribute this package and associated
120             files under the same terms as Perl itself.
121              
122             =cut