我是 Ruby 新手,我正在尝试使用 database.com gem 将我的应用程序与 SalesForce 连接起来。我的目标是开发一个包装 Databasedotcom gem 的 gem,而不是在 rails 项目中使用我自己的包装器 gem。
我已经用 bundler 安装了 databasedotcom gem。
我的 Gemfile 有 gem 声明:
gem 'databasedotcom'
我已经在 salesforce (user + pass) 和 (client_id 和 client_secret) 生成了我的凭据。我使用 curl 脚本来测试连接,我什至能够连接到我的帐户。
配置/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
当我尝试使用代码中的对象时会出现问题,例如:
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
当我运行 rake 时,它给了我以下错误:
NameError: 未初始化的常量 SalesforceclientTest::Databasedotcom
我也试过把:
require databasedotcom
在测试代码的开头,但是,当我重新运行 rake 时,它给了我:
require': 无法加载此类文件 -- databasedotcom (LoadError)
这可能是愚蠢的,但我无法弄清楚。有什么帮助吗?
谢谢,