Class: Kentico::Kontent::Delivery::Responses::DeliveryLanguageListingResponse
- Inherits:
-
ResponseBase
- Object
- ResponseBase
- Kentico::Kontent::Delivery::Responses::DeliveryLanguageListingResponse
- Defined in:
- lib/delivery/responses/delivery_language_listing_response.rb
Overview
The response of a successful query for project languages.
Instance Attribute Summary
Attributes inherited from ResponseBase
#headers, #http_code, #json, #message
Instance Method Summary collapse
-
#initialize(headers, body) ⇒ DeliveryLanguageListingResponse
constructor
A new instance of DeliveryLanguageListingResponse.
-
#languages ⇒ Object
Parses the ‘languages’ JSON node of the response from a Kentico::Kontent::Delivery::DeliveryClient.languages call.
-
#pagination ⇒ Object
Parses the ‘pagination’ JSON node of the response.
Methods inherited from ResponseBase
Constructor Details
#initialize(headers, body) ⇒ DeliveryLanguageListingResponse
Returns a new instance of DeliveryLanguageListingResponse.
33 34 35 36 37 38 39 |
# File 'lib/delivery/responses/delivery_language_listing_response.rb', line 33 def initialize(headers, body) @response = JSON.parse(body) super 200, "Success, #{languages.length} languages returned", headers, JSON.generate(@response) end |
Instance Method Details
#languages ⇒ Object
Parses the ‘languages’ JSON node of the response from a Kentico::Kontent::Delivery::DeliveryClient.languages call.
-
Returns:
-
Array
The content types as Kentico::Kontent::Delivery::Language objects
-
24 25 26 27 28 29 30 31 |
# File 'lib/delivery/responses/delivery_language_listing_response.rb', line 24 def languages @languages unless @languages.nil? languages = [] @response['languages'].each do |n| languages << Kentico::Kontent::Delivery::Language.new(n) end @languages = languages end |
#pagination ⇒ Object
Parses the ‘pagination’ JSON node of the response.
-
Returns:
-
Kentico::Kontent::Delivery::Pagination
-
14 15 16 17 |
# File 'lib/delivery/responses/delivery_language_listing_response.rb', line 14 def pagination @pagination unless @pagination.nil? @pagination = Pagination.new @response['pagination'] end |