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