executrix 1.3.0 → 1.4.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/.ruby-version +1 -1
- data/.travis.yml +5 -5
- data/executrix.gemspec +4 -4
- data/lib/executrix/batch.rb +8 -7
- data/lib/executrix/helper.rb +5 -1
- data/lib/executrix/version.rb +2 -2
- data/spec/lib/executrix/batch_spec.rb +56 -1
- data/spec/lib/executrix/connection_spec.rb +28 -1
- data/spec/lib/executrix/helper_spec.rb +12 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ced71acaf75a254a114481b24b1ba5048b3d05b
|
4
|
+
data.tar.gz: ececa6fd0c37254472fcaf50362682844c071bb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07d762601af1dd6b05f9b6a87feb45cf42deecb64305e00a1341fe9c8a9a2820b000828ec94fd373f59bfe1ed45cd32640798a377a481cf799b41f7af79e3f8
|
7
|
+
data.tar.gz: bdd203300c9bad368639cf7dd6b7ded16c84aabd89cb34f20e841f0b971c5970fe103b43ba1c6bac03eb6fe7a8715070d13385c508628aacfe889e5d4662d536
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.3
|
data/.travis.yml
CHANGED
@@ -4,15 +4,15 @@ bundler_args: --without documentation production
|
|
4
4
|
rvm:
|
5
5
|
- 1.9.3
|
6
6
|
- 2.0.0
|
7
|
-
- 2.1.
|
7
|
+
- 2.1.3
|
8
8
|
- jruby-19mode
|
9
9
|
- rbx
|
10
10
|
- ruby-head
|
11
11
|
- jruby-head
|
12
12
|
matrix:
|
13
13
|
allow_failures:
|
14
|
-
- rvm:
|
15
|
-
|
16
|
-
|
14
|
+
- rvm: ruby-head
|
15
|
+
- rvm: jruby-head
|
16
|
+
fast_finish: true
|
17
17
|
script:
|
18
|
-
- bundle exec rake spec
|
18
|
+
- bundle exec rake spec
|
data/executrix.gemspec
CHANGED
@@ -22,14 +22,14 @@ Gem::Specification.new do |gem|
|
|
22
22
|
|
23
23
|
gem.add_dependency 'rake'
|
24
24
|
gem.add_dependency 'json'
|
25
|
-
gem.add_dependency 'nori', '< 2.
|
25
|
+
gem.add_dependency 'nori', '< 2.5'
|
26
26
|
gem.add_dependency 'nokogiri', '< 1.7'
|
27
27
|
gem.add_dependency 'rubyzip', '>= 1.0' ,'< 1.2'
|
28
|
-
gem.add_development_dependency 'rspec', '< 2
|
29
|
-
gem.add_development_dependency 'webmock', '< 1.
|
28
|
+
gem.add_development_dependency 'rspec', '< 3.2'
|
29
|
+
gem.add_development_dependency 'webmock', '< 1.20'
|
30
30
|
if RUBY_ENGINE == 'rbx'
|
31
31
|
gem.add_dependency 'rubysl', '< 2.1'
|
32
32
|
gem.add_development_dependency 'racc', '< 1.5'
|
33
33
|
gem.add_development_dependency 'rubinius-coverage', '< 2.1'
|
34
34
|
end
|
35
|
-
end
|
35
|
+
end
|
data/lib/executrix/batch.rb
CHANGED
@@ -36,9 +36,12 @@ module Executrix
|
|
36
36
|
@connection.query_batch @job_id, @batch_id
|
37
37
|
end
|
38
38
|
|
39
|
+
# results returned from Salesforce can be a single page id, or an array of ids.
|
40
|
+
# if it's an array of ids, we will fetch the results from each, and concatenate them.
|
39
41
|
def results
|
40
|
-
|
41
|
-
|
42
|
+
Array(query_result_id).map do |result_id|
|
43
|
+
@connection.query_batch_result_data(@job_id, @batch_id, result_id)
|
44
|
+
end.flatten
|
42
45
|
end
|
43
46
|
|
44
47
|
def raw_request
|
@@ -50,11 +53,9 @@ module Executrix
|
|
50
53
|
end
|
51
54
|
|
52
55
|
private
|
53
|
-
def
|
56
|
+
def query_result_id
|
54
57
|
result_raw = @connection.query_batch_result_id(@job_id, @batch_id)
|
55
|
-
if result_raw
|
56
|
-
@result_id = result_raw[:result]
|
57
|
-
end
|
58
|
+
result_raw[:result] if result_raw
|
58
59
|
end
|
59
60
|
end
|
60
|
-
end
|
61
|
+
end
|
data/lib/executrix/helper.rb
CHANGED
@@ -18,7 +18,11 @@ module Executrix
|
|
18
18
|
records.each do |hash|
|
19
19
|
row = CSV::Row.new([],[],false)
|
20
20
|
to_store = hash.inject({}) do |h, (k, v)|
|
21
|
-
|
21
|
+
if v == nil || v == '' || v == []
|
22
|
+
h[k] = '#N/A'
|
23
|
+
else
|
24
|
+
h[k] = v.class == Array ? v.join(';') : v
|
25
|
+
end
|
22
26
|
h
|
23
27
|
end
|
24
28
|
row << to_store
|
data/lib/executrix/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Executrix
|
2
|
-
VERSION = '1.
|
3
|
-
end
|
2
|
+
VERSION = '1.4.0'
|
3
|
+
end
|
@@ -70,4 +70,59 @@ describe Executrix::Batch do
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
|
+
describe '#results' do
|
75
|
+
let(:job_id) { "12345" }
|
76
|
+
let(:batch_id) { "67890" }
|
77
|
+
let(:connection) { double("connection") }
|
78
|
+
subject {described_class.new connection, job_id, batch_id}
|
79
|
+
|
80
|
+
context 'with a single page of results' do
|
81
|
+
let(:result_id) {"M75200000001Vgt"}
|
82
|
+
let(:single_result) {{:Id=>"M75200000001Vgt", :name=>"Joe"}}
|
83
|
+
|
84
|
+
it 'returns the results' do
|
85
|
+
expect(connection).to receive(:query_batch_result_id).
|
86
|
+
with(job_id, batch_id).
|
87
|
+
and_return({:result => result_id})
|
88
|
+
|
89
|
+
expect(connection).to receive(:query_batch_result_data).
|
90
|
+
once.
|
91
|
+
with(job_id, batch_id, result_id).
|
92
|
+
and_return(single_result)
|
93
|
+
|
94
|
+
expect(subject.results).to eq([single_result])
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'with an array of page of results' do
|
99
|
+
let(:result_ids) {["M75200000001Vgt", "M76500000001Vgt", "M73400000001Vgt"]}
|
100
|
+
let(:multiple_results) {[{:Id=>"AAA11123", :name=>"Joe"},
|
101
|
+
{:Id=>"AAA11124", :name=>"Sam"},
|
102
|
+
{:Id=>"AAA11125", :name=>"Mike"}]}
|
103
|
+
|
104
|
+
it 'returns concatenated results' do
|
105
|
+
expect(connection).to receive(:query_batch_result_id).
|
106
|
+
with(job_id, batch_id).
|
107
|
+
and_return({:result => result_ids})
|
108
|
+
|
109
|
+
expect(connection).to receive(:query_batch_result_data).
|
110
|
+
ordered.
|
111
|
+
with(job_id, batch_id, result_ids[0]).
|
112
|
+
and_return(multiple_results[0])
|
113
|
+
|
114
|
+
expect(connection).to receive(:query_batch_result_data).
|
115
|
+
ordered.
|
116
|
+
with(job_id, batch_id, result_ids[1]).
|
117
|
+
and_return(multiple_results[1])
|
118
|
+
|
119
|
+
expect(connection).to receive(:query_batch_result_data).
|
120
|
+
ordered.
|
121
|
+
with(job_id, batch_id, result_ids[2]).
|
122
|
+
and_return(multiple_results[2])
|
123
|
+
|
124
|
+
expect(subject.results).to eq(multiple_results)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -65,4 +65,31 @@ describe Executrix::Connection do
|
|
65
65
|
expect(return_code).to eq(-1)
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
|
+
describe '#query_batch_result_id' do
|
70
|
+
let(:job_id) {"12345"}
|
71
|
+
let(:batch_id) {"67890"}
|
72
|
+
|
73
|
+
context 'with a single page of results' do
|
74
|
+
let(:single_result) {{:result=>"M75200000001Vgt", :@xmlns=>"http://www.force.com/2009/06/asyncapi/dataload"}}
|
75
|
+
it 'returns the result_id as a string' do
|
76
|
+
expect(Executrix::Http).to receive(:query_batch_result_id).
|
77
|
+
with(nil, nil, job_id, batch_id, nil).
|
78
|
+
and_return(single_result)
|
79
|
+
|
80
|
+
expect(subject.query_batch_result_id(job_id, batch_id)).to eq(single_result)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context 'with an array of page of results' do
|
85
|
+
let(:multiple_result) {{:result=>["752M00000001Vgt", "752M00000001Vgy"], :@xmlns=>"http://www.force.com/2009/06/asyncapi/dataload"}}
|
86
|
+
it 'returns the resu lt_id as a string' do
|
87
|
+
expect(Executrix::Http).to receive(:query_batch_result_id).
|
88
|
+
with(nil, nil, job_id, batch_id, nil).
|
89
|
+
and_return(multiple_result)
|
90
|
+
|
91
|
+
expect(subject.query_batch_result_id(job_id, batch_id)).to eq(multiple_result)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -60,6 +60,18 @@ describe Executrix::Helper do
|
|
60
60
|
"\"A second Title\",\"A second name\"\n"
|
61
61
|
expect(described_class.records_to_csv(input)).to eq(expected_csv)
|
62
62
|
end
|
63
|
+
|
64
|
+
it 'correctly converts empty arrays, nil values and blank strings to #N/A' do
|
65
|
+
input = [
|
66
|
+
{'Title' => nil, 'Picklist' => ['Several', 'Values']},
|
67
|
+
{'Title' => '', 'Picklist' => []},
|
68
|
+
]
|
69
|
+
|
70
|
+
expected_csv = "\"Title\",\"Picklist\"\n" \
|
71
|
+
"\"#N/A\",\"Several;Values\"\n" \
|
72
|
+
"\"#N/A\",\"#N/A\"\n"
|
73
|
+
expect(described_class.records_to_csv(input)).to eq(expected_csv)
|
74
|
+
end
|
63
75
|
end
|
64
76
|
|
65
77
|
describe '.fetch_instance_from_server_url' do
|
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.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge Valdivia
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "<"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '2.
|
48
|
+
version: '2.5'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "<"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '2.
|
55
|
+
version: '2.5'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: nokogiri
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,28 +93,28 @@ dependencies:
|
|
93
93
|
requirements:
|
94
94
|
- - "<"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '2
|
96
|
+
version: '3.2'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "<"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '2
|
103
|
+
version: '3.2'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
105
|
name: webmock
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "<"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.20'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "<"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
117
|
+
version: '1.20'
|
118
118
|
description: This gem provides a super simple interface for the Salesforce Bulk API.
|
119
119
|
It provides support for insert, update, upsert, delete, and query.
|
120
120
|
email:
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project: executrix
|
169
|
-
rubygems_version: 2.2.
|
169
|
+
rubygems_version: 2.2.2
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: Ruby support for the Salesforce Bulk API
|