activeforce 1.10.1 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -3
- data/Appraisals +5 -1
- data/activeforce.gemspec +1 -1
- data/gemfiles/4.0.gemfile +2 -2
- data/gemfiles/4.1.gemfile +2 -2
- data/gemfiles/4.2.gemfile +3 -3
- data/gemfiles/5.0.gemfile +9 -0
- data/lib/activeforce/version.rb +1 -1
- data/lib/salesforce/bulk/batch.rb +15 -15
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5252a0e6a043efa303c54d10293a4a7e5f227d0a
|
4
|
+
data.tar.gz: 96ff3c4f51375b7db97d64a7acb1eee06fd93de2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 749893be4c67aa8a36c6089bc678d1d949aa47568dea2befa383fa952d64fc2128647bf4daddf26947d69b1cf9baf72747fc9576eb49223248421fdcf99ae47a
|
7
|
+
data.tar.gz: 6ccd735668e25a3e9d259acb505c555ebab5387c3c72c6a2a07117b9357a952d8f66f4454469e53d03eba9210b81e91305e866b63b9d460d512314901493e3dc
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/activeforce.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.rubygems_version = "2.0.3"
|
22
22
|
s.summary = "A Simple gem to interact with the Salesforce REST API"
|
23
23
|
|
24
|
-
s.add_dependency(%q<rails>, [">= 4.0", "< 5.
|
24
|
+
s.add_dependency(%q<rails>, [">= 4.0", "< 5.1"])
|
25
25
|
s.add_dependency(%q<savon>, ["~> 1.0"])
|
26
26
|
s.add_dependency(%q<blockenspiel>, [">= 0"])
|
27
27
|
s.add_dependency(%q<rest-client>, [">= 0", '< 2.0'])
|
data/gemfiles/4.0.gemfile
CHANGED
data/gemfiles/4.1.gemfile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
data/lib/activeforce/version.rb
CHANGED
@@ -7,18 +7,18 @@ module Salesforce
|
|
7
7
|
class Batch
|
8
8
|
Result = Struct.new :id, :success, :created, :error
|
9
9
|
include ::Salesforce::Attributes
|
10
|
-
|
10
|
+
|
11
11
|
attr_accessor :id, :job, :number_records_failed, :number_records_processed, :state, :state_message, :total_time_processed, :filename, :csv
|
12
12
|
|
13
13
|
include Blockenspiel::DSL
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(job)
|
16
16
|
self.job = job
|
17
17
|
self.filename = temporary_csv_file
|
18
18
|
self.csv = CSVLib.open(self.filename, 'w+')
|
19
19
|
self.csv << csv_header
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def record(record)
|
23
23
|
if record.is_a?(Hash)
|
24
24
|
self.csv << ordered_values(record)
|
@@ -26,56 +26,56 @@ module Salesforce
|
|
26
26
|
self.csv << ordered_values(record.attributes)
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def ordered_values(record)
|
31
31
|
job.csv_columns.map do |col|
|
32
32
|
raw_value = record[col.name.to_sym]
|
33
33
|
Column.to_csv_value Column.typecast(col.type, raw_value)
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def create!
|
38
38
|
self.csv.close
|
39
39
|
response = ::Salesforce.connection.async_post("job/#{job.id}/batch", File.read(self.filename), :format => :xml, :content_type => 'text/csv')
|
40
40
|
assign_attributes!(response)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def update_status
|
44
44
|
return state if completed?
|
45
45
|
response = ::Salesforce.connection.async_get("job/#{job.id}/batch/#{id}", :format => :xml)
|
46
46
|
self.state = response[:state]
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
def results
|
50
50
|
parse_csv_results ::Salesforce.connection.async_get("job/#{job.id}/batch/#{id}/result")
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
[ :queued, :in_progress, :completed, :failed, :not_processed ].each do |status|
|
54
54
|
define_method "#{status}?" do
|
55
55
|
self.state == status.to_s.titleize
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
def temporary_csv_file
|
60
|
-
if Object.const_defined?(:Rails) && Rails.root.present?
|
60
|
+
if Object.const_defined?(:Rails) && Rails.respond_to?(:root) && Rails.root.present?
|
61
61
|
Rails.root.join('tmp', 'files', "#{ Time.now.to_i}#{rand(10000)}.csv")
|
62
62
|
else
|
63
63
|
File.join("/tmp/#{ Time.now.to_i}#{rand(10000)}.csv")
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
private
|
68
|
-
|
68
|
+
|
69
69
|
def parse_csv_results(results)
|
70
70
|
parsed_results = CSVLib.parse(results)
|
71
71
|
parsed_results[1..-1].map { |row| Result.new(*row) }
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def csv_header
|
75
75
|
self.job.csv_columns.map(&:original_name)
|
76
76
|
end
|
77
|
-
|
78
|
-
|
77
|
+
|
78
|
+
|
79
79
|
end
|
80
80
|
end
|
81
81
|
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: 1.10.
|
4
|
+
version: 1.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tushar Ranka
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '4.0'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '5.
|
23
|
+
version: '5.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '4.0'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.1'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: savon
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- gemfiles/4.0.gemfile
|
163
163
|
- gemfiles/4.1.gemfile
|
164
164
|
- gemfiles/4.2.gemfile
|
165
|
+
- gemfiles/5.0.gemfile
|
165
166
|
- lib/activeforce.rb
|
166
167
|
- lib/activeforce/version.rb
|
167
168
|
- lib/ruby_187_range_extension.rb
|
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
218
|
version: '0'
|
218
219
|
requirements: []
|
219
220
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.6.
|
221
|
+
rubygems_version: 2.6.14
|
221
222
|
signing_key:
|
222
223
|
specification_version: 4
|
223
224
|
summary: A Simple gem to interact with the Salesforce REST API
|