File Coverage

blib/lib/Net/API/Stripe/Sigma/ScheduledQueryRun.pm
Criterion Covered Total %
statement 7 18 38.8
branch n/a
condition n/a
subroutine 3 14 21.4
pod 11 11 100.0
total 21 43 48.8


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