在 Keen 中获得 "need project id error"

getting a "need project id error" in Keen

我收到以下错误:

Keen.delete(:iron_worker_analytics, filters: [{:property_name => 'start_time', :operator => 'eq', :property_value => '0001-01-01T00:00:00Z'}])

Keen::ConfigurationError: Keen IO Exception: Project ID must be set

但是,当我设置该值时,我得到以下信息:

 warning: already initialized constant KEEN_PROJECT_ID
 iron.io/env.rb:36: warning: previous definition of KEEN_PROJECT_ID was here

当我 运行 应用程序并从 env.rb 文件加载值时,Keen 工作正常,但从控制台我无法通过此操作。

我正在使用 ruby gem.

我明白了。文档令人困惑。根据文档:

https://github.com/keenlabs/keen-gem

The recommended way to set keys is via the environment. The keys you can set are KEEN_PROJECT_ID, KEEN_WRITE_KEY, KEEN_READ_KEY and KEEN_MASTER_KEY. You only need to specify the keys that correspond to the API calls you'll be performing. If you're using foreman, add this to your .env file:

KEEN_PROJECT_ID=aaaaaaaaaaaaaaa KEEN_MASTER_KEY=xxxxxxxxxxxxxxx KEEN_WRITE_KEY=yyyyyyyyyyyyyyy KEEN_READ_KEY=zzzzzzzzzzzzzzz If not, make a script to export the variables into your shell or put it before the command you use to start your server.

但我必须在执行 Keen.methods.

后将其明确设置为 Keen.project_id

这有点令人困惑,因为根据文档,我假设我只需要设置变量。也许我误解了文档,但至少让我感到困惑。