Class: Peddler::Client
- Inherits:
-
Object
- Object
- Peddler::Client
- Extended by:
- Forwardable
- Includes:
- Jeff
- Defined in:
- lib/peddler/client.rb
Direct Known Subclasses
MWS::Feeds::Client, MWS::FulfillmentInboundShipment::Client, MWS::FulfillmentInventory::Client, MWS::FulfillmentOutboundShipment::Client, MWS::OffAmazonPayments::Client, MWS::Orders::Client, MWS::Products::Client, MWS::Recommendations::Client, MWS::Reports::Client, MWS::Sellers::Client, MWS::Subscriptions::Client
Constant Summary collapse
- HOSTS =
{ 'CA' => 'mws.amazonservices.ca', 'CN' => 'mws.amazonservices.com.cn', 'DE' => 'mws-eu.amazonservices.com', 'ES' => 'mws-eu.amazonservices.com', 'FR' => 'mws-eu.amazonservices.com', 'GB' => 'mws-eu.amazonservices.com', 'IN' => 'mws.amazonservices.in', 'IT' => 'mws-eu.amazonservices.com', 'JP' => 'mws.amazonservices.jp', 'US' => 'mws.amazonservices.com' }
- MARKETPLACE_IDS =
{ 'CA' => 'A2EUQ1WTGCTBG2', 'CN' => 'AAHKV2X7AFYLW', 'DE' => 'A1PA6795UKMFR9', 'ES' => 'A1RKKUPIHCS9HS', 'FR' => 'A13V1IB3VIYZZH', 'GB' => 'A1F83G8C2ARO7P', 'IN' => 'A21TJRUUN4KGV', 'IT' => 'APJ6JRA9NG5V4', 'JP' => 'A1VC38T7YXB528', 'US' => 'ATVPDKIKX0DER' }
Instance Attribute Summary collapse
-
#default_country ⇒ Object
Returns the value of attribute default_country.
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
Class Method Summary collapse
Instance Method Summary collapse
- #aws_endpoint ⇒ Object
-
#initialize(default_country = nil, aws_access_key_id = nil, aws_secret_access_key = nil, merchant_id = nil) ⇒ Client
constructor
A new instance of Client.
- #marketplace_id(country = default_country) ⇒ Object
Constructor Details
#initialize(default_country = nil, aws_access_key_id = nil, aws_secret_access_key = nil, merchant_id = nil) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 |
# File 'lib/peddler/client.rb', line 11 def initialize(default_country = nil, aws_access_key_id = nil, aws_secret_access_key = nil, merchant_id = nil) @default_country = default_country @aws_access_key_id = aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] @aws_secret_access_key = aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY'] @merchant_id = merchant_id || ENV['MERCHANT_ID'] end |
Instance Attribute Details
#default_country ⇒ Object
Returns the value of attribute default_country.
9 10 11 |
# File 'lib/peddler/client.rb', line 9 def default_country @default_country end |
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
9 10 11 |
# File 'lib/peddler/client.rb', line 9 def merchant_id @merchant_id end |
Class Method Details
.inherited(base) ⇒ Object
48 49 50 |
# File 'lib/peddler/client.rb', line 48 def self.inherited(base) base.params(params) end |
.path(path = nil) ⇒ Object
44 45 46 |
# File 'lib/peddler/client.rb', line 44 def self.path(path = nil) path ? @path = path : @path end |
Instance Method Details
#aws_endpoint ⇒ Object
54 55 56 |
# File 'lib/peddler/client.rb', line 54 def aws_endpoint "https://#{HOSTS.fetch(default_country)}/#{self.class.path}" end |
#marketplace_id(country = default_country) ⇒ Object
58 59 60 |
# File 'lib/peddler/client.rb', line 58 def marketplace_id(country = default_country) MARKETPLACE_IDS.fetch(country) end |