Class: Apress::YandexMarket::Readers::Base
- Inherits:
-
Object
- Object
- Apress::YandexMarket::Readers::Base
- Defined in:
- lib/apress/yandex_market/readers/base.rb
Overview
Базовый класс ридеров
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_REGION_ID =
Россия
225- PAGE_SIZE =
максимум сущностей на одной странице в API Яндекс.Маркета
30- SLEEP_TIME =
no more than 2 rps
0.5- RETRY_ATTEMPTS_SLEEP_TIME =
[60, 60, 30, 15, 1].freeze
- RETRY_ATTEMPTS =
RETRY_ATTEMPTS_SLEEP_TIME.size
- RETRY_CODES =
[401, 403, 404, 500, 502, 503, 504].freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Base
constructor
Public: инициализация ридера.
Constructor Details
#initialize(options) ⇒ Base
Public: инициализация ридера
options - Hash, параметры ридера
:region_id - идентификатор региона (необязательный)
:token - токен для доступа к API Яндекс.Маркета
Returns an instance of Readers::Base
32 33 34 35 |
# File 'lib/apress/yandex_market/readers/base.rb', line 32 def initialize() @region_id = .fetch(:region_id, DEFAULT_REGION_ID) @client = Api::Client.new(.fetch(:token)) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
17 18 19 |
# File 'lib/apress/yandex_market/readers/base.rb', line 17 def client @client end |
Class Method Details
.allowed_options ⇒ Object
20 21 22 |
# File 'lib/apress/yandex_market/readers/base.rb', line 20 def %i(token region_id) end |