lib/databasedotcom/client.rb in databasedotcom-1.0.2 vs lib/databasedotcom/client.rb in databasedotcom-1.0.3
- old
+ new
@@ -62,21 +62,20 @@
self.host = url.host
self.client_id = url_options[:oauth_key]
self.client_secret = url_options[:oauth_secret]
self.username = url_options[:user]
self.password = url_options[:password]
- self.sobject_module = "Databasedotcom::Sobject"
else
self.client_id = ENV['DATABASEDOTCOM_CLIENT_ID'] || @options[:client_id]
self.client_secret = ENV['DATABASEDOTCOM_CLIENT_SECRET'] || @options[:client_secret]
self.host = ENV['DATABASEDOTCOM_HOST'] || @options[:host] || "login.salesforce.com"
- self.debugging = ENV['DATABASEDOTCOM_DEBUGGING'] || @options[:debugging]
- self.version = ENV['DATABASEDOTCOM_VERSION'] || @options[:version]
- self.version = self.version.to_s if self.version
- self.sobject_module = ENV['DATABASEDOTCOM_SOBJECT_MODULE'] || (@options && @options[:sobject_module])
end
- end
+ self.debugging = ENV['DATABASEDOTCOM_DEBUGGING'] || @options[:debugging]
+ self.version = ENV['DATABASEDOTCOM_VERSION'] || @options[:version]
+ self.version = self.version.to_s if self.version
+ self.sobject_module = ENV['DATABASEDOTCOM_SOBJECT_MODULE'] || @options[:sobject_module]
+ end
# Authenticate to the Force.com API. _options_ is a Hash, interpreted as follows:
#
# * If _options_ contains the keys <tt>:username</tt> and <tt>:password</tt>, those credentials are used to authenticate. In this case, the value of <tt>:password</tt> may need to include a concatenated security token, if required by your Salesforce org
# * If _options_ contains the key <tt>:provider</tt>, it is assumed to be the hash returned by Omniauth from a successful web-based OAuth2 authentication
@@ -353,10 +352,10 @@
end
clazz
end
def module_namespace
- self.sobject_module || Object
+ (self.sobject_module && self.sobject_module.constantize) || Object
end
def collection_from(response)
response = JSON.parse(response)
array_response = response.is_a?(Array)