activeforce 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/Appraisals +0 -4
- data/activeforce.gemspec +1 -1
- data/lib/activeforce/version.rb +1 -1
- data/lib/salesforce/connection.rb +4 -4
- data/test/salesforce/connection/async_test.rb +22 -22
- data/test/salesforce/connection_test.rb +34 -28
- data/test/test_helper.rb +22 -22
- metadata +5 -11
- data/gemfiles/4.2.gemfile +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42a127fc32c1c102c7fa13e47ba09eadf1239bd2575fb3d4f36817c579616324
|
4
|
+
data.tar.gz: d8394329d3921819560b455f50ccaf462abb8fbf5c2f7a2029a69fb14d6cb73d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcf5b76b42e6cd1c0f1b2e84a9e3402c4d33fb48ac70ca6922f55ea557b6aaefa9d951cb8db576092a495748f3e4a5d82d40b6c8999155d71b258176549bd245
|
7
|
+
data.tar.gz: fe93d1752de40d32df45cf65fc54d118d8f2b7bdb5e2205414935d58ef84e1be667d37878abd92a25da883ed2dabe428e4862e50dca696bcb1af8e563fb8b6c4
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/activeforce.gemspec
CHANGED
@@ -25,6 +25,6 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency(%q<rails>, [">= 4.2", "< 6.1"])
|
26
26
|
s.add_dependency(%q<savon>, ["~> 2.11"])
|
27
27
|
s.add_dependency(%q<blockenspiel>, [">= 0"])
|
28
|
-
s.add_dependency(%q<rest-client>, ["
|
28
|
+
s.add_dependency(%q<rest-client>, ["~> 2.0"])
|
29
29
|
end
|
30
30
|
|
data/lib/activeforce/version.rb
CHANGED
@@ -11,13 +11,13 @@ module Salesforce
|
|
11
11
|
include HttpMethods
|
12
12
|
include Conversion
|
13
13
|
include Async
|
14
|
-
|
14
|
+
|
15
15
|
def self.as_logged_in_user(&block)
|
16
|
-
count = 0
|
16
|
+
count = 0
|
17
17
|
begin
|
18
18
|
Salesforce::Authentication.session_id
|
19
19
|
block.call
|
20
|
-
rescue RestClient::
|
20
|
+
rescue RestClient::Unauthorized, Savon::SOAPFault => e
|
21
21
|
if count < 1 && (e.message.downcase.include?("unauthorized") || e.message.downcase.include?("invalid_login"))
|
22
22
|
count += 1
|
23
23
|
Salesforce::Config.on_login_failure
|
@@ -27,7 +27,7 @@ module Salesforce
|
|
27
27
|
raise e
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -13,14 +13,14 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
|
|
13
13
|
rescue => e
|
14
14
|
raise e
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def test_async_post__json
|
18
18
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
19
19
|
http_body = stub(:body => { :result => 'foo' }.to_json)
|
20
20
|
RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
|
21
21
|
assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :json))
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def test_async_post__404_error_json
|
25
25
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
26
26
|
error = RestClient::BadRequest.new
|
@@ -34,13 +34,13 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
|
|
34
34
|
assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def test_async_post__404_error_xml
|
39
39
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
40
40
|
error = RestClient::BadRequest.new
|
41
41
|
error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
|
42
42
|
RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
|
43
|
-
|
43
|
+
|
44
44
|
begin
|
45
45
|
Salesforce.connection.async_post('path', :body, :format => :xml)
|
46
46
|
assert false, "Shouldn't have gotten here"
|
@@ -49,7 +49,7 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
|
|
49
49
|
assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def test_async_post__400_error_json
|
54
54
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
55
55
|
error = RestClient::ResourceNotFound.new
|
@@ -63,13 +63,13 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
|
|
63
63
|
assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
def test_async_post__400_error_xml
|
68
68
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
69
69
|
error = RestClient::ResourceNotFound.new
|
70
70
|
error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
|
71
71
|
RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
|
72
|
-
|
72
|
+
|
73
73
|
begin
|
74
74
|
Salesforce.connection.async_post('path', :body, :format => :xml)
|
75
75
|
assert false, "Shouldn't have gotten here"
|
@@ -78,27 +78,27 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
|
|
78
78
|
assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
|
79
79
|
end
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
def test_async_post__xml
|
83
83
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
84
84
|
http_body = stub(:body => { :result => 'foo' }.to_xml)
|
85
85
|
RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
|
86
86
|
assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :xml))
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
def test_async_get__json
|
90
90
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
91
91
|
http_body = stub(:body => { :result => 'foo' }.to_json)
|
92
92
|
RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
|
93
93
|
assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :json))
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
def test_async_get__error_json
|
97
97
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
98
98
|
error = RestClient::BadRequest.new
|
99
99
|
error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
|
100
100
|
RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
|
101
|
-
|
101
|
+
|
102
102
|
begin
|
103
103
|
Salesforce.connection.async_get('path', :format => :json)
|
104
104
|
assert false, "Shouldn't have gotten here"
|
@@ -107,13 +107,13 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
|
|
107
107
|
assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
|
108
108
|
end
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
def test_async_get__error_xml
|
112
112
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
113
113
|
error = RestClient::BadRequest.new
|
114
114
|
error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
|
115
115
|
RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
|
116
|
-
|
116
|
+
|
117
117
|
begin
|
118
118
|
Salesforce.connection.async_get('path', :format => :xml)
|
119
119
|
assert false, "Shouldn't have gotten here"
|
@@ -122,22 +122,22 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
|
|
122
122
|
assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
|
123
123
|
end
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
def test_async_get__xml
|
127
127
|
Salesforce::Authentication.stubs(:session_id).returns('session_id')
|
128
128
|
http_body = stub(:body => { :result => 'foo' }.to_xml)
|
129
129
|
RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
|
130
130
|
assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :xml))
|
131
131
|
end
|
132
|
-
|
132
|
+
|
133
133
|
def test_async_api_url
|
134
134
|
assert_equal 'https://awesome-2000.something.salesforce.com/services/async/22.0/path', Salesforce.connection.async_api_url('path')
|
135
135
|
end
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
143
|
end
|
@@ -5,20 +5,20 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
|
|
5
5
|
Salesforce.connection.expects(:get).with("query.json?q=SELECT+Id+FROM+Account", :format => :json).returns({ "records" => [{ :record => 1, "attributes" => 'foo'}], "done" => true, "totalSize" => 1999})
|
6
6
|
assert_equal [{ :record => 1 }], Salesforce.connection.soql("SELECT Id FROM Account")
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def test_query__more_than_2000_records
|
10
|
-
Salesforce.connection.expects(:get).with("query.json?q=SELECT+Id+FROM+Account", :format => :json).returns({
|
10
|
+
Salesforce.connection.expects(:get).with("query.json?q=SELECT+Id+FROM+Account", :format => :json).returns({
|
11
11
|
"records" => [ { :record => 1, "attributes" => "foo" } ], "done" => false, "totalSize" => 4999, "nextRecordsUrl" =>"/services/data/v22.0/query/01g8000000L9FSmAAN-2000"})
|
12
|
-
|
13
|
-
Salesforce.connection.expects(:get).with("/services/data/v22.0/query/01g8000000L9FSmAAN-2000.json", :format => :json).returns({
|
12
|
+
|
13
|
+
Salesforce.connection.expects(:get).with("/services/data/v22.0/query/01g8000000L9FSmAAN-2000.json", :format => :json).returns({
|
14
14
|
"records" => [ { :record => 2, "attributes" => "foo" } ], "done" => false, "totalSize" => 4999, "nextRecordsUrl" =>"/services/data/v22.0/query/01g8000000L9FSmAAN-4000"})
|
15
15
|
|
16
|
-
Salesforce.connection.expects(:get).with("/services/data/v22.0/query/01g8000000L9FSmAAN-4000.json", :format => :json).returns({
|
16
|
+
Salesforce.connection.expects(:get).with("/services/data/v22.0/query/01g8000000L9FSmAAN-4000.json", :format => :json).returns({
|
17
17
|
"records" => [ { :record => 3, "attributes" => "foo" } ], "done" => true, "totalSize" => 4999})
|
18
|
-
|
18
|
+
|
19
19
|
assert_equal [{ :record => 1}, { :record => 2}, { :record => 3}], Salesforce.connection.soql("SELECT Id FROM Account")
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def test_as_logged_in_user__login_succeeded__calls_block
|
23
23
|
Salesforce::Authentication.expects(:session_id)
|
24
24
|
results = Salesforce.connection.as_logged_in_user do
|
@@ -26,12 +26,12 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
|
|
26
26
|
end
|
27
27
|
assert_equal :results, results
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def test_as_logged_in_user__logged_out__recovers
|
31
31
|
flag = nil
|
32
32
|
Salesforce::Authentication.expects(:session_id).twice
|
33
33
|
Salesforce::Authentication.expects(:logout)
|
34
|
-
error = RestClient::
|
34
|
+
error = RestClient::Unauthorized.new
|
35
35
|
results = Salesforce.connection.as_logged_in_user do
|
36
36
|
unless flag
|
37
37
|
flag = true
|
@@ -41,32 +41,32 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
|
|
41
41
|
end
|
42
42
|
assert_equal :results, results
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def test_as_logged_in_user__authorization_failure
|
46
46
|
flag = nil
|
47
47
|
Salesforce::Authentication.expects(:session_id).times(2)
|
48
48
|
Salesforce::Authentication.expects(:logout)
|
49
|
-
error = RestClient::
|
50
|
-
assert_raises RestClient::
|
49
|
+
error = RestClient::Unauthorized.new
|
50
|
+
assert_raises RestClient::Unauthorized do
|
51
51
|
Salesforce.connection.as_logged_in_user do
|
52
52
|
raise error
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
def test_as_logged_in_user__invalid_username_password__recovers
|
58
58
|
on_login_failure_called = false
|
59
59
|
|
60
|
-
Salesforce.configure do
|
60
|
+
Salesforce.configure do
|
61
61
|
on_login_failure { on_login_failure_called = true }
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
xml = <<-XML
|
65
65
|
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault xmlns:fns="http://fault.api.zuora.com/"><faultcode>sf:INVALID_LOGIN</faultcode><faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring><detail><fns:LoginFault><fns:FaultCode>INVALID_LOGIN</fns:FaultCode><fns:FaultMessage>Invalid username, password, security token; or user locked out.</fns:FaultMessage></fns:LoginFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
|
66
66
|
XML
|
67
67
|
|
68
68
|
error = Savon::SOAPFault.new(stub(:body => xml), Nori.new, xml)
|
69
|
-
|
69
|
+
|
70
70
|
flag = nil
|
71
71
|
Salesforce::Authentication.expects(:session_id).twice
|
72
72
|
Salesforce::Authentication.expects(:logout)
|
@@ -77,28 +77,28 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
|
|
77
77
|
end
|
78
78
|
:results
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
assert_equal :results, results
|
82
82
|
assert on_login_failure_called, "Salesforce::Config.on_login_failure was not called upon login failure"
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
def test_as_logged_in_user__invalid_username_password__doesnt_recover
|
86
86
|
on_login_failure_called = 0
|
87
87
|
|
88
|
-
Salesforce.configure do
|
88
|
+
Salesforce.configure do
|
89
89
|
on_login_failure { on_login_failure_called += 1 }
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
xml = <<-XML
|
93
93
|
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault xmlns:fns="http://fault.api.zuora.com/"><faultcode>sf:INVALID_LOGIN</faultcode><faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring><detail><fns:LoginFault><fns:FaultCode>INVALID_LOGIN</fns:FaultCode><fns:FaultMessage>Invalid username, password, security token; or user locked out.</fns:FaultMessage></fns:LoginFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
|
94
94
|
XML
|
95
95
|
|
96
96
|
error = Savon::SOAPFault.new(stub(:body => xml), Nori.new, xml)
|
97
|
-
|
97
|
+
|
98
98
|
flag = nil
|
99
99
|
Salesforce::Authentication.expects(:session_id).twice
|
100
100
|
Salesforce::Authentication.expects(:logout)
|
101
|
-
|
101
|
+
|
102
102
|
assert_raises Savon::SOAPFault do
|
103
103
|
Salesforce.connection.as_logged_in_user do
|
104
104
|
raise error
|
@@ -107,14 +107,14 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
|
|
107
107
|
|
108
108
|
assert_equal 1, on_login_failure_called, "Salesforce::Config.on_login_failure was not called upon login failure"
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
def test_as_logged_in_user__invalid_username_password__recovers__no_on_login_failure_hook
|
112
112
|
xml = <<-XML
|
113
113
|
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault xmlns:fns="http://fault.api.zuora.com/"><faultcode>sf:INVALID_LOGIN</faultcode><faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring><detail><fns:LoginFault><fns:FaultCode>INVALID_LOGIN</fns:FaultCode><fns:FaultMessage>Invalid username, password, security token; or user locked out.</fns:FaultMessage></fns:LoginFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
|
114
114
|
XML
|
115
115
|
|
116
116
|
error = Savon::SOAPFault.new(stub(:body => xml), Nori.new, xml)
|
117
|
-
|
117
|
+
|
118
118
|
flag = nil
|
119
119
|
Salesforce::Authentication.expects(:session_id).twice
|
120
120
|
Salesforce::Authentication.expects(:logout)
|
@@ -125,15 +125,15 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
|
|
125
125
|
end
|
126
126
|
:results
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
assert_equal :results, results
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
def test_as_logged_in_user__other_failure
|
133
133
|
Salesforce::Authentication.stubs(:session_id)
|
134
134
|
Salesforce::Authentication.stubs(:logout)
|
135
135
|
|
136
|
-
expects(:my_method).twice.raises(RestClient::
|
136
|
+
expects(:my_method).twice.raises(RestClient::Unauthorized.new).then.raises(StandardError.new("some other error"))
|
137
137
|
|
138
138
|
assert_raises StandardError do
|
139
139
|
Salesforce.connection.as_logged_in_user do
|
@@ -141,8 +141,14 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
def test_convert
|
146
146
|
assert_equal "str", Salesforce.connection.convert("str", {})
|
147
147
|
end
|
148
|
+
|
149
|
+
private
|
150
|
+
|
151
|
+
def my_method
|
152
|
+
# Defined so it can be stubbed in a test
|
153
|
+
end
|
148
154
|
end
|
data/test/test_helper.rb
CHANGED
@@ -15,14 +15,14 @@ require 'activeforce'
|
|
15
15
|
Dir.glob(File.expand_path('../../app/models/salesforce/**.rb', __FILE__)).each { |file| require(file) }
|
16
16
|
|
17
17
|
require 'mocha/setup'
|
18
|
-
|
18
|
+
Mocha::Configuration.prevent(:stubbing_non_existent_method)
|
19
19
|
|
20
20
|
Time.zone = 'America/Los_Angeles'
|
21
21
|
|
22
22
|
class ActiveSupport::TestCase
|
23
23
|
setup :clean_configuration
|
24
24
|
setup :stub_soap
|
25
|
-
|
25
|
+
|
26
26
|
class ::Salesforce::BulkTable < Salesforce::Base
|
27
27
|
self.custom_object = true
|
28
28
|
end
|
@@ -30,50 +30,50 @@ class ActiveSupport::TestCase
|
|
30
30
|
def clean_configuration
|
31
31
|
Salesforce::Config.instance_variable_set(:@instance, nil)
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def stub_soap
|
35
|
-
|
35
|
+
Mocha::Configuration.allow(:stubbing_non_existent_method) do
|
36
|
+
Savon::Client.any_instance.stubs(:request)
|
37
|
+
end
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
def clear_columns_for_bulk_table
|
39
41
|
Salesforce::BulkTable.cached_columns = nil
|
40
42
|
end
|
41
|
-
|
43
|
+
|
42
44
|
def clear_columns_for_account
|
43
45
|
Salesforce::Account.cached_columns = nil
|
44
46
|
end
|
45
|
-
|
47
|
+
|
46
48
|
def setup_columns_for_bulk_table
|
47
49
|
clear_columns_for_bulk_table
|
48
|
-
columns_hash = [
|
49
|
-
{ "name" => "Id", "type" => "id", "createable" => false, "updateable" => false},
|
50
|
-
{ "name" => "Account__c", "type" => "reference", "createable" => true, "updateable" => false, "custom" => true },
|
50
|
+
columns_hash = [
|
51
|
+
{ "name" => "Id", "type" => "id", "createable" => false, "updateable" => false},
|
52
|
+
{ "name" => "Account__c", "type" => "reference", "createable" => true, "updateable" => false, "custom" => true },
|
51
53
|
{ "name" => "Car__c", "type" => "reference", "createable" => false, "updateable" => true, "custom" => true},
|
52
54
|
{ "name" => "Name__c", "type" => "string", "createable" => true, "updateable" => true, "custom" => true},
|
53
|
-
{ "name" => "dob__c", "type" => "date", "createable" => true, "updateable" => true, "custom" => true}
|
55
|
+
{ "name" => "dob__c", "type" => "date", "createable" => true, "updateable" => true, "custom" => true}
|
54
56
|
]
|
55
|
-
|
57
|
+
|
56
58
|
Salesforce.connection.stubs(:fields).with("BulkTable__c").returns(columns_hash).twice
|
57
59
|
columns = Salesforce::Columns.new("BulkTable__c")
|
58
60
|
assert_equal columns, Salesforce::BulkTable.columns
|
59
61
|
end
|
60
|
-
|
62
|
+
|
61
63
|
def setup_columns_for_account
|
62
64
|
clear_columns_for_account
|
63
|
-
columns_hash = [
|
64
|
-
{ "name" => "Id", "type" => "id", "createable" => false, "updateable" => false},
|
65
|
-
{ "name" => "Name", "type" => "string", "createable" => true, "updateable" => true},
|
66
|
-
{ "name" => "Type", "type" => "string", "createable" => true, "updateable" => true},
|
67
|
-
{ "name" => "Address", "type" => "string", "createable" => true, "updateable" => true},
|
68
|
-
{ "name" => "City", "type" => "string", "createable" => true, "updateable" => true},
|
65
|
+
columns_hash = [
|
66
|
+
{ "name" => "Id", "type" => "id", "createable" => false, "updateable" => false},
|
67
|
+
{ "name" => "Name", "type" => "string", "createable" => true, "updateable" => true},
|
68
|
+
{ "name" => "Type", "type" => "string", "createable" => true, "updateable" => true},
|
69
|
+
{ "name" => "Address", "type" => "string", "createable" => true, "updateable" => true},
|
70
|
+
{ "name" => "City", "type" => "string", "createable" => true, "updateable" => true},
|
69
71
|
{ "name" => "State", "type" => "string", "createable" => true, "updateable" => true},
|
70
72
|
{ "name" => "Number", "type" => "string", "createable" => true, "updateable" => false}
|
71
73
|
]
|
72
|
-
|
74
|
+
|
73
75
|
Salesforce.connection.stubs(:fields).with("Account").returns(columns_hash).twice
|
74
76
|
columns = Salesforce::Columns.new("Account")
|
75
77
|
assert_equal columns, Salesforce::Account.columns
|
76
78
|
end
|
77
|
-
|
78
|
-
|
79
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tushar Ranka
|
@@ -63,20 +63,14 @@ dependencies:
|
|
63
63
|
name: rest-client
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- - "<"
|
66
|
+
- - "~>"
|
70
67
|
- !ruby/object:Gem::Version
|
71
68
|
version: '2.0'
|
72
69
|
type: :runtime
|
73
70
|
prerelease: false
|
74
71
|
version_requirements: !ruby/object:Gem::Requirement
|
75
72
|
requirements:
|
76
|
-
- - "
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '0'
|
79
|
-
- - "<"
|
73
|
+
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
75
|
version: '2.0'
|
82
76
|
description: " Activeforce provides a simple to use and extend interface to Salesforce
|
@@ -144,7 +138,6 @@ files:
|
|
144
138
|
- app/models/salesforce/user.rb
|
145
139
|
- app/models/salesforce/user_role.rb
|
146
140
|
- app/models/salesforce/vote.rb
|
147
|
-
- gemfiles/4.2.gemfile
|
148
141
|
- gemfiles/5.0.gemfile
|
149
142
|
- gemfiles/5.2.gemfile
|
150
143
|
- gemfiles/6.0.gemfile
|
@@ -202,7 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
195
|
- !ruby/object:Gem::Version
|
203
196
|
version: '0'
|
204
197
|
requirements: []
|
205
|
-
|
198
|
+
rubyforge_project:
|
199
|
+
rubygems_version: 2.7.9
|
206
200
|
signing_key:
|
207
201
|
specification_version: 4
|
208
202
|
summary: A Simple gem to interact with the Salesforce REST API
|