lineofflight / peddler

Amazon Selling Partner API (SP-API) in Ruby
MIT License
307 stars 130 forks source link

Allow per-client path setting #21

Closed mcnelson closed 10 years ago

mcnelson commented 10 years ago

We're implementing Off-Amazon Payments and I hit a roadblock when trying to use the AWS Sandbox. The production API endpoint is "/OffAmazonPayments/2013-01-01/" which is fine and well, but the sandbox endpoint is "/OffAmazonPayments_Sandbox/2013-01-01/" which, unless I'm mistaken, is not touchable in the current Peddler implementation.

This allows setting the path as an instance variable that can override the class variable. So the big win is that you can pass in this path when instantiating a client. So for instance, when hitting the Sandbox:

MWS.off_amazon_payments(
  path: '/OffAmazonPayments_Sandbox/2013-01-01/',
  marketplace_id: 'hello',
  merchant_id: 'derp',
  aws_access_key_id: 'herp',
  aws_secret_access_key: 'blah'
)
hakanensari commented 10 years ago

Thanks, @mcnelson. Merging.