SFDC/Apex.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 72 CC 5 SCAR 22.8
CC
5
Cov
0%
executeAnonymous
30.0
_extractURL
2.0
compileAndTest
2.0
CRAP 9.8
1 #!/usr/bin/env perl
2 package WWW::SFDC::Apex;
3 # ABSTRACT: Interface to the salesforce.com Apex SOAP Api
4  
5 use 5.12.0;
6 use strict;
7 use warnings;
8  
9 use Log::Log4perl ':easy';
10 use WWW::SFDC::SessionManager;
11 use SOAP::Lite;
12  
13 use Moo;
14 with "MooX::Singleton", "WWW::SFDC::Role::Session";
15  
16 has 'uri',
17 is => 'ro',
18 default=> "http://soap.sforce.com/2006/08/apex";
19  
20 sub _extractURL {
21 return $_[1]->{serverUrl} =~ s{/u/}{/s/}r;
22 }
23  
24  
25  
26 sub compileAndTest {
27 my ($self, @names) = @_;
28  
29 return $self->_call(
30 'compileAndTest',
31 map {\SOAP::Data->name(classes => $_)} @names
32 );
33 }
34  
35  
36 sub compileClasses {
37 my ($self, @names) = @_;
38  
39 return $self->_call(
40 'compileClasses',
41 SOAP::Data->value(map {SOAP::Data->name(scripts => $_)} @names)
42 );
43 }
44  
45  
46 sub compileTriggers {
47 my ($self, @names) = @_;
48  
49 return $self->_call(
50 'compileTriggers',
51 map {\SOAP::Data->name(classes => $_)} @names
52 );
53 }
54  
55  
56 sub executeAnonymous {
57 my ($self, $code, %options) = @_;
58 my ($result, $headers) = $self->_call(
59 'executeAnonymous',
60 SOAP::Data->name(string => $code),
61 $options{debug} ? SOAP::Header->name('DebuggingHeader' => \SOAP::Data->name(
62 debugLevel => 'DEBUGONLY'
63 ))->uri($self->uri) : (),
64 );
65  
66 LOGDIE "ExecuteAnonymous failed to compile: " . $result->{compileProblem}
67 if $result->{compiled} eq "false";
68  
69 LOGDIE "ExecuteAnonymous failed to complete: " . $result->{exceptionMessage}
70 if ($result->{success} eq "false");
71  
72 return $result, (defined $headers ? $headers->{debugLog} : ());
73 }
74  
75  
76 sub runTests {
77 my ($self, @names) = @_;
78  
79 return $self->_call(
80 'runTests',
81 map {\SOAP::Data->name(classes => $_)} @names
82 );
83 }
84  
85  
86 sub wsdlToApex {
87 ...
88 }
89  
90 1;
91  
92 __END__
93  
94 =pod
95  
96 =head1 NAME
97  
98 WWW::SFDC::Apex - Interface to the salesforce.com Apex SOAP Api
99  
100 =head1 VERSION
101  
102 version 0.22
103  
104 =head1 METHODS
105  
106 =head2 compileAndTest
107  
108 =head2 compileClasses
109  
110 =head2 compileTriggers
111  
112 =head2 executeAnonymous
113  
114 =head2 runTests
115  
116 =head2 wsdlToApex
117  
118 Unimplemented
119  
120 =head1 AUTHOR
121  
122 Alexander Brett <alexander.brett@sophos.com>
123  
124 =head1 COPYRIGHT AND LICENSE
125  
126 This software is Copyright (c) 2015 by Sophos Limited.
127  
128 This is free software, licensed under:
129  
130 The MIT (X11) License
131  
132 The full text of the license can be found in the
133 F<LICENSE> file included with this distribution.
134  
135 =cut