Class: Kontent::Ai::Delivery::Responses::ResponseBase
- Inherits:
-
Object
- Object
- Kontent::Ai::Delivery::Responses::ResponseBase
- Defined in:
- lib/delivery/responses/response_base.rb
Overview
Base class for all responses from a Kontent::Ai::Delivery::DeliveryQuery.execute call.
Direct Known Subclasses
DeliveryElementResponse, DeliveryItemListingResponse, DeliveryItemResponse, DeliveryItemsFeedResponse, DeliveryLanguageListingResponse, DeliveryTaxonomyListingResponse, DeliveryTaxonomyResponse, DeliveryTypeListingResponse, DeliveryTypeResponse
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_code ⇒ Object
Returns the value of attribute http_code.
-
#json ⇒ Object
Returns the value of attribute json.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(http_code, message, headers = {}, json = '') ⇒ ResponseBase
constructor
Constructor.
-
#to_s ⇒ Object
Provides an informative message about the success of the request by combining the status code and message.
Constructor Details
#initialize(http_code, message, headers = {}, json = '') ⇒ ResponseBase
Constructor.
-
Args:
- http_code (+integer+) The status code returned by the REST request
- message (+string+) An informative message about the response, visible when calling
to_s - headers (+hash+) optional The headers of the REST response
- json (+string+) optional The complete, unmodified JSON response from the server
20 21 22 23 24 25 |
# File 'lib/delivery/responses/response_base.rb', line 20 def initialize(http_code, , headers = {}, json = '') self.http_code = http_code self. = self.headers = headers self.json = json end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
8 9 10 |
# File 'lib/delivery/responses/response_base.rb', line 8 def headers @headers end |
#http_code ⇒ Object
Returns the value of attribute http_code.
8 9 10 |
# File 'lib/delivery/responses/response_base.rb', line 8 def http_code @http_code end |
#json ⇒ Object
Returns the value of attribute json.
8 9 10 |
# File 'lib/delivery/responses/response_base.rb', line 8 def json @json end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/delivery/responses/response_base.rb', line 8 def end |
Instance Method Details
#to_s ⇒ Object
Provides an informative message about the success of the request by combining the status code and message.
-
Returns:
string
32 33 34 |
# File 'lib/delivery/responses/response_base.rb', line 32 def to_s "Response is status code #{http_code} with message:\n#{message}" end |