Class: Peddler::Marketplace Private

Inherits:
Object
  • Object
show all
Defined in:
lib/peddler/marketplace.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

HOSTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  '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',
  'A1AM78C64UM0Y8' => 'mws.amazonservices.com.mx',
  'ATVPDKIKX0DER'  => 'mws.amazonservices.com'
}.freeze
BadId =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Marketplace

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Marketplace.



22
23
24
# File 'lib/peddler/marketplace.rb', line 22

def initialize(id)
  @id = id || raise(BadId, 'missing MarketplaceId')
end

Instance Attribute Details

#idObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/peddler/marketplace.rb', line 20

def id
  @id
end

Instance Method Details

#encodingObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Caveat: We use the supersets Windows-31J and CP1252 in place of Shift_JIS and ISO 8859-1 respectively to handle edge cases where latter will not support some characters. The supersets should be safe to use as drop-in replacements.



34
35
36
37
38
39
40
41
42
# File 'lib/peddler/marketplace.rb', line 34

def encoding
  if japanese?
    'Windows-31J'
  elsif chinese?
    'UTF-16'
  else
    'CP1252'
  end
end

#hostObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
# File 'lib/peddler/marketplace.rb', line 26

def host
  @host ||= find_host
end