-
Notifications
You must be signed in to change notification settings - Fork 0
/
Apex.pm
87 lines (64 loc) · 1.64 KB
/
Apex.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env perl
package WWW::SFDC::Apex;
use 5.12.0;
use strict;
use warnings;
use Log::Log4perl ':easy';
use WWW::SFDC::SessionManager;
use Moo;
with "MooX::Singleton", "WWW::SFDC::Role::Session";
use SOAP::Lite;
our $VERSION = '0.1';
has 'uri',
is => 'ro',
default=> "http://soap.sforce.com/2006/08/apex";
sub _extractURL {
return $_[1]->{serverUrl} =~ s{/u/}{/s/}r;
}
sub compileAndTest {
my ($self, @names) = @_;
return $self->_call(
'compileAndTest',
map {\SOAP::Data->name(classes => $_)} @names
);
}
sub compileClasses {
my ($self, @names) = @_;
return $self->_call(
'compileClasses',
SOAP::Data->value(map {SOAP::Data->name(scripts => $_)} @names)
);
}
sub compileTriggers {
my ($self, @names) = @_;
return $self->_call(
'compileTriggers',
map {\SOAP::Data->name(classes => $_)} @names
);
}
sub executeAnonymous {
my ($self, $code, %options) = @_;
my ($result, $headers) = $self->_call(
'executeAnonymous',
SOAP::Data->name(string => $code),
$options{debug} ? SOAP::Header->name('DebuggingHeader' => \SOAP::Data->name(
debugLevel => 'DEBUGONLY'
))->uri($self->uri) : (),
);
LOGDIE "ExecuteAnonymous failed to compile: " . $result->{compileProblem}
if $result->{compiled} eq "false";
LOGDIE "ExecuteAnonymous failed to complete: " . $result->{exceptionMessage}
if ($result->{success} eq "false");
return $result, (defined $headers ? $headers->{debugLog} : ());
}
sub runTests {
my ($self, @names) = @_;
return $self->_call(
'runTests',
map {\SOAP::Data->name(classes => $_)} @names
);
}
sub wsdlToApex {
...
}
1;