Class: Pictify::Template

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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_atObject (readonly)

Returns the value of attribute created_at.



188
189
190
# File 'lib/pictify/types.rb', line 188

def created_at
  @created_at
end

#engineObject (readonly)

Returns the value of attribute engine.



188
189
190
# File 'lib/pictify/types.rb', line 188

def engine
  @engine
end

#heightObject (readonly)

Returns the value of attribute height.



188
189
190
# File 'lib/pictify/types.rb', line 188

def height
  @height
end

#htmlObject (readonly)

Returns the value of attribute html.



188
189
190
# File 'lib/pictify/types.rb', line 188

def html
  @html
end

#nameObject (readonly)

Returns the value of attribute name.



188
189
190
# File 'lib/pictify/types.rb', line 188

def name
  @name
end

#output_formatObject (readonly)

Returns the value of attribute output_format.



188
189
190
# File 'lib/pictify/types.rb', line 188

def output_format
  @output_format
end

#rawObject (readonly)

Returns the value of attribute raw.



188
189
190
# File 'lib/pictify/types.rb', line 188

def raw
  @raw
end

#thumbnailObject (readonly)

Returns the value of attribute thumbnail.



188
189
190
# File 'lib/pictify/types.rb', line 188

def thumbnail
  @thumbnail
end

#uidObject (readonly)

Returns the value of attribute uid.



188
189
190
# File 'lib/pictify/types.rb', line 188

def uid
  @uid
end

#updated_atObject (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_definitionsObject (readonly)

Returns the value of attribute variable_definitions.



188
189
190
# File 'lib/pictify/types.rb', line 188

def variable_definitions
  @variable_definitions
end

#variablesObject (readonly)

Returns the value of attribute variables.



188
189
190
# File 'lib/pictify/types.rb', line 188

def variables
  @variables
end

#widthObject (readonly)

Returns the value of attribute width.



188
189
190
# File 'lib/pictify/types.rb', line 188

def width
  @width
end