Class: Asset

Inherits:
RestfulModel show all
Defined in:
lib/asset.rb

Instance Attribute Summary collapse

Attributes inherited from RestfulModel

#_id, #created_at

Instance Method Summary collapse

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

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/asset.rb', line 5

def description
  @description
end

#titleObject

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(options = {})
  hash = super(options)
  hash[:file] = @file if options[:api_representation] && @file
  hash
end