Class: Pictify::RenderResult
- Inherits:
-
Object
- Object
- Pictify::RenderResult
- Defined in:
- lib/pictify/types.rb
Overview
Result of a template render (render / render_layouts).
The API returns a results[] envelope. The convenience method url returns the URL of the first rendered item, or nil if nothing rendered.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#template_uid ⇒ Object
readonly
Returns the value of attribute template_uid.
-
#total_errors ⇒ Object
readonly
Returns the value of attribute total_errors.
-
#total_layouts ⇒ Object
readonly
Returns the value of attribute total_layouts.
-
#total_rendered ⇒ Object
readonly
Returns the value of attribute total_rendered.
Instance Method Summary collapse
-
#initialize(data) ⇒ RenderResult
constructor
A new instance of RenderResult.
-
#url ⇒ Object
Convenience accessor: URL of the first rendered item (
results[0].url).
Constructor Details
#initialize(data) ⇒ RenderResult
Returns a new instance of RenderResult.
68 69 70 71 72 73 74 75 76 |
# File 'lib/pictify/types.rb', line 68 def initialize(data) @raw = data @results = (data["results"] || []).map { |r| RenderResultItem.new(r) } @errors = (data["errors"] || []).map { |e| RenderErrorEntry.new(e) } @total_layouts = data["totalLayouts"] @total_rendered = data["totalRendered"] @total_errors = data["totalErrors"] @template_uid = data["templateUid"] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
65 66 67 |
# File 'lib/pictify/types.rb', line 65 def errors @errors end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
65 66 67 |
# File 'lib/pictify/types.rb', line 65 def raw @raw end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
65 66 67 |
# File 'lib/pictify/types.rb', line 65 def results @results end |
#template_uid ⇒ Object (readonly)
Returns the value of attribute template_uid.
65 66 67 |
# File 'lib/pictify/types.rb', line 65 def template_uid @template_uid end |
#total_errors ⇒ Object (readonly)
Returns the value of attribute total_errors.
65 66 67 |
# File 'lib/pictify/types.rb', line 65 def total_errors @total_errors end |
#total_layouts ⇒ Object (readonly)
Returns the value of attribute total_layouts.
65 66 67 |
# File 'lib/pictify/types.rb', line 65 def total_layouts @total_layouts end |
#total_rendered ⇒ Object (readonly)
Returns the value of attribute total_rendered.
65 66 67 |
# File 'lib/pictify/types.rb', line 65 def total_rendered @total_rendered end |
Instance Method Details
#url ⇒ Object
Convenience accessor: URL of the first rendered item (results[0].url).
79 80 81 |
# File 'lib/pictify/types.rb', line 79 def url results.first&.url end |