Class: Kentico::Kontent::Delivery::Responses::DeliveryTaxonomyListingResponse

Inherits:
ResponseBase
  • Object
show all
Defined in:
lib/delivery/responses/delivery_taxonomy_listing_response.rb

Overview

The response of a successful query for taxonomy groups. See github.com/Kentico/kontent-delivery-sdk-ruby#taxonomy

Instance Attribute Summary

Attributes inherited from ResponseBase

#http_code, #json, #message

Instance Method Summary collapse

Methods inherited from ResponseBase

#to_s

Constructor Details

#initialize(response) ⇒ DeliveryTaxonomyListingResponse

Returns a new instance of DeliveryTaxonomyListingResponse.



35
36
37
38
39
40
41
# File 'lib/delivery/responses/delivery_taxonomy_listing_response.rb', line 35

def initialize(response)
  @response = response

  super 200,
        "Success, #{taxonomies.length} taxonomies returned",
        JSON.generate(@response)
end

Instance Method Details

#paginationObject

Parses the ‘pagination’ JSON node of the response.

  • Returns:

    • Kentico::Kontent::Delivery::Pagination



16
17
18
19
# File 'lib/delivery/responses/delivery_taxonomy_listing_response.rb', line 16

def pagination
  @pagination unless @pagination.nil?
  @pagination = Pagination.new @response['pagination']
end

#taxonomiesObject

Parses the ‘taxonomies’ JSON node of the response from a Kentico::Kontent::Delivery::DeliveryClient.taxonomies call.

  • Returns:

    • Array The taxonomy groups as Kentico::Kontent::Delivery::TaxonomyGroup objects



26
27
28
29
30
31
32
33
# File 'lib/delivery/responses/delivery_taxonomy_listing_response.rb', line 26

def taxonomies
  @taxonomies unless @taxonomies.nil?
  taxonomies = []
  @response['taxonomies'].each do |n|
    taxonomies << Kentico::Kontent::Delivery::TaxonomyGroup.new(n)
  end
  @taxonomies = taxonomies
end