salesforce_ar_sync 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/salesforce_ar_sync/engine.rb +24 -0
- data/lib/salesforce_ar_sync/extenders/salesforce_syncable.rb +1 -1
- data/lib/salesforce_ar_sync/ip_constraint.rb +1 -1
- data/lib/salesforce_ar_sync/soap_handler/base.rb +1 -1
- data/lib/salesforce_ar_sync/version.rb +1 -1
- data/lib/salesforce_ar_sync.rb +1 -0
- metadata +2 -2
@@ -3,6 +3,30 @@ module SalesforceArSync
|
|
3
3
|
initializer "salesforce_ar_sync.load_app_instance_data" do |app|
|
4
4
|
SalesforceArSync.setup do |config|
|
5
5
|
config.app_root = app.root
|
6
|
+
|
7
|
+
#Load the configuration from the environment or a yaml file or disable it if no config present
|
8
|
+
SalesforceArSync.config = Hash.new
|
9
|
+
|
10
|
+
#load the config file if we have it
|
11
|
+
if FileTest.exist?("#{Rails.root}/config/salesforce_ar_sync.yml")
|
12
|
+
config = YAML.load_file("#{Rails.root}/config/salesforce_ar_sync.yml")
|
13
|
+
config = config[Rails.env]
|
14
|
+
if config['organization_id'].present? && config['ip_ranges'].present? && config['sync_enabled'].present?
|
15
|
+
SalesforceArSync.config["ORGANIZATION_ID"] = config['organization_id']
|
16
|
+
SalesforceArSync.config["SYNC_ENABLED"] = config['sync_enabled']
|
17
|
+
SalesforceArSync.config["IP_RANGES"] = config['ip_ranges'].split(',').map{ |ip| ip.strip }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
#if we have ENV flags prefer them
|
22
|
+
SalesforceArSync.config["ORGANIZATION_ID"] = ENV["SALESFORCE_AR_SYNC_ORGANIZATION_ID"] if ENV["SALESFORCE_AR_SYNC_ORGANIZATION_ID"]
|
23
|
+
SalesforceArSync.config["SYNC_ENABLED"] = ENV["SALESFORCE_AR_SYNC_SYNC_ENABLED"] if ENV.include? "SALESFORCE_AR_SYNC_SYNC_ENABLED"
|
24
|
+
SalesforceArSync.config["IP_RANGES"] = ENV["SALESFORCE_AR_SYNC_IP_RANGES"].split(',').map{ |ip| ip.strip } if ENV["SALESFORCE_AR_SYNC_IP_RANGES"]
|
25
|
+
|
26
|
+
#do we have valid config options now?
|
27
|
+
if !SalesforceArSync.config["ORGANIZATION_ID"].present? || SalesforceArSync.config["ORGANIZATION_ID"].length != 18
|
28
|
+
SalesforceArSync.config["SYNC_ENABLED"] = false
|
29
|
+
end
|
6
30
|
end
|
7
31
|
end
|
8
32
|
end
|
@@ -46,7 +46,7 @@ module SalesforceArSync
|
|
46
46
|
# The salesforce_skip_sync instance variable is also used.
|
47
47
|
# The SALESFORCE_AR_SYNC_ENABLED flag overrides all the others if set to false
|
48
48
|
def salesforce_skip_sync?
|
49
|
-
return true if
|
49
|
+
return true if SalesforceArSync.config["SYNC_ENABLED"] == false
|
50
50
|
return (salesforce_skip_sync || !self.class.salesforce_sync_enabled || send(self.class.salesforce_skip_sync_method)) if self.class.salesforce_skip_sync_method.present?
|
51
51
|
return (salesforce_skip_sync || !self.class.salesforce_sync_enabled)
|
52
52
|
end
|
@@ -6,7 +6,7 @@ module SalesforceArSync
|
|
6
6
|
def initialize organization, options = {}
|
7
7
|
@options = options
|
8
8
|
@xml_hashed = options
|
9
|
-
@organization =
|
9
|
+
@organization = SalesforceArSync.config["ORGANIZATION_ID"]
|
10
10
|
@sobjects = collect_sobjects if valid?
|
11
11
|
end
|
12
12
|
|
data/lib/salesforce_ar_sync.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salesforce_ar_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2012-09-
|
16
|
+
date: 2012-09-24 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rails
|