Class: Kentico::Kontent::Delivery::Responses::DeliveryItemListingResponse
- Inherits:
-
ResponseBase
- Object
- ResponseBase
- Kentico::Kontent::Delivery::Responses::DeliveryItemListingResponse
- Defined in:
- lib/delivery/responses/delivery_item_listing_response.rb
Overview
The response of a successful query for content items. See github.com/Kentico/kontent-delivery-sdk-ruby#listing-items
Instance Attribute Summary
Attributes inherited from ResponseBase
Instance Method Summary collapse
-
#initialize(response, content_link_url_resolver, inline_content_item_resolver) ⇒ DeliveryItemListingResponse
constructor
A new instance of DeliveryItemListingResponse.
-
#items ⇒ Object
A collection of Kentico::Kontent::Delivery::ContentItem objects from a Kentico::Kontent::Delivery::DeliveryClient.items call.
-
#pagination ⇒ Object
Parses the ‘pagination’ JSON node of the response.
Methods inherited from ResponseBase
Constructor Details
#initialize(response, content_link_url_resolver, inline_content_item_resolver) ⇒ DeliveryItemListingResponse
Returns a new instance of DeliveryItemListingResponse.
41 42 43 44 45 46 47 48 |
# File 'lib/delivery/responses/delivery_item_listing_response.rb', line 41 def initialize(response, content_link_url_resolver, inline_content_item_resolver) @response = response @content_link_url_resolver = content_link_url_resolver @inline_content_item_resolver = inline_content_item_resolver super 200, "Success, #{items.length} items returned", JSON.generate(@response) end |
Instance Method Details
#items ⇒ Object
A collection of Kentico::Kontent::Delivery::ContentItem objects from a Kentico::Kontent::Delivery::DeliveryClient.items call.
-
Returns:
-
Array
One or more Kentico::Kontent::Delivery::ContentItem objects
-
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/delivery/responses/delivery_item_listing_response.rb', line 26 def items @items unless @items.nil? linked_items_resolver = Kentico::Kontent::Delivery::Resolvers::LinkedItemResolver.new @response['modular_content'], @content_link_url_resolver, @inline_content_item_resolver items = [] @response['items'].each do |n| items << Kentico::Kontent::Delivery::ContentItem.new( n, @content_link_url_resolver, @inline_content_item_resolver, linked_items_resolver ) end @items = items end |
#pagination ⇒ Object
Parses the ‘pagination’ JSON node of the response.
-
Returns:
-
Kentico::Kontent::Delivery::Pagination
-
16 17 18 19 |
# File 'lib/delivery/responses/delivery_item_listing_response.rb', line 16 def pagination @pagination unless @pagination.nil? @pagination = Pagination.new @response['pagination'] end |