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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f21729ed39bc14842ed2ca9dd4f76e30d0457a2
4
- data.tar.gz: c1529d65db793a5db03f15ae73d153e3cbb3d0bc
3
+ metadata.gz: 5252a0e6a043efa303c54d10293a4a7e5f227d0a
4
+ data.tar.gz: 96ff3c4f51375b7db97d64a7acb1eee06fd93de2
5
5
  SHA512:
6
- metadata.gz: ed40a4f4066b5aa97ba1509d56941814a0e2c4482d3bdefef281630c96ef1268cae58923e4c69bd836646d9d084704539544b008a9cbea4f52f17b5960445e05
7
- data.tar.gz: a8703e1454c00b61618276035877637690a4830744cd98b270c7a2fb511ac23e87baa0eb71d6ded9cb40abb8701815c2b12837393568d1642958a98dabd6280a
6
+ metadata.gz: 749893be4c67aa8a36c6089bc678d1d949aa47568dea2befa383fa952d64fc2128647bf4daddf26947d69b1cf9baf72747fc9576eb49223248421fdcf99ae47a
7
+ data.tar.gz: 6ccd735668e25a3e9d259acb505c555ebab5387c3c72c6a2a07117b9357a952d8f66f4454469e53d03eba9210b81e91305e866b63b9d460d512314901493e3dc
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ _yardoc
18
18
  doc/
19
19
 
20
20
  Gemfile.lock
21
+ gemfiles/*.lock
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.4
4
- - 2.0.0
5
- - 1.9.3
3
+ - 2.3.3
4
+ - 2.2.3
6
5
  - ruby-head
7
6
 
8
7
  sudo: false
@@ -15,3 +14,4 @@ gemfile:
15
14
  - gemfiles/4.0.gemfile
16
15
  - gemfiles/4.1.gemfile
17
16
  - gemfiles/4.2.gemfile
17
+ - gemfiles/5.0.gemfile
data/Appraisals CHANGED
@@ -7,5 +7,9 @@ appraise "4.1" do
7
7
  end
8
8
 
9
9
  appraise "4.2" do
10
- gem "rails", "~> 4.2"
10
+ gem "rails", "~> 4.2.0"
11
+ end
12
+
13
+ appraise "5.0" do
14
+ gem "rails", "~> 5.0.0"
11
15
  end
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.0"])
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
@@ -3,7 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "mocha", "0.14.0", :require => false
6
+ gem "mocha", "0.14.0", require: false
7
7
  gem "rails", "~> 4.0.0"
8
8
 
9
- gemspec :path => "../"
9
+ gemspec path: "../"
data/gemfiles/4.1.gemfile CHANGED
@@ -3,7 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "mocha", "0.14.0", :require => false
6
+ gem "mocha", "0.14.0", require: false
7
7
  gem "rails", "~> 4.1.0"
8
8
 
9
- gemspec :path => "../"
9
+ gemspec path: "../"
data/gemfiles/4.2.gemfile CHANGED
@@ -3,7 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "mocha", "0.14.0", :require => false
7
- gem "rails", "~> 4.2"
6
+ gem "mocha", "0.14.0", require: false
7
+ gem "rails", "~> 4.2.0"
8
8
 
9
- gemspec :path => "../"
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "mocha", "0.14.0", require: false
7
+ gem "rails", "~> 5.0.0"
8
+
9
+ gemspec path: "../"
@@ -1,3 +1,3 @@
1
1
  module Activeforce
2
- VERSION = '1.10.1'.freeze
2
+ VERSION = '1.10.2'.freeze
3
3
  end
@@ -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.1
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.0'
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.0'
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.9
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