Class: Vacuum::Endpoint::MWS

Inherits:
Base
  • Object
show all
Defined in:
lib/vacuum/endpoint/mws.rb

Overview

A Marketplace Web Services (MWS) API endpoint.

Constant Summary collapse

HOSTS =

A list of MWS API 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',
  'IT' => 'mws-eu.amazonservices.com',
  'JP' => 'mws.amazonservices.jp',
  'UK' => 'mws-eu.amazonservices.com',
  'US' => 'mws.amazonservices.com'
}

Constants inherited from Base

Base::LOCALES

Instance Attribute Summary collapse

Attributes inherited from Base

#key, #locale, #secret

Instance Method Summary collapse

Methods inherited from Base

#user_agent

Instance Attribute Details

#apiObject

Internal: Gets/Sets the Symbol MWS API type.



19
20
21
# File 'lib/vacuum/endpoint/mws.rb', line 19

def api
  @api
end

#marketplaceObject

Sets the String marketplace ID.

Raises a Missing Marketplace error if marketplace ID is missing.



29
30
31
# File 'lib/vacuum/endpoint/mws.rb', line 29

def marketplace
  @marketplace or raise MissingMarketplace
end

#sellerObject

Sets the String seller ID.

Raises a Missing Seller error if seller ID is missing.



51
52
53
# File 'lib/vacuum/endpoint/mws.rb', line 51

def seller
  @seller or raise MissingSeller
end

Instance Method Details

#hostObject

Returns a String MWS API host.



22
23
24
# File 'lib/vacuum/endpoint/mws.rb', line 22

def host
  HOSTS[locale]
end

#pathObject

Returns a String MWS API URL path.

Raises a Not Implemented Error if API is not implemented.



39
40
41
42
43
44
45
46
# File 'lib/vacuum/endpoint/mws.rb', line 39

def path
  case api
  when :products
    '/Products/2011-10-01'
  else
    raise NotImplementedError
  end
end