File Coverage

lib/Net/API/Stripe/Sigma/ScheduledQueryRun.pm
Criterion Covered Total %
statement 19 30 63.3
branch n/a
condition n/a
subroutine 7 18 38.8
pod 11 11 100.0
total 37 59 62.7


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Sigma/ScheduledQueryRun.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/sigma/scheduled_queries/object
11             package Net::API::Stripe::Sigma::ScheduledQueryRun;
12             BEGIN
13             {
14 2     2   21070678 use strict;
  2         16  
  2         61  
15 2     2   11 use warnings;
  2         6  
  2         61  
16 2     2   13 use parent qw( Net::API::Stripe::Generic );
  2         7  
  2         12  
17 2     2   146 use vars qw( $VERSION );
  2         5  
  2         124  
18 2     2   63 our( $VERSION ) = 'v0.100.0';
19             };
20              
21 2     2   13 use strict;
  2         6  
  2         39  
22 2     2   18 use warnings;
  2         5  
  2         595  
23              
24 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
25              
26 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
27              
28 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
29              
30 0     0 1   sub data_load_time { return( shift->_set_get_datetime( 'data_load_time', @_ ) ); }
31              
32 0     0 1   sub error { return( shift->_set_get_hash( 'error', @_ ) ); }
33              
34 0     0 1   sub file { return( shift->_set_get_object( 'file', 'Net::API::Stripe::File', @_ ) ); }
35              
36 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
37              
38 0     0 1   sub result_available_until { return( shift->_set_get_datetime( 'result_available_until', @_ ) ); }
39              
40 0     0 1   sub sql { return( shift->_set_get_scalar( 'sql', @_ ) ); }
41              
42 0     0 1   sub status { return( shift->_set_get_scalar( 'status', @_ ) ); }
43              
44 0     0 1   sub title { return( shift->_set_get_scalar( 'title', @_ ) ); }
45              
46             1;
47             # NOTE: POD
48             __END__
49              
50             =encoding utf8
51              
52             =head1 NAME
53              
54             Net::API::Stripe::Sigma::ScheduledQueryRun - A Stripe Schedule Query Run Object
55              
56             =head1 SYNOPSIS
57              
58             my $query = $stripe->schedule_query({
59             created => '2020-06-12T08:00:00',
60             data_load_time => '2020-06-12T08:00:02',
61             file => $file_object,
62             livemode => $stripe->false,
63             result_available_until => '2020-05-31',
64             sql => <<EOT,
65             select
66             id,
67             amount,
68             fee,
69             currency
70             from balance_transactions
71             where
72             created < data_load_time and
73             created >= data_load_time - interval '1' month
74             order by created desc
75             limit 10
76             EOT
77             status => 'completed',
78             title => 'Monthly balance transactions',
79             });
80              
81             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
82              
83             =head1 VERSION
84              
85             v0.100.0
86              
87             =head1 DESCRIPTION
88              
89             If you have scheduled a L<Sigma query|https://stripe.com/docs/sigma/scheduled-queries>, you'll receive a sigma.scheduled_query_run.created webhook each time the query runs. The webhook contains a ScheduledQueryRun object, which you can use to retrieve the query results.
90              
91             =head1 CONSTRUCTOR
92              
93             =head2 new( %ARG )
94              
95             Creates a new L<Net::API::Stripe::Sigma::ScheduledQueryRun> object.
96             It may also take an hash like arguments, that also are method of the same name.
97              
98             =head1 METHODS
99              
100             =head2 id string
101              
102             Unique identifier for the object.
103              
104             =head2 object string, value is "scheduled_query_run"
105              
106             String representing the object’s type. Objects of the same type share the same value.
107              
108             =head2 created timestamp
109              
110             Time at which the object was created. Measured in seconds since the Unix epoch.
111              
112             =head2 data_load_time timestamp
113              
114             When the query was run, Sigma contained a snapshot of your Stripe data at this time.
115              
116             =head2 error hash
117              
118             If the query run was not successful, this field contains information about the failure.
119              
120             This is a L<Net::API::Stripe::Error> object.
121              
122             =head2 file hash
123              
124             The file object representing the results of the query.
125              
126             This is a L<Net::API::Stripe::File> object.
127              
128             =head2 livemode boolean
129              
130             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
131              
132             =head2 result_available_until timestamp
133              
134             Time at which the result expires and is no longer available for download.
135              
136             =head2 sql string
137              
138             SQL for the query.
139              
140             =head2 status string
141              
142             The query’s execution status, which will be completed for successful runs, and canceled, failed, or timed_out otherwise.
143              
144             =head2 title string
145              
146             Title of the query.
147              
148             =head1 API SAMPLE
149              
150             {
151             "id": "sqr_fake123456789",
152             "object": "scheduled_query_run",
153             "created": 1571480457,
154             "data_load_time": 1571270400,
155             "file": {
156             "id": "file_fake123456789",
157             "object": "file",
158             "created": 1537498020,
159             "filename": "path",
160             "links": {
161             "object": "list",
162             "data": [],
163             "has_more": false,
164             "url": "/v1/file_links?file=file_fake123456789"
165             },
166             "purpose": "sigma_scheduled_query",
167             "size": 500,
168             "title": null,
169             "type": "csv",
170             "url": "https://files.stripe.com/v1/files/file_fake123456789/contents"
171             },
172             "livemode": false,
173             "result_available_until": 1603065600,
174             "sql": "SELECT count(*) from charges",
175             "status": "completed",
176             "title": "Count all charges"
177             }
178              
179             =head1 HISTORY
180              
181             =head2 v0.1
182              
183             Initial version
184              
185             =head1 AUTHOR
186              
187             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
188              
189             =head1 SEE ALSO
190              
191             Stripe API documentation:
192              
193             L<https://stripe.com/docs/api/sigma/scheduled_queries>, L<https://stripe.com/docs/sigma/scheduled-queries>
194              
195             =head1 COPYRIGHT & LICENSE
196              
197             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
198              
199             You can use, copy, modify and redistribute this package and associated
200             files under the same terms as Perl itself.
201              
202             =cut