executrix 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/executrix/helper.rb +5 -0
- data/lib/executrix/http.rb +13 -9
- data/lib/executrix/version.rb +1 -1
- data/spec/lib/executrix/helper_spec.rb +29 -0
- metadata +4 -4
data/lib/executrix/helper.rb
CHANGED
data/lib/executrix/http.rb
CHANGED
@@ -77,7 +77,7 @@ module Executrix
|
|
77
77
|
raise raw_result[:fault][:faultstring] if raw_result[:fault]
|
78
78
|
|
79
79
|
login_result = raw_result[:login_response][:result]
|
80
|
-
instance = login_result[:server_url]
|
80
|
+
instance = Helper.fetch_instance_from_server_url(login_result[:server_url])
|
81
81
|
login_result.merge(instance: instance)
|
82
82
|
end
|
83
83
|
|
@@ -112,10 +112,9 @@ module Executrix
|
|
112
112
|
'Content-Type' => 'text/xml; charset=utf-8',
|
113
113
|
'SOAPAction' => 'login'
|
114
114
|
}
|
115
|
-
host = sandbox ? 'test.salesforce.com' : 'login.salesforce.com'
|
116
115
|
Http::Request.new(
|
117
116
|
:post,
|
118
|
-
|
117
|
+
generic_host(sandbox ? 'test' : 'login'),
|
119
118
|
"/services/Soap/u/#{api_version}",
|
120
119
|
body,
|
121
120
|
headers)
|
@@ -137,7 +136,7 @@ module Executrix
|
|
137
136
|
'X-SFDC-Session' => session_id}
|
138
137
|
Http::Request.new(
|
139
138
|
:post,
|
140
|
-
|
139
|
+
generic_host(instance),
|
141
140
|
"/services/async/#{api_version}/job",
|
142
141
|
body,
|
143
142
|
headers)
|
@@ -154,7 +153,7 @@ module Executrix
|
|
154
153
|
'X-SFDC-Session' => session_id}
|
155
154
|
Http::Request.new(
|
156
155
|
:post,
|
157
|
-
|
156
|
+
generic_host(instance),
|
158
157
|
"/services/async/#{api_version}/job/#{job_id}",
|
159
158
|
body,
|
160
159
|
headers)
|
@@ -164,7 +163,7 @@ module Executrix
|
|
164
163
|
headers = {'Content-Type' => 'text/csv; charset=UTF-8', 'X-SFDC-Session' => session_id}
|
165
164
|
Http::Request.new(
|
166
165
|
:post,
|
167
|
-
|
166
|
+
generic_host(instance),
|
168
167
|
"/services/async/#{api_version}/job/#{job_id}/batch",
|
169
168
|
data,
|
170
169
|
headers)
|
@@ -174,7 +173,7 @@ module Executrix
|
|
174
173
|
headers = {'X-SFDC-Session' => session_id}
|
175
174
|
Http::Request.new(
|
176
175
|
:get,
|
177
|
-
|
176
|
+
generic_host(instance),
|
178
177
|
"/services/async/#{api_version}/job/#{job_id}/batch/#{batch_id}",
|
179
178
|
nil,
|
180
179
|
headers)
|
@@ -186,7 +185,7 @@ module Executrix
|
|
186
185
|
'X-SFDC-Session' => session_id}
|
187
186
|
Http::Request.new(
|
188
187
|
:get,
|
189
|
-
|
188
|
+
generic_host(instance),
|
190
189
|
"/services/async/#{api_version}/job/#{job_id}/batch/#{batch_id}/result",
|
191
190
|
nil,
|
192
191
|
headers)
|
@@ -203,12 +202,17 @@ module Executrix
|
|
203
202
|
'X-SFDC-Session' => session_id}
|
204
203
|
Http::Request.new(
|
205
204
|
:get,
|
206
|
-
|
205
|
+
generic_host(instance),
|
207
206
|
"/services/async/#{api_version}" \
|
208
207
|
"/job/#{job_id}/batch/#{batch_id}/result/#{result_id}",
|
209
208
|
nil,
|
210
209
|
headers)
|
211
210
|
end
|
211
|
+
|
212
|
+
private
|
213
|
+
def self.generic_host prefix
|
214
|
+
"#{prefix}.salesforce.com"
|
215
|
+
end
|
212
216
|
end
|
213
217
|
end
|
214
218
|
end
|
data/lib/executrix/version.rb
CHANGED
@@ -61,4 +61,33 @@ describe Executrix::Helper do
|
|
61
61
|
expect(described_class.records_to_csv(input)).to eq(expected_csv)
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
describe '.fetch_instance_from_server_url' do
|
66
|
+
let(:basic_api_server_url) {
|
67
|
+
'https://cs7-api.salesforce.com/services/Soap/u/28.0/00CS00000095Y5b'
|
68
|
+
}
|
69
|
+
|
70
|
+
let(:basic_server_url) {
|
71
|
+
'https://eu1.salesforce.com/services/Soap/u/28.0/00EU00000096Y8c'
|
72
|
+
}
|
73
|
+
|
74
|
+
let(:named_server_url) {
|
75
|
+
'https://supercustomname.my.salesforce.com/services/Soap/u/28.0/00EH0000001jNQu'
|
76
|
+
}
|
77
|
+
|
78
|
+
it 'should return correct instance for regular salesforce server url' do
|
79
|
+
expect(described_class.fetch_instance_from_server_url(basic_server_url))
|
80
|
+
.to eq('eu1')
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should return correct instance for api salesforce server url' do
|
84
|
+
expect(described_class.fetch_instance_from_server_url(basic_api_server_url))
|
85
|
+
.to eq('cs7')
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should return correct instance for named salesforce server url' do
|
89
|
+
expect(described_class.fetch_instance_from_server_url(named_server_url))
|
90
|
+
.to eq('supercustomname.my')
|
91
|
+
end
|
92
|
+
end
|
64
93
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: executrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
segments:
|
140
140
|
- 0
|
141
|
-
hash:
|
141
|
+
hash: 203849975840229404
|
142
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
143
|
none: false
|
144
144
|
requirements:
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
segments:
|
149
149
|
- 0
|
150
|
-
hash:
|
150
|
+
hash: 203849975840229404
|
151
151
|
requirements: []
|
152
152
|
rubyforge_project: executrix
|
153
153
|
rubygems_version: 1.8.23
|