Class: ABBYY::Cloud::Namespaces::Prices
- Defined in:
- lib/abbyy/cloud/namespaces/prices.rb
Overview
Namespace for operations with prices
Constant Summary collapse
- MAX_PER_REQUEST =
1_000
Instance Method Summary collapse
-
#details(skip: 0, take: nil, **opts) ⇒ Object
Returns prices data filtered by type of translated object, source and target language.
Instance Method Details
#details(skip: 0, take: nil, **opts) ⇒ Object
Returns prices data filtered by type of translated object, source and target language.
If take option is NOT set, the method makes as many requests as necessary to get all prices.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/abbyy/cloud/namespaces/prices.rb', line 16 def details(skip: 0, take: nil, **opts) take_now = (take && take <= MAX_PER_REQUEST) ? take : MAX_PER_REQUEST take_later = take - take_now if take skip_later = skip + take_now items = Operations::Prices.new(settings) .call(skip: skip, take: take_now, **opts) return items if (items.count < take_now) || take_later.zero? items + details(skip: skip_later, take: take_later, **opts) end |