Shopify/URLHandler/Queued.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 62 CC 7 SCAR 21.3
CC
7
Cov
0%
post_url
12.0
put_url
12.0
delete_url
12.0
CRAP 8.4
1 #!/usr/bin/perl
2  
3 use strict;
4 use warnings;
5  
6 # A class designed to wrap the WWW::Shopify object, and basically queue up requests and do all sorts of other meta-level things that the actual API shouldn't handle.
7  
8 use WWW::Shopify;
9  
10 package WWW::Shopify::URLHandler::Queued;
11 use parent 'WWW::Shopify::URLHandler';
12  
13 # If we have a too many calls thing, queue up the request,
14  
15 sub new($$) {
16 my ($package, $db) = @_;
17 return bless{_db => $db}, $package;
18 }
19  
20 sub post_url {
21 my $self = shift;
22 eval {
23 $self->SUPER::post_url(@_);
24 };
25 if ($@) {
26 die $@ unless ($@->code == 503);
27 my $db = $self->{_db};
28 $db->create({created => $currentDate, request_json => $request_json});
29 }
30 }
31  
32 sub put_url {
33 my $self = shift;
34 eval {
35 $self->SUPER::put_url(@_);
36 };
37 if ($@) {
38 die $@ unless ($@->code == 503);
39 my $db = $self->{_db};
40 $db->create({created => $currentDate, request_json => $request_json});
41 }
42 }
43  
44 sub delete_url {
45 my $self = shift;
46 eval {
47 $self->SUPER::delete_url(@_);
48 };
49 if ($@) {
50 die $@ unless ($@->code == 503);
51 my $db = $self->{_db};
52 $db->create({created => $currentDate, request_json => $request_json});
53 }
54 }
55