spree_chimpy:merge_vars:同步rake中止

时间:2014-03-07 12:41:49

标签: ruby-on-rails ruby-on-rails-3 rake spree mailchimp

我正在使用 spree 在我的Ruby on Rails应用程序中从spree_chimpy安装gem https://github.com/watg/spree_chimpy。在做mailchimp设置之后,我通知mailchimp关于merge_vars似乎导致错误。当我运行命令

rake spree_chimpy:merge_vars:sync --trace

我收到错误"tag" must be 10 bytes and may only contain "A-Z 0-9 _。我不明白错误,我在配置中没有添加任何tag变量。作为参考,我的config/initializers/spree_chimpy.rb被粘贴在这里:

    Spree::Chimpy.config do |config|
  # your API key as provided by MailChimp
  config.key = '<#my-api-hash-key>'

  # extra api options for the Mailchimp gem
  # config.api_options = { throws_exceptions: false, timeout: 3600 }

  # name of your list, defaults to "Members"
  config.list_name = 'test'

  # Allow users to be subscribed by default. Defaults to false
  # If you enable this option, it's strongly advised that your enable
  # double_opt_in as well. Abusing this may cause Mailchimp to suspend your account.
  # config.subscribed_by_default = false

  # When double-opt is enabled, the user will receive an email
  # asking to confirm their subscription. Defaults to false
  config.double_opt_in = false

  # id of your store. max 10 letters. defaults to "spree"
  # config.store_id = 'acme'

  # define a list of merge vars:
  # - key: a unique name that mail chimp uses. 10 letters max
  # - value: the name of any method on the user class.
  # default is {'EMAIL' => :email}
  config.merge_vars = {
    'EMAIL'       => :email,
    'FNAME'       => :fname,
    'LNAME'       => :lname,
    'ORDERNUMBER' => :onumber
  }
end

1 个答案:

答案 0 :(得分:1)

抛出的错误来自这里的某个地方:

https://github.com/watg/spree_chimpy/blob/7ba5d855112050e1b61c2d0a3369bc08f254842d/lib/spree_chimpy.rb#L59-L62

实际错误在mailchimp API客户端中。您收到错误是因为ORDERNUMBER中有11个字符。如果你把它减少到10个字符,你应该没问题。