REST/Shell/GetCommand.pm

filter: Statementstmt 38.2% 13 / 34 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 32.6% 17 / 52 CC 4 SCAR 21.0
CC
4
Cov
32%
run_get
20.0
smry_get
2.0
help_get
2.0
CRAP 8.2
« REST/Shell/Util.pm ↑ Summary REST/Resource.pm »
1 package WWW::GoDaddy::REST::Shell::GetCommand;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Sub::Exporter -setup => {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 exports => [qw(run_get smry_get help_get comp_get)],
8 groups => { default => [qw(run_get smry_get help_get comp_get)] }
9 1 };
10 1 ▶use WWW::GoDaddy::REST::Shell::Util qw(get_resource_by_schema_or_uri);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 0 ▶sub run_get {
Subroutine run_get: not called CC=4 SCAR=30.0
Pod undocumented
13 0 my $self = shift;
14  
15 0 my $usage = "Usage:\n get [schema] [id]\n get /uri/id\n";
16 0 my $resource = eval { return get_resource_by_schema_or_uri( $self, @_ ); };
17 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
18 0 ▶ if ( UNIVERSAL::isa( $@, 'WWW::GoDaddy::REST::Resource' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($@, 'WWW::GoDaddy::REST::Resource')) { } 0 0 0
19 0 $self->page( $@->to_string(1) . "\n" );
20 }
21 else {
22 0 warn($@);
23 0 warn($usage);
24 }
25 0 return 0;
26 }
27  
28 0 eval { $self->page( $resource->to_string(1) . "\n" ); };
29 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
30 0 warn($@);
31 }
32  
33 0 return 1;
34 }
35  
36 0 ▶sub smry_get {
Subroutine smry_get: not called CC=1 SCAR=6.9
Pod undocumented
37 0 return "load a specific resource"
38 }
39  
40 0 ▶sub help_get {
Subroutine help_get: not called CC=1 SCAR=6.9
Pod undocumented
41 return <<HELP
42 Load a specific resource. This can be done either by schema and id, or
43 by specifying a URL path.
44  
45 Usage:
46 get [schema] [id]
47 get [/uri/to/id]
48  
49 Example:
50 get user 1
51 get /user/1
52 get /users?filter=...
53 HELP
54 0 }
55  
56 0 ▶sub comp_get {
Subroutine comp_get: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my $self = shift;
58 0 my $client = $self->client;
59 0 return grep { $client->schema($_)->is_queryable } $self->schema_completion(@_);
60 }
61  
62 1 1;
63  
64 =head1 AUTHOR
65  
66 David Bartle, C<< <davidb@mediatemple.net> >>
67  
68 =head1 COPYRIGHT & LICENSE
69  
70 Copyright (c) 2014 Go Daddy Operating Company, LLC
71  
72 Permission is hereby granted, free of charge, to any person obtaining a
73 copy of this software and associated documentation files (the "Software"),
74 to deal in the Software without restriction, including without limitation
75 the rights to use, copy, modify, merge, publish, distribute, sublicense,
76 and/or sell copies of the Software, and to permit persons to whom the
77 Software is furnished to do so, subject to the following conditions:
78  
79 The above copyright notice and this permission notice shall be included in
80 all copies or substantial portions of the Software.
81  
82 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
83 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
84 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
85 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
86 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
87 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
88 DEALINGS IN THE SOFTWARE.
89  
90 =cut
« REST/Shell/Util.pm ↑ Summary REST/Resource.pm »