| line | stmt | bran | cond | sub | pod | time | code | 
| 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 |  |  | 1 |  | 815 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 29 |  | 
| 16 | 1 |  |  | 1 |  | 4 | use parent qw( Net::API::Stripe::Generic ); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 17 | 1 |  |  | 1 |  | 195 | our( $VERSION ) = 'v0.100.0'; | 
| 18 |  |  |  |  |  |  | }; | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | sub object | 
| 21 |  |  |  |  |  |  | { | 
| 22 | 0 |  |  | 0 | 1 |  | my $self = shift( @_ ); | 
| 23 | 0 | 0 |  |  |  |  | if( @_ ) | 
| 24 |  |  |  |  |  |  | { | 
| 25 | 0 |  |  |  |  |  | my $ref = shift( @_ ); | 
| 26 |  |  |  |  |  |  | ## This is not a type, there is an object property that contains a hash | 
| 27 | 0 |  | 0 | 0 |  |  | my $type = $ref->{object} || return( $self->error( "No object type could be found for field $self->{_field} in hash: ", sub{ $self->dumper( $ref ) } ) ); | 
|  | 0 |  |  |  |  |  |  | 
| 28 | 0 |  | 0 |  |  |  | my $class = $self->_object_type_to_class( $type ) || | 
| 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 |  |  | 0 | 1 |  | sub previous_attributes { return( shift->_set_get_hash( 'previous_attributes', @_ ) ); } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | 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 |