class Kentico::Kontent::Delivery::Responses::DeliveryTypeListingResponse

The response of a successful query for content types. See github.com/Kentico/kontent-delivery-sdk-ruby#retrieving-content-types

Public Class Methods

new(response) click to toggle source
Calls superclass method
# File lib/delivery/responses/delivery_type_listing_response.rb, line 35
def initialize(response)
  @response = response
  super 200,
        "Success, #{types.length} types returned",
        JSON.generate(@response)
end

Public Instance Methods

pagination() click to toggle source

Parses the 'pagination' JSON node of the response.

# File lib/delivery/responses/delivery_type_listing_response.rb, line 16
def pagination
  @pagination unless @pagination.nil?
  @pagination = Pagination.new @response['pagination']
end
types() click to toggle source

Parses the 'types' JSON node of the response from a Kentico::Kontent::Delivery::DeliveryClient.types call.

# File lib/delivery/responses/delivery_type_listing_response.rb, line 26
def types
  @types unless @types.nil?
  types = []
  @response['types'].each do |n|
    types << Kentico::Kontent::Delivery::ContentType.new(n)
  end
  @types = types
end