class Kentico::Kontent::Delivery::Responses::DeliveryLanguageListingResponse

The response of a successful query for project languages.

Public Class Methods

new(headers, body) click to toggle source
Calls superclass method
# 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

Public Instance Methods

languages() click to toggle source

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

# 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() click to toggle source

Parses the 'pagination' JSON node of the response.

# File lib/delivery/responses/delivery_language_listing_response.rb, line 14
def pagination
  @pagination unless @pagination.nil?
  @pagination = Pagination.new @response['pagination']
end