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.
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/pictify/types.rb', line 192 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.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def created_at @created_at end |
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def engine @engine end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def height @height end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def html @html end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def name @name end |
#output_format ⇒ Object (readonly)
Returns the value of attribute output_format.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def output_format @output_format end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def raw @raw end |
#thumbnail ⇒ Object (readonly)
Returns the value of attribute thumbnail.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def thumbnail @thumbnail end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def uid @uid end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def updated_at @updated_at end |
#variable_definitions ⇒ Object (readonly)
Returns the value of attribute variable_definitions.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def variable_definitions @variable_definitions end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def variables @variables end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
188 189 190 |
# File 'lib/pictify/types.rb', line 188 def width @width end |