SFDC/Constants.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 92.0% 23 / 25 CC 1 SCAR 1.3
CC
1
Cov
94%
_extractURL
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« SFDC/Role/SessionConsumer.pm ↑ Summary
1 package WWW::SFDC::Constants;
2 # ABSTRACT: Data about SFDC Metadata Components.
3  
4 2 ▶use 5.12.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 our $VERSION = '0.36'; # TRIAL VERSION
9  
10 2 ▶use List::Util 'first';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Log::Log4perl ':easy';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 with "WWW::SFDC::Role::SessionConsumer";
15  
16 has '+session',
17 is => 'ro',
18 required => 0;
19  
20 has 'uri',
21 is => 'ro',
22 default => "urn:partner.soap.sforce.com";
23  
24 0 ▶sub _extractURL { return $_[1]->{serverUrl} }
Subroutine _extractURL: not called CC=1 SCAR=6.9
25  
26  
27 has 'TYPES',
28 is => 'ro',
29 lazy => 1,
30 default => sub {
31 my $self = shift;
32 +{
33 map {
34 $_->{directoryName} => $_;
35 } @{$self->session->Metadata->describeMetadata->{metadataObjects}}
36 }
37 };
38  
39 has '_subcomponents',
40 is => 'ro',
41 lazy => 1,
42 default => sub {
43 my $self = shift;
44 [map {
45 exists $_->{childXmlNames}
46 ? ref $_->{childXmlNames} eq 'ARRAY'
47 ? @{$_->{childXmlNames}}
48 : $_->{childXmlNames}
49 : ()
50 } values $self->TYPES];
51 };
52  
53  
54 sub needsMetaFile {
55 my ($self, $type) = @_;
56 return $self->TYPES->{$type} && exists $self->TYPES->{$type}->{metaFile}
57 ? $self->TYPES->{$type}->{metaFile} eq 'true'
58 : LOGDIE "$type is not a recognised type";
59 }
60  
61  
62 sub hasFolders {
63 my ($self, $type) = @_;
64 return $self->TYPES->{$type} && exists $self->TYPES->{$type}->{inFolder}
65 ? $self->TYPES->{$type}->{inFolder} eq 'true'
66 : LOGDIE "$type is not a recognised type";
67 }
68  
69  
70 sub getEnding {
71 my ($self, $type) = @_;
72 LOGDIE "$type is not a recognised type" unless $self->TYPES->{$type};
73 return $self->TYPES->{$type}->{suffix}
74 ? ".".$self->TYPES->{$type}->{suffix}
75 : undef;
76 }
77  
78  
79 sub getDiskName {
80 my ($self, $query) = @_;
81 return first {$self->TYPES->{$_}->{xmlName} eq $query} keys %{$self->TYPES};
82 }
83  
84  
85 sub getName {
86 my ($self, $type) = @_;
87 return $type if grep {/$type/} @{$self->_subcomponents};
88 LOGDIE "$type is not a recognised type" unless $self->TYPES->{$type};
89 return $self->TYPES->{$type}->{xmlName};
90 }
91  
92  
93 sub getSubcomponents {
94 my $self = shift;
95 return @{$self->_subcomponents};
96 }
97  
98 1;
99  
100 __END__
« SFDC/Role/SessionConsumer.pm ↑ Summary