Class: Pictify::Template
- Inherits:
-
Object
- Object
- Pictify::Template
- Defined in:
- lib/pictify/types.rb
Overview
Template information returned by get_template / create_template /
list_templates.
The API keys templates by uid (not id) and declares variables in
variableDefinitions (with a legacy flat variables list of names).
Unknown fields are passed through via raw.
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_format ⇒ Object
readonly
Returns the value of attribute output_format.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#thumbnail ⇒ Object
readonly
Returns the value of attribute thumbnail.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#variable_definitions ⇒ Object
readonly
Returns the value of attribute variable_definitions.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(data) ⇒ Template
constructor
A new instance of Template.
Constructor Details
#initialize(data) ⇒ Template
Returns a new instance of Template.
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/pictify/types.rb', line 198 def initialize(data) @raw = data @uid = data["uid"] @name = data["name"] @html = data["html"] @width = data["width"] @height = data["height"] @engine = data["engine"] @output_format = data["outputFormat"] @variables = data["variables"] || [] @variable_definitions = (data["variableDefinitions"] || []).map do |v| TemplateVariableDefinition.new(v) end @thumbnail = data["thumbnail"] @created_at = parse_time(data["createdAt"]) @updated_at = parse_time(data["updatedAt"]) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def created_at @created_at end |
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def engine @engine end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def height @height end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def html @html end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def name @name end |
#output_format ⇒ Object (readonly)
Returns the value of attribute output_format.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def output_format @output_format end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def raw @raw end |
#thumbnail ⇒ Object (readonly)
Returns the value of attribute thumbnail.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def thumbnail @thumbnail end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def uid @uid end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def updated_at @updated_at end |
#variable_definitions ⇒ Object (readonly)
Returns the value of attribute variable_definitions.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def variable_definitions @variable_definitions end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def variables @variables end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
194 195 196 |
# File 'lib/pictify/types.rb', line 194 def width @width end |