Class: ReveAI::LayoutResponse
- Defined in:
- lib/reve_ai/response.rb
Overview
Response wrapper for layout-only API responses.
Returned by the v2 extract_layout and create_layout endpoints, which produce a layout object but no image. Accessors fall back to the X-Reve-* headers when the body carries no value.
Instance Attribute Summary
Attributes inherited from Response
Instance Method Summary collapse
-
#content_violation? ⇒ Boolean
Checks if the request violates content policy.
-
#credits_remaining ⇒ Integer?
Returns the number of credits remaining after this request.
-
#credits_used ⇒ Integer?
Returns the number of credits used for this request.
-
#layout ⇒ Hash?
Returns the layout object.
Methods inherited from Response
#binary?, #initialize, #request_id, #success?
Constructor Details
This class inherits a constructor from ReveAI::Response
Instance Method Details
#content_violation? ⇒ Boolean
Checks if the request violates content policy.
208 209 210 211 |
# File 'lib/reve_ai/response.rb', line 208 def content_violation? body_value(:content_violation) == true || headers["x-reve-content-violation"] == "true" end |
#credits_remaining ⇒ Integer?
Returns the number of credits remaining after this request.
223 224 225 |
# File 'lib/reve_ai/response.rb', line 223 def credits_remaining body_value(:credits_remaining) || headers["x-reve-credits-remaining"]&.to_i end |
#credits_used ⇒ Integer?
Returns the number of credits used for this request.
216 217 218 |
# File 'lib/reve_ai/response.rb', line 216 def credits_used body_value(:credits_used) || headers["x-reve-credits-used"]&.to_i end |
#layout ⇒ Hash?
Returns the layout object.
201 202 203 |
# File 'lib/reve_ai/response.rb', line 201 def layout body_value(:layout) end |