activeforce 2.1.1 → 3.0.0
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 +2 -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: 9c74adafa6a11b9d1b31c13c34a27b7a14d3ab10
|
4
|
+
data.tar.gz: 5214ab5fea572a978b9faa040955d7cbc155e0de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0272659f78f50c7bcb40f19d340be86eceb25df3c4dc776b0f3c28dacb9ff9d683e37e895df42b0f9ac01ba6d7154437e41e3888605c790113fc4fe3fd0ff4ce'
|
7
|
+
data.tar.gz: 0efd4ca37a8c0e55da57a11666a4d1e6ddfa2ca09ebbc7376d6d6903fba815595e6154cf7883adc6aeac444e95fb03b18b7f066427591fb88e643c672c48f67f
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/activeforce.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.required_ruby_version = ">= 2.0"
|
23
23
|
s.summary = "A Simple gem to interact with the Salesforce REST API"
|
24
24
|
|
25
|
-
s.add_dependency(%q<rails>, [">= 4.0", "< 5.
|
25
|
+
s.add_dependency(%q<rails>, [">= 4.0", "< 5.1"])
|
26
26
|
s.add_dependency(%q<savon>, ["~> 2.11"])
|
27
27
|
s.add_dependency(%q<blockenspiel>, [">= 0"])
|
28
28
|
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:
|
4
|
+
version: 3.0.0
|
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
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- gemfiles/4.0.gemfile
|
149
149
|
- gemfiles/4.1.gemfile
|
150
150
|
- gemfiles/4.2.gemfile
|
151
|
+
- gemfiles/5.0.gemfile
|
151
152
|
- lib/activeforce.rb
|
152
153
|
- lib/activeforce/version.rb
|
153
154
|
- lib/ruby_187_range_extension.rb
|
@@ -203,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
204
|
version: '0'
|
204
205
|
requirements: []
|
205
206
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.6.
|
207
|
+
rubygems_version: 2.6.14
|
207
208
|
signing_key:
|
208
209
|
specification_version: 4
|
209
210
|
summary: A Simple gem to interact with the Salesforce REST API
|