databasedotcom 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -64,17 +64,16 @@ module Databasedotcom
|
|
64
64
|
self.client_secret = url_options[:oauth_secret]
|
65
65
|
self.username = url_options[:user]
|
66
66
|
self.password = url_options[:password]
|
67
|
-
self.sobject_module = "Databasedotcom::Sobject"
|
68
67
|
else
|
69
68
|
self.client_id = ENV['DATABASEDOTCOM_CLIENT_ID'] || @options[:client_id]
|
70
69
|
self.client_secret = ENV['DATABASEDOTCOM_CLIENT_SECRET'] || @options[:client_secret]
|
71
70
|
self.host = ENV['DATABASEDOTCOM_HOST'] || @options[:host] || "login.salesforce.com"
|
72
|
-
self.debugging = ENV['DATABASEDOTCOM_DEBUGGING'] || @options[:debugging]
|
73
|
-
self.version = ENV['DATABASEDOTCOM_VERSION'] || @options[:version]
|
74
|
-
self.version = self.version.to_s if self.version
|
75
|
-
self.sobject_module = ENV['DATABASEDOTCOM_SOBJECT_MODULE'] || (@options && @options[:sobject_module])
|
76
71
|
end
|
77
|
-
|
72
|
+
self.debugging = ENV['DATABASEDOTCOM_DEBUGGING'] || @options[:debugging]
|
73
|
+
self.version = ENV['DATABASEDOTCOM_VERSION'] || @options[:version]
|
74
|
+
self.version = self.version.to_s if self.version
|
75
|
+
self.sobject_module = ENV['DATABASEDOTCOM_SOBJECT_MODULE'] || @options[:sobject_module]
|
76
|
+
end
|
78
77
|
|
79
78
|
# Authenticate to the Force.com API. _options_ is a Hash, interpreted as follows:
|
80
79
|
#
|
@@ -355,7 +354,7 @@ module Databasedotcom
|
|
355
354
|
end
|
356
355
|
|
357
356
|
def module_namespace
|
358
|
-
self.sobject_module || Object
|
357
|
+
(self.sobject_module && self.sobject_module.constantize) || Object
|
359
358
|
end
|
360
359
|
|
361
360
|
def collection_from(response)
|
@@ -5,4 +5,12 @@ class String
|
|
5
5
|
def resourcerize
|
6
6
|
self.gsub(/([a-z])([A-Z])/, '\1-\2').downcase
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
|
+
def constantize
|
10
|
+
unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ self
|
11
|
+
raise NameError, "#{self.inspect} is not a valid constant name!"
|
12
|
+
end
|
13
|
+
Object.module_eval("::#{$1}", __FILE__, __LINE__)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|