I'm new to Ruby and I'm trying to connect my application with SalesForce using the database.com gem. My goal is to develop a gem that wraps the Databasedotcom gem, an than use my own wrapper gem in a rails project.
I've installed the databasedotcom gem with bundler.
My Gemfile has the gem declaration:
gem 'databasedotcom'
I've generated my credentials at salesforce (user + pass) and (client_id and client_secret). I used a curl script to test the connection and I was even able to connect to my account.
config/databasedotcom.yml:
host: login.salesforce.com # Use test.salesforce.com for sandbox
client_secret: mySecret # This is the Consumer Secret from Salesforce
client_id: myClientID # This is the Consumer Key from Salesforce
sobject_module: SFDC_Models # See below for details on using modules
debugging: true # Can be useful while developing
username: myusername
password: mypassword
The problem occurs when I'm trying to use the objects inside my code, for example:
require_relative "test_helper"
class SalesforceclientTest < MiniTest::Test
def test_send_lead
client = Databasedotcom::Client.new("databasedotcom.yml")
client.materialize("User")
@users = Databasedotcom::User.all()[0..19]
end
end
When I run rake, it gives me the following error:
NameError: uninitialized constant SalesforceclientTest::Databasedotcom
I've also tried to put:
require databasedotcom
in the beginning of the test code, but than, when I re-run rake, it gives me:
require': cannot load such file -- databasedotcom (LoadError)
It's probably something stupid but I can't figure it out. Any help?
Thanks,