Class: Retab::EditTemplate
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::EditTemplate
- Defined in:
- lib/retab/edit_templates/edit_template.rb
Constant Summary collapse
- HASH_ATTRS =
{ id: :id, name: :name, file: :file, form_fields: :form_fields, field_count: :field_count, created_at: :created_at, updated_at: :updated_at }.freeze
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#field_count ⇒ Object
Returns the value of attribute field_count.
-
#file ⇒ Object
Returns the value of attribute file.
-
#form_fields ⇒ Object
Returns the value of attribute form_fields.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ EditTemplate
constructor
A new instance of EditTemplate.
Methods inherited from Types::BaseModel
#inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ EditTemplate
Returns a new instance of EditTemplate.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/retab/edit_templates/edit_template.rb', line 27 def initialize(json) hash = self.class.normalize(json) @id = hash[:id] @name = hash[:name] @file = hash[:file] ? Retab::FileRef.new(hash[:file]) : nil @form_fields = (hash[:form_fields] || []).map { |item| item ? Retab::FormField.new(item) : nil } @field_count = hash[:field_count] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
18 19 20 |
# File 'lib/retab/edit_templates/edit_template.rb', line 18 def created_at @created_at end |
#field_count ⇒ Object
Returns the value of attribute field_count.
18 19 20 |
# File 'lib/retab/edit_templates/edit_template.rb', line 18 def field_count @field_count end |
#file ⇒ Object
Returns the value of attribute file.
18 19 20 |
# File 'lib/retab/edit_templates/edit_template.rb', line 18 def file @file end |
#form_fields ⇒ Object
Returns the value of attribute form_fields.
18 19 20 |
# File 'lib/retab/edit_templates/edit_template.rb', line 18 def form_fields @form_fields end |
#id ⇒ Object
Returns the value of attribute id.
18 19 20 |
# File 'lib/retab/edit_templates/edit_template.rb', line 18 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
18 19 20 |
# File 'lib/retab/edit_templates/edit_template.rb', line 18 def name @name end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
18 19 20 |
# File 'lib/retab/edit_templates/edit_template.rb', line 18 def updated_at @updated_at end |