Method: Magento::RecordCollection.from_magento_response
- Defined in:
- lib/magento/record_collection.rb
.from_magento_response(response, model:, iterable_field: 'items') ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/magento/record_collection.rb', line 38 def from_magento_response(response, model:, iterable_field: 'items') Magento::RecordCollection.new( items: response[iterable_field]&.map { |item| model.build(item) }, total_count: response['total_count'], search_criteria: Magento::SearchCriterium.build(response['search_criteria']) ) end |