Skip to content

Instantly share code, notes, and snippets.

@hakanensari
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakanensari/9463555 to your computer and use it in GitHub Desktop.
Save hakanensari/9463555 to your computer and use it in GitHub Desktop.
Minimal Ruby interface for the Amazon MWS API
require 'jeff'
module MWS
class Request
include Jeff
HOSTS = {
'A2EUQ1WTGCTBG2' => 'mws.amazonservices.ca',
'AAHKV2X7AFYLW' => 'mws.amazonservices.com.cn',
'A1PA6795UKMFR9' => 'mws-eu.amazonservices.com',
'A1RKKUPIHCS9HS' => 'mws-eu.amazonservices.com',
'A13V1IB3VIYZZH' => 'mws-eu.amazonservices.com',
'A1F83G8C2ARO7P' => 'mws-eu.amazonservices.com',
'A21TJRUUN4KGV' => 'mws.amazonservices.in',
'APJ6JRA9NG5V4' => 'mws-eu.amazonservices.com',
'A1VC38T7YXB528' => 'mws.amazonservices.jp',
'ATVPDKIKX0DER' => 'mws.amazonservices.com'
}
params('SellerId' => -> { merchant_id })
attr_accessor :marketplace_id, :merchant_id
def aws_endpoint
"https://#{HOSTS.fetch(marketplace_id)}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment