Class: Asset
- Inherits:
-
RestfulModel
- Object
- RestfulModel
- Asset
- Defined in:
- lib/asset.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from RestfulModel
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(parent = nil, file = nil, title = nil, description = nil) ⇒ Asset
constructor
as an alternative to calling Asset.new, you can call populr.images.build.
Methods inherited from RestfulModel
#==, collection_name, #destroy, #inflate, #path, #save!, #update
Constructor Details
#initialize(parent = nil, file = nil, title = nil, description = nil) ⇒ Asset
as an alternative to calling Asset.new, you can call populr.images.build
9 10 11 12 13 14 15 |
# File 'lib/asset.rb', line 9 def initialize(parent = nil, file = nil, title = nil, description = nil) super(parent) @file = file self.title = title self.description = description end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/asset.rb', line 5 def description @description end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/asset.rb', line 6 def title @title end |
Instance Method Details
#as_json(options = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/asset.rb', line 17 def as_json( = {}) hash = super() hash[:file] = @file if [:api_representation] && @file hash end |