我正在尝试使用 mws api 发布带有 ruby on rails 和 spree 的产品。但是,总是会显示此消息:
undefined method `sku' for #<Spree::Admin::MeController:0xce1cec0>
require 'mws-connect'
class Spree::Admin::MeController < Spree::Admin::ResourceController
def index
mws = Mws.connect(
merchant: 'merchant',
access: 'access',
secret: 'secret'
)
sku = '12345678'
product = Mws::Product sku {
upc '123435566654'
tax_code 'GEN_TAX_CODE'
name 'Some Product 123'
brand 'Some Brand'
msrp 19.99, 'USD'
manufacturer 'Some Manufacturer'
category :ce
details {
cable_or_adapter {
cable_length as_distance 5, :feet
}
}
}
submission_id = mws.feeds.products.add(product)
result = mws.feeds.get(submission_id)
puts "Submission: #{result.transaction_id} - #{result.status}"
end
有人能帮我吗?