Class: Kentico::Kontent::Delivery::Responses::DeliveryElementResponse
- Inherits:
-
ResponseBase
- Object
- ResponseBase
- Kentico::Kontent::Delivery::Responses::DeliveryElementResponse
- Defined in:
- lib/delivery/responses/delivery_element_response.rb
Overview
The response of a successful query of a content type’s element See github.com/Kentico/kontent-delivery-sdk-ruby#retrieving-content-type-elements
Instance Attribute Summary
Attributes inherited from ResponseBase
Instance Method Summary collapse
-
#element ⇒ Object
An element’s definition from a Kentico::Kontent::Delivery::DeliveryClient.element call.
-
#initialize(response) ⇒ DeliveryElementResponse
constructor
A new instance of DeliveryElementResponse.
Methods inherited from ResponseBase
Constructor Details
#initialize(response) ⇒ DeliveryElementResponse
Returns a new instance of DeliveryElementResponse.
23 24 25 26 27 28 |
# File 'lib/delivery/responses/delivery_element_response.rb', line 23 def initialize(response) @response = response super 200, "Success, '#{element.codename}' returned", JSON.generate(@response) end |
Instance Method Details
#element ⇒ Object
An element’s definition from a Kentico::Kontent::Delivery::DeliveryClient.element call
-
Returns:
-
OpenStruct
The element of a content item
-
15 16 17 18 19 20 21 |
# File 'lib/delivery/responses/delivery_element_response.rb', line 15 def element @element unless @element.nil? @element = JSON.parse( JSON.generate(@response), object_class: OpenStruct ) end |