Stripe/WebHook/Object.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 41 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
id
2.0
object
2.0
CRAP 2.0
1 ##----------------------------------------------------------------------------
2 ## Stripe API - ~/lib/Net/API/Stripe/WebHook/Object.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <@sitael.tokyo.deguest.jp>
6 ## Created 2019/11/02
7 ## Modified 2020/05/15
8 ##
9 ##----------------------------------------------------------------------------
10 package Net::API::Stripe::WebHook::Object;
11 BEGIN
12 {
13 use strict;
14 use parent qw( Net::API::Stripe::Generic );
15 };
16  
17 sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
18  
19 ## Should be webhook_endpoint
20 sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
21  
22 sub api_version { return( shift->_set_get_scalar( 'api_version', @_ ) ); }
23  
24 sub application { return( shift->_set_get_scalar( 'application', @_ ) ); }
25  
26 sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
27  
28 ## * to enable all event, other array of event types
29 sub enabled_events { return( shift->_set_get_array( 'enabled_events', @_ ) ); }
30  
31 sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
32  
33 sub secret { return( shift->_set_get_scalar( 'secret', @_ ) ); }
34  
35 ## enabled or disabled
36 sub status { return( shift->_set_get_scalar( 'status', @_ ) ); }
37  
38 sub url { return( shift->_set_get_uri( 'url', @_ ) ); }
39  
40 1;
41  
42 __END__
43  
44 =encoding utf8
45  
46 =head1 NAME
47  
48 Net::API::Stripe::WebHook::Object - An Stripe WebHook Object
49  
50 =head1 SYNOPSIS
51  
52 my $hook = $stripe->webhook({
53 api_version => '2020-03-02',
54 application => undef,
55 enabled_events => ['*'],
56 livemode => $stripe->false,
57 status => 'enabled',
58 url => 'https://api.example.con/stripe/CAC29A87-991E-44AF-8636-888E03082DDF',
59 });
60  
61 See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
62  
63 =head1 VERSION
64  
65 v0.1.0
66  
67 =head1 DESCRIPTION
68  
69 This is a Stripe webhook endpoint object.
70  
71 =head1 CONSTRUCTOR
72  
73 =over 4
74  
75 =item B<new>( %ARG )
76  
77 Creates a new L<Net::API::Stripe::WebHook::Object> object.
78 It may also take an hash like arguments, that also are method of the same name.
79  
80 =back
81  
82 =head1 METHODS
83  
84 =over 4
85  
86 =item B<id> string
87  
88 Unique identifier for the object.
89  
90 =item B<object> string, value is "webhook_endpoint"
91  
92 String representing the object’s type. Objects of the same type share the same value.
93  
94 =item B<api_version> string
95  
96 The API version events are rendered as for this webhook endpoint.
97  
98 =item B<application> string
99  
100 The ID of the associated Connect application.
101  
102 =item B<created> timestamp
103  
104 Time at which the object was created. Measured in seconds since the Unix epoch.
105  
106 =item B<enabled_events> array containing strings
107  
108 The list of events to enable for this endpoint. You may specify ['*'] to enable all events.
109  
110 =item B<livemode> boolean
111  
112 Has the value true if the object exists in live mode or the value false if the object exists in test mode.
113  
114 =item B<secret> string
115  
116 The endpoint’s secret, used to generate webhook signatures. Only returned at creation.
117  
118 =item B<status> string
119  
120 The status of the webhook. It can be enabled or disabled.
121  
122 =item B<url> string
123  
124 The URL of the webhook endpoint.
125  
126 =back
127  
128 =head1 API SAMPLE
129  
130 {
131 "id": "we_fake123456789",
132 "object": "webhook_endpoint",
133 "api_version": "2017-02-14",
134 "application": null,
135 "created": 1542006805,
136 "enabled_events": [
137 "invoice.created",
138 "invoice.payment_failed",
139 "invoice.payment_succeeded"
140 ],
141 "livemode": false,
142 "status": "enabled",
143 "url": "http://expugno.serveo.net/stripe/invoice"
144 }
145  
146 =head1 HISTORY
147  
148 =head2 v0.1
149  
150 Initial version
151  
152 =head1 AUTHOR
153  
154 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
155  
156 =head1 SEE ALSO
157  
158 Stripe API documentation:
159  
160 L<https://stripe.com/docs/api/webhook_endpoints>
161  
162 =head1 COPYRIGHT & LICENSE
163  
164 Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
165  
166 You can use, copy, modify and redistribute this package and associated
167 files under the same terms as Perl itself.
168  
169 =cut