Class: Kentico::Kontent::Delivery::Responses::DeliveryTaxonomyListingResponse
- Inherits:
-
ResponseBase
- Object
- ResponseBase
- Kentico::Kontent::Delivery::Responses::DeliveryTaxonomyListingResponse
- 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
Instance Method Summary collapse
-
#initialize(response) ⇒ DeliveryTaxonomyListingResponse
constructor
A new instance of DeliveryTaxonomyListingResponse.
-
#pagination ⇒ Object
Parses the ‘pagination’ JSON node of the response.
-
#taxonomies ⇒ Object
Parses the ‘taxonomies’ JSON node of the response from a Kentico::Kontent::Delivery::DeliveryClient.taxonomies call.
Methods inherited from ResponseBase
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
#pagination ⇒ Object
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 |
#taxonomies ⇒ Object
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 |