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'
}
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 or fail 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.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/peddler/marketplace.rb', line 30

def encoding
  if japanese?
    # Caveat: I've had one instance in the past where Shift_JIS didn't
    # work but Windows-31J did when parsing a report.
    'Shift_JIS'
  elsif chinese?
    'UTF-16'
  else
    'ISO-8859-1'
  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