class Kentico::Kontent::Delivery::Responses::DeliveryItemsFeedResponse

The response of a successful query for content items.

Public Class Methods

new(headers, body, query) click to toggle source
Calls superclass method
# File lib/delivery/responses/delivery_items_feed_response.rb, line 31
def initialize(headers, body, query)
  @query = query
  @response = JSON.parse(body)
  @content_link_url_resolver = query.content_link_url_resolver
  @inline_content_item_resolver = query.inline_content_item_resolver
  super 200,
    "Success, #{items.length} items returned",
    headers,
    JSON.generate(@response)
end

Public Instance Methods

continuation_token() click to toggle source
# File lib/delivery/responses/delivery_items_feed_response.rb, line 51
def continuation_token
  headers[Kentico::Kontent::Delivery::DeliveryQuery::HEADER_CONTINUATION]
end
items() click to toggle source

A collection of Kentico::Kontent::Delivery::ContentItem objects from a Kentico::Kontent::Delivery::DeliveryClient.items_feed call.

# File lib/delivery/responses/delivery_items_feed_response.rb, line 16
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
more_results?() click to toggle source
# File lib/delivery/responses/delivery_items_feed_response.rb, line 47
def more_results?
  !continuation_token.nil?
end
next_result() click to toggle source
# File lib/delivery/responses/delivery_items_feed_response.rb, line 42
def next_result
  @query.update_continuation continuation_token
  @query.execute
end