Rails - 制作 MailChimp Hominid Gem,后台任务
我正在尝试对 MailChimp API 进行原始人调用,但没有取得太大成功。我的调用看起来像
h.list_subscribe(:user_list_id, params[:email], {'FNAME' => '', 'LNAME' => ''}, 'html', true, true, true, false)
h 是 Homind::API 类的对象。该对象也没有delayed_job gem 提供的“延迟”方法。它甚至没有像“类”或“方法”这样的标准方法。当我创建自定义作业时,它不会添加到作业队列中。
明确地说,将方法设置为“handle_asynchronously”会导致
can't convert nil into String
我猜测
lib/delayed/yaml_ext.rb:16:in `value='
Delayed_Job 无法序列化非常剥离的自己的 Hominid::API 对象。非常欢迎就如何解决这个问题提出建议。谢谢!
I'm trying to make my Hominid call to MailChimp API, however without much success. My call looks like
h.list_subscribe(:user_list_id, params[:email], {'FNAME' => '', 'LNAME' => ''}, 'html', true, true, true, false)
where h is an object of Homind::API class. This object neither has a 'delay' method provided by delayed_job gem. It does not even have standard methods like 'class' or 'methods'. When, I create a custom job, it is not added to the job queue.
Explicity, setting the method to 'handle_asynchronously' results in a
can't convert nil into String
in
lib/delayed/yaml_ext.rb:16:in `value='
I'm guessing Delayed_Job cannot serialize the very stripped own Hominid::API object. Suggestions on how to go about this are most welcome. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,答案一直就在那里。
创建自定义作业时,需要从初始值设定项加载它,以便在delayed_job 执行作业时可用。一个简单的,
在任何初始化器中都可以。
您还可以从 delayed_job wiki 找到更多信息
Ah, the answer was there all along.
When a custom job is created, it needs to loaded from a initializer so that it is available when delayed_job executes the job. A simple,
in any of the initializers will do.
You can also find more info from delayed_job wiki