Class: Moysklad::Resources::Indexed
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Moysklad::Resources::Indexed
- Includes:
- IndexedCache, LoadAll, WhereFilter
- Defined in:
- lib/moysklad/resources/indexed.rb
Direct Known Subclasses
Constant Summary collapse
- WrongEntriesCountError =
Class.new StandardError
- NoIdInEntity =
Class.new StandardError
Instance Method Summary collapse
-
#all(params = {}) ⇒ Array of Moysklad::Entities::Base
Автоматически подгружает постранично данныез из API и возвращает их все сразу.
-
#find(id) ⇒ Object
Возвращает запрашивемую запись из кеша.
-
#initialize(resource) ⇒ Indexed
constructor
A new instance of Indexed.
-
#resource ⇒ Object
Неиндексированный ресурс.
-
#uuids ⇒ Array of uuids
Перечень id-ов всех элементов в ресуресе.
Methods included from IndexedCache
Methods included from LoadAll
Methods included from WhereFilter
Constructor Details
Instance Method Details
#all(params = {}) ⇒ Array of Moysklad::Entities::Base
Автоматически подгружает постранично данныез из API и возвращает их все сразу.
18 19 20 21 22 |
# File 'lib/moysklad/resources/indexed.rb', line 18 def all(params = {}) cache_fetch do pull_list(params) end end |
#find(id) ⇒ Object
Возвращает запрашивемую запись из кеша. Предварительно подгружает все записи через метод ‘all`
28 29 30 |
# File 'lib/moysklad/resources/indexed.rb', line 28 def find id index[id] end |
#resource ⇒ Object
Неиндексированный ресурс
42 43 44 |
# File 'lib/moysklad/resources/indexed.rb', line 42 def resource __getobj__ end |
#uuids ⇒ Array of uuids
Перечень id-ов всех элементов в ресуресе
35 36 37 |
# File 'lib/moysklad/resources/indexed.rb', line 35 def uuids index.keys end |