activeforce 2.0.1 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bc597a70c5ed788aef99e8f9317afd465891a82
4
- data.tar.gz: a29b851cfbedc98eafe791e93e4909e9731d781c
3
+ metadata.gz: 40cd43287bcdfaaef4fa50df102138f130a89e67
4
+ data.tar.gz: 594cfa254c3de46a59d6147f54766fb2f15c545a
5
5
  SHA512:
6
- metadata.gz: 5a974a0e22b563b1af37aa83c1bf9eeecba8ec907d99a626947518babf1f193771932478853cca7ac30a64cdb26249fe9da0c5272376b1256fad1e6240a9ef57
7
- data.tar.gz: ff079ccba6b08cb28b0ca0ed17bd793f6236b54972f1064dfa7a53107976d4545754898c13d13345ee567136ac4f686712d189208451ef29a93765be9b87ed06
6
+ metadata.gz: '0746368d8c596ab1bcb2d8027eb34397f056ff9561fe2cc53122eb5e0157a8e0f0b1fdeb75783979559fd4ade832eb3046f03278a6149a223b63424071b524b3'
7
+ data.tar.gz: be7fb8570ce67de4c0ef4a47e62b490ab91b3aa97d3ed9aaa2c98b08e4f35b0b4d5883ce09fc00d89df129e45d35c10fc2f2bc1aab115404827a7250dd319944
@@ -1,3 +1,3 @@
1
1
  module Activeforce
2
- VERSION = '2.0.1'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
@@ -12,7 +12,12 @@ module Salesforce
12
12
  result = Connection.login
13
13
  Config.instance.soap_endpoint_url result[:server_url]
14
14
  Config.instance.session_id result[:session_id]
15
- Config.instance.server_instance URI.parse(result[:server_url]).host[/(na|cs)\d+/]
15
+
16
+ host = URI.parse(result[:server_url]).host
17
+ host_match = host.match(/(?<instance>[a-z0-9\-]+)\.(?<domain>(?:my\.)?salesforce\.com)/)
18
+
19
+ Config.instance.server_instance host_match[:instance]
20
+ Config.instance.server_domain host_match[:domain]
16
21
  Config.instance.user_id result[:user_id]
17
22
  Config.session_id
18
23
  end
@@ -6,11 +6,11 @@ module Salesforce
6
6
  include Blockenspiel::DSL
7
7
  include Blockenspiel::DSLSetupMethods
8
8
 
9
- dsl_attr_accessor :session_id, :server_instance, :user_id, :soap_endpoint_url
9
+ dsl_attr_accessor :session_id, :server_instance, :server_domain, :user_id, :soap_endpoint_url
10
10
 
11
11
  [
12
12
  :username, :password, :api_version, :use_sandbox?, :use_full_length_ids?,
13
- :login_url, :session_id, :server_instance, :soap_endpoint_url, :soap_enterprise_namespace,
13
+ :login_url, :session_id, :server_instance, :server_domain, :soap_endpoint_url, :soap_enterprise_namespace,
14
14
  :user_id, :server_url, :server_host, :async_url, :configured?, :on_login_failure ].each do |method_name|
15
15
  eval <<-RUBY
16
16
  def self.#{method_name}
@@ -88,15 +88,15 @@ module Salesforce
88
88
  end
89
89
 
90
90
  def server_url
91
- "https://#{server_instance}.salesforce.com/services/data/v#{api_version}"
91
+ "https://#{server_instance}.#{server_domain}/services/data/v#{api_version}"
92
92
  end
93
93
 
94
94
  def server_host
95
- "https://#{server_instance}.salesforce.com"
95
+ "https://#{server_instance}.#{server_domain}"
96
96
  end
97
97
 
98
98
  def async_url
99
- "https://#{server_instance}.salesforce.com/services/async/#{api_version}"
99
+ "https://#{server_instance}.#{server_domain}/services/async/#{api_version}"
100
100
  end
101
101
 
102
102
  def login_url
@@ -46,7 +46,25 @@ class Salesforce::AuthenticationTest < ActiveSupport::TestCase
46
46
  assert_equal "https://cs99.salesforce.com/services/Soap/c/22.0/00DQ00000001LRX", Salesforce::Config.soap_endpoint_url
47
47
  assert_equal "session_id", Salesforce::Config.session_id
48
48
  assert_equal "cs99", Salesforce::Config.server_instance
49
+ assert_equal "salesforce.com", Salesforce::Config.server_domain
50
+ assert_equal "user_id", Salesforce::Config.user_id
51
+ end
52
+
53
+ def test_generate_new_session_id__calls_connection_login__my_domain
54
+ result = {
55
+ :session_id => "session_id",
56
+ :server_url => "https://awesome-2000.my.salesforce.com/services/Soap/c/22.0/00DQ00000001LRX",
57
+ :user_id => "user_id"
58
+ }
59
+
60
+ Salesforce.connection.expects(:login).returns(result)
61
+
62
+ assert_equal "session_id", Salesforce::Authentication.generate_new_session_id
63
+ assert_equal "https://awesome-2000.my.salesforce.com/services/Soap/c/22.0/00DQ00000001LRX", Salesforce::Config.soap_endpoint_url
64
+ assert_equal "session_id", Salesforce::Config.session_id
65
+ assert_equal "awesome-2000", Salesforce::Config.server_instance
66
+ assert_equal "my.salesforce.com", Salesforce::Config.server_domain
49
67
  assert_equal "user_id", Salesforce::Config.user_id
50
68
  end
51
69
 
52
- end
70
+ end
@@ -112,6 +112,9 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
112
112
 
113
113
  config.server_instance "na99"
114
114
  assert_equal "na99", Salesforce::Config.server_instance
115
+
116
+ config.server_domain "something.salesforce.com"
117
+ assert_equal "something.salesforce.com", Salesforce::Config.server_domain
115
118
 
116
119
  config.user_id "user_id"
117
120
  assert_equal "user_id", Salesforce::Config.user_id
@@ -121,9 +124,10 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
121
124
  def test_server_url__and_server_host
122
125
  config = Salesforce::Config.instance
123
126
  config.server_instance "sa2"
127
+ config.server_domain "something.salesforce.com"
124
128
  config.api_version 99
125
- assert_equal "https://sa2.salesforce.com/services/data/v99.0", Salesforce::Config.server_url
126
- assert_equal "https://sa2.salesforce.com", Salesforce::Config.server_host
129
+ assert_equal "https://sa2.something.salesforce.com/services/data/v99.0", Salesforce::Config.server_url
130
+ assert_equal "https://sa2.something.salesforce.com", Salesforce::Config.server_host
127
131
  end
128
132
 
129
133
  def test_configured
@@ -1,6 +1,11 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
4
+ setup do
5
+ Salesforce::Config.instance.server_instance 'awesome-2000'
6
+ Salesforce::Config.instance.server_domain 'something.salesforce.com'
7
+ end
8
+
4
9
  def async_post(path, body, options = {})
5
10
  as_logged_in_user do
6
11
  convert_body RestClient.post(async_api_url(path), body, async_headers(options)), options
@@ -12,7 +17,7 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
12
17
  def test_async_post__json
13
18
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
14
19
  http_body = stub(:body => { :result => 'foo' }.to_json)
15
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
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)
16
21
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :json))
17
22
  end
18
23
 
@@ -26,7 +31,7 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
26
31
  assert false, "Shouldn't have gotten here"
27
32
  rescue => e
28
33
  assert_equal "Salesforce::InvalidRequest", e.class.name
29
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
34
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
30
35
  end
31
36
  end
32
37
 
@@ -34,14 +39,14 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
34
39
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
35
40
  error = RestClient::BadRequest.new
36
41
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
37
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
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)
38
43
 
39
44
  begin
40
45
  Salesforce.connection.async_post('path', :body, :format => :xml)
41
46
  assert false, "Shouldn't have gotten here"
42
47
  rescue => e
43
48
  assert_equal "Salesforce::InvalidRequest", e.class.name
44
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
49
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
45
50
  end
46
51
  end
47
52
 
@@ -49,13 +54,13 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
49
54
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
50
55
  error = RestClient::ResourceNotFound.new
51
56
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
52
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
57
+ 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'}).raises(error)
53
58
  begin
54
59
  Salesforce.connection.async_post('path', :body, :format => :json)
55
60
  assert false, "Shouldn't have gotten here"
56
61
  rescue => e
57
62
  assert_equal "Salesforce::InvalidRequest", e.class.name
58
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
63
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
59
64
  end
60
65
  end
61
66
 
@@ -63,28 +68,28 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
63
68
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
64
69
  error = RestClient::ResourceNotFound.new
65
70
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
66
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
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)
67
72
 
68
73
  begin
69
74
  Salesforce.connection.async_post('path', :body, :format => :xml)
70
75
  assert false, "Shouldn't have gotten here"
71
76
  rescue => e
72
77
  assert_equal "Salesforce::InvalidRequest", e.class.name
73
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
78
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
74
79
  end
75
80
  end
76
81
 
77
82
  def test_async_post__xml
78
83
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
79
84
  http_body = stub(:body => { :result => 'foo' }.to_xml)
80
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
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)
81
86
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :xml))
82
87
  end
83
88
 
84
89
  def test_async_get__json
85
90
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
86
91
  http_body = stub(:body => { :result => 'foo' }.to_json)
87
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
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)
88
93
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :json))
89
94
  end
90
95
 
@@ -92,14 +97,14 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
92
97
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
93
98
  error = RestClient::BadRequest.new
94
99
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
95
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
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)
96
101
 
97
102
  begin
98
103
  Salesforce.connection.async_get('path', :format => :json)
99
104
  assert false, "Shouldn't have gotten here"
100
105
  rescue => e
101
106
  assert_equal "Salesforce::InvalidRequest", e.class.name
102
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
107
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
103
108
  end
104
109
  end
105
110
 
@@ -107,26 +112,26 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
107
112
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
108
113
  error = RestClient::BadRequest.new
109
114
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
110
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
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)
111
116
 
112
117
  begin
113
118
  Salesforce.connection.async_get('path', :format => :xml)
114
119
  assert false, "Shouldn't have gotten here"
115
120
  rescue => e
116
121
  assert_equal "Salesforce::InvalidRequest", e.class.name
117
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
122
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
118
123
  end
119
124
  end
120
125
 
121
126
  def test_async_get__xml
122
127
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
123
128
  http_body = stub(:body => { :result => 'foo' }.to_xml)
124
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
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)
125
130
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :xml))
126
131
  end
127
132
 
128
133
  def test_async_api_url
129
- assert_equal 'https://.salesforce.com/services/async/22.0/path', Salesforce.connection.async_api_url('path')
134
+ assert_equal 'https://awesome-2000.something.salesforce.com/services/async/22.0/path', Salesforce.connection.async_api_url('path')
130
135
  end
131
136
 
132
137
 
@@ -1,6 +1,11 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
4
+ setup do
5
+ Salesforce::Config.instance.server_instance 'awesome-2000'
6
+ Salesforce::Config.instance.server_domain 'something.salesforce.com'
7
+ end
8
+
4
9
  def test_content_type_headers
5
10
  assert_equal({ :content_type => 'application/json'}, Salesforce.connection.content_type_headers(:format => :json))
6
11
  assert_equal({ :content_type => 'application/json'}, Salesforce.connection.content_type_headers(:format => "json"))
@@ -13,7 +18,7 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
13
18
  def test_get__json
14
19
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
15
20
  http_body = stub(:body => { :result => 'foo' }.to_json)
16
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
21
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
17
22
  assert_equal({'result' => 'foo'}, Salesforce.connection.get('path', :format => :json))
18
23
  end
19
24
 
@@ -21,14 +26,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
21
26
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
22
27
  error = RestClient::BadRequest.new
23
28
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
24
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
29
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
25
30
 
26
31
  begin
27
32
  Salesforce.connection.get('path', :format => :json)
28
33
  assert false, "Shouldn't have gotten here"
29
34
  rescue => e
30
35
  assert_equal "Salesforce::InvalidRequest", e.class.name
31
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
36
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
32
37
  end
33
38
  end
34
39
 
@@ -36,28 +41,28 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
36
41
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
37
42
  error = RestClient::BadRequest.new
38
43
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
39
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
44
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
40
45
 
41
46
  begin
42
47
  Salesforce.connection.get('path', :format => :xml)
43
48
  assert false, "Shouldn't have gotten here"
44
49
  rescue => e
45
50
  assert_equal "Salesforce::InvalidRequest", e.class.name
46
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
51
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
47
52
  end
48
53
  end
49
54
 
50
55
  def test_get__xml
51
56
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
52
57
  http_body = stub(:body => { :result => 'foo' }.to_xml)
53
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
58
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
54
59
  assert_equal({'result' => 'foo'}, Salesforce.connection.get('path', :format => :xml))
55
60
  end
56
61
 
57
62
  def test_patch__json
58
63
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
59
64
  http_body = stub(:code => 204, :body => '')
60
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
65
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
61
66
  assert Salesforce.connection.patch('path', :body, :format => :json)
62
67
  end
63
68
 
@@ -65,13 +70,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
65
70
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
66
71
  error = RestClient::BadRequest.new
67
72
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
68
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
73
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
69
74
  begin
70
75
  Salesforce.connection.patch('path', :body, :format => :json)
71
76
  assert false, "Shouldn't have gotten here"
72
77
  rescue => e
73
78
  assert_equal "Salesforce::InvalidRequest", e.class.name
74
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
79
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
75
80
  end
76
81
  end
77
82
 
@@ -79,14 +84,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
79
84
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
80
85
  error = RestClient::BadRequest.new
81
86
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
82
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
87
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
83
88
 
84
89
  begin
85
90
  Salesforce.connection.patch('path', :body, :format => :xml)
86
91
  assert false, "Shouldn't have gotten here"
87
92
  rescue => e
88
93
  assert_equal "Salesforce::InvalidRequest", e.class.name
89
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
94
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
90
95
  end
91
96
  end
92
97
 
@@ -94,13 +99,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
94
99
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
95
100
  error = RestClient::ResourceNotFound.new
96
101
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
97
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
102
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
98
103
  begin
99
104
  Salesforce.connection.patch('path', :body, :format => :json)
100
105
  assert false, "Shouldn't have gotten here"
101
106
  rescue => e
102
107
  assert_equal "Salesforce::InvalidRequest", e.class.name
103
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
108
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
104
109
  end
105
110
  end
106
111
 
@@ -108,21 +113,21 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
108
113
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
109
114
  error = RestClient::ResourceNotFound.new
110
115
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
111
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
116
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
112
117
 
113
118
  begin
114
119
  Salesforce.connection.patch('path', :body, :format => :xml)
115
120
  assert false, "Shouldn't have gotten here"
116
121
  rescue => e
117
122
  assert_equal "Salesforce::InvalidRequest", e.class.name
118
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
123
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
119
124
  end
120
125
  end
121
126
 
122
127
  def test_patch__xml
123
128
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
124
129
  http_body = stub(:code => 204, :body => '')
125
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
130
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
126
131
  assert Salesforce.connection.patch('path', :body, :format => :xml)
127
132
  end
128
133
 
@@ -130,7 +135,7 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
130
135
  def test_post__json
131
136
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
132
137
  http_body = stub(:body => { :result => 'foo' }.to_json)
133
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
138
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
134
139
  assert_equal({'result' => 'foo'}, Salesforce.connection.post('path', :body, :format => :json))
135
140
  end
136
141
 
@@ -138,13 +143,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
138
143
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
139
144
  error = RestClient::BadRequest.new
140
145
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
141
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
146
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
142
147
  begin
143
148
  Salesforce.connection.post('path', :body, :format => :json)
144
149
  assert false, "Shouldn't have gotten here"
145
150
  rescue => e
146
151
  assert_equal "Salesforce::InvalidRequest", e.class.name
147
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
152
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
148
153
  end
149
154
  end
150
155
 
@@ -152,14 +157,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
152
157
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
153
158
  error = RestClient::BadRequest.new
154
159
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
155
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
160
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
156
161
 
157
162
  begin
158
163
  Salesforce.connection.post('path', :body, :format => :xml)
159
164
  assert false, "Shouldn't have gotten here"
160
165
  rescue => e
161
166
  assert_equal "Salesforce::InvalidRequest", e.class.name
162
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
167
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
163
168
  end
164
169
  end
165
170
 
@@ -167,13 +172,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
167
172
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
168
173
  error = RestClient::ResourceNotFound.new
169
174
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
170
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
175
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
171
176
  begin
172
177
  Salesforce.connection.post('path', :body, :format => :json)
173
178
  assert false, "Shouldn't have gotten here"
174
179
  rescue => e
175
180
  assert_equal "Salesforce::InvalidRequest", e.class.name
176
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
181
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
177
182
  end
178
183
  end
179
184
 
@@ -181,21 +186,21 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
181
186
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
182
187
  error = RestClient::ResourceNotFound.new
183
188
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
184
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
189
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
185
190
 
186
191
  begin
187
192
  Salesforce.connection.post('path', :body, :format => :xml)
188
193
  assert false, "Shouldn't have gotten here"
189
194
  rescue => e
190
195
  assert_equal "Salesforce::InvalidRequest", e.class.name
191
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
196
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
192
197
  end
193
198
  end
194
199
 
195
200
  def test_post__xml
196
201
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
197
202
  http_body = stub(:body => { :result => 'foo' }.to_xml)
198
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
203
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
199
204
  assert_equal({'result' => 'foo'}, Salesforce.connection.post('path', :body, :format => :xml))
200
205
  end
201
206
 
@@ -203,14 +208,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
203
208
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
204
209
  error = RestClient::BadRequest.new
205
210
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
206
- RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
211
+ RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
207
212
 
208
213
  begin
209
214
  Salesforce.connection.delete('path')
210
215
  assert false, "Shouldn't have gotten here"
211
216
  rescue => e
212
217
  assert_equal "Salesforce::InvalidRequest", e.class.name
213
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
218
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
214
219
  end
215
220
  end
216
221
 
@@ -218,25 +223,25 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
218
223
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
219
224
  error = RestClient::ResourceNotFound.new
220
225
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
221
- RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
226
+ RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
222
227
 
223
228
  begin
224
229
  Salesforce.connection.delete('path')
225
230
  assert false, "Shouldn't have gotten here"
226
231
  rescue => e
227
232
  assert_equal "Salesforce::InvalidRequest", e.class.name
228
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
233
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
229
234
  end
230
235
  end
231
236
 
232
237
  def test_delete__xml
233
238
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
234
- RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(stub(:body => ''))
239
+ RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(stub(:body => ''))
235
240
  assert Salesforce.connection.delete('path')
236
241
  end
237
242
 
238
243
  def test_salesforce_url
239
- assert_equal 'https://.salesforce.com/services/data/v22.0/path', Salesforce.connection.salesforce_url("path")
240
- assert_equal 'https://.salesforce.com/services/data/23.0/foo', Salesforce.connection.salesforce_url("/services/data/23.0/foo")
244
+ assert_equal 'https://awesome-2000.something.salesforce.com/services/data/v22.0/path', Salesforce.connection.salesforce_url("path")
245
+ assert_equal 'https://awesome-2000.something.salesforce.com/services/data/23.0/foo', Salesforce.connection.salesforce_url("/services/data/23.0/foo")
241
246
  end
242
- end
247
+ 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: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tushar Ranka
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
203
  version: '0'
204
204
  requirements: []
205
205
  rubyforge_project:
206
- rubygems_version: 2.4.5.1
206
+ rubygems_version: 2.6.9
207
207
  signing_key:
208
208
  specification_version: 4
209
209
  summary: A Simple gem to interact with the Salesforce REST API