Stripe/Event/Data.pm

filter: Statementstmt 47.0% 8 / 17 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 3 / 6 Podpod 100% 2 / 2 totaltotal 39.3% 13 / 33 CC 4 SCAR 22.7
CC
4
Cov
35%
object
20.0
__ANON__
2.0
previous_attributes
2.0
CRAP 9.7
« Stripe/Product/PackageDimension.pm ↑ Summary Stripe/TimeZone.pm »
1 ##----------------------------------------------------------------------------
2 ## Stripe API - ~/lib/Net/API/Stripe/Event/Data.pm
3 ## Version v0.100.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 ## Object of the resources relevant to the event, e.g. balance, or invoice
11 ## This must be processed by callbacks to set the right object
12 package Net::API::Stripe::Event::Data;
13 BEGIN
14 {
15 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶ use parent qw( Net::API::Stripe::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶ our( $VERSION ) = 'v0.100.0';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 };
19  
20 sub object
21 {
22 0 ▶ my $self = shift( @_ );
Subroutine object: not called CC=4 SCAR=30.0
Pod documented
23 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
24 {
25 0 my $ref = shift( @_ );
26 ## This is not a type, there is an object property that contains a hash
27 0 ▶ my $type = $ref->{object} || return( $self->error( "No object type could be found for field $self->{_field} in hash: ", sub{ $self->dumper( $ref ) } ) );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/2
$ref->{'object'} || (return $self->error("No object type could be found for field $self->{'_field'} in hash: ", sub {
l!l
00
MC/DC0%0/1
$ref->{'object'} || (return $self->error("No object type could be found for field $self->{'_field'} in hash: ", sub { $self->dumper($ref); } ))
$ref->{'object'}
Truth table0%0/2
A
A= $ref->{'object'}
Aresult
11
00
28 0 ▶ my $class = $self->_object_type_to_class( $type ) ||
Condition0%0/2
$self->_object_type_to_class($type) || (return $self->error("No class found for object type $type"))
l!l
00
MC/DC0%0/1
$self->_object_type_to_class($type) || (return $self->error("No class found for object type $type"))
$self->_object_type_to_class($type)
Truth table0%0/2
A
A= $self->_object_type_to_class($type)
Aresult
11
00
29 return( $self->error( "No class found for object type $type" ) );
30 0 return( $self->_set_get_object( 'object', $class, $ref ) );
31 }
32 0 return( $self->{object} );
33 }
34  
35 0 ▶sub previous_attributes { return( shift->_set_get_hash( 'previous_attributes', @_ ) ); }
Subroutine previous_attributes: not called CC=1 SCAR=6.9
Pod documented
36  
37 1 1;
38  
39 __END__
40  
41 =encoding utf8
42  
43 =head1 NAME
44  
45 Net::API::Stripe::Event::Data - A Stripe Event Data Object
46  
47 =head1 SYNOPSIS
48  
49 my $event_data = $stripe->event->data({
50 # The type of object is variable. In this example we use an invoice object
51 object => $invoice_object,
52 });
53  
54 =head1 VERSION
55  
56 v0.100.0
57  
58 =head1 DESCRIPTION
59  
60 This is a Stripe Event Data Object.
61  
62 This is instantiated by the method B<data> in module L<Net::API::Stripe::Event>
63  
64 =head1 CONSTRUCTOR
65  
66 =over 4
67  
68 =item B<new>( %ARG )
69  
70 Creates a new L<Net::API::Stripe::Event::Data> object.
71 It may also take an hash like arguments, that also are method of the same name.
72  
73 =back
74  
75 =head1 METHODS
76  
77 =over 4
78  
79 =item B<object> hash
80  
81 Object containing the API resource relevant to the event. For example, an invoice.created event will have a full invoice object as the value of the object key.
82  
83 =item B<previous_attributes> hash
84  
85 Object containing the names of the attributes that have changed, and their previous values (sent along only with *.updated events).
86  
87 =back
88  
89 =head1 API SAMPLE
90  
91 {
92 "id": "evt_fake123456789",
93 "object": "event",
94 "api_version": "2017-02-14",
95 "created": 1528914645,
96 "data": {
97 "object": {
98 "object": "balance",
99 "available": [
100 {
101 "currency": "jpy",
102 "amount": 1025751,
103 "source_types": {
104 "card": 1025751
105 }
106 }
107 ],
108 "connect_reserved": [
109 {
110 "currency": "jpy",
111 "amount": 0
112 }
113 ],
114 "livemode": false,
115 "pending": [
116 {
117 "currency": "jpy",
118 "amount": 0,
119 "source_types": {
120 "card": 0
121 }
122 }
123 ]
124 }
125 },
126 "livemode": false,
127 "pending_webhooks": 0,
128 "request": {
129 "id": null,
130 "idempotency_key": null
131 },
132 "type": "balance.available"
133 }
134  
135 =head1 HISTORY
136  
137 =head2 v0.1
138  
139 Initial version
140  
141 =head1 AUTHOR
142  
143 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
144  
145 =head1 SEE ALSO
146  
147 Stripe API documentation:
148  
149 L<https://stripe.com/docs/api/events/object>
150  
151 =head1 COPYRIGHT & LICENSE
152  
153 Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
154  
155 You can use, copy, modify and redistribute this package and associated
156 files under the same terms as Perl itself.
157  
158 =cut
« Stripe/Product/PackageDimension.pm ↑ Summary Stripe/TimeZone.pm »