Class: PRX::Model::Piece

Inherits:
Base
  • Object
show all
Includes:
Representer::Full::PieceRepresenter, Roar::JSON
Defined in:
lib/prx/model/piece.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#id

Instance Method Summary collapse

Methods inherited from Base

#class_path_part, #find_by_id, request, #request, #save

Constructor Details

#initialize(*args) ⇒ Piece

Returns a new instance of Piece.



18
19
20
21
22
# File 'lib/prx/model/piece.rb', line 18

def initialize(*args)
  super
  self.audio_versions ||= []
  self.networks ||= []
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def 
  @account
end

#account_idObject

Returns the value of attribute account_id.



11
12
13
# File 'lib/prx/model/piece.rb', line 11

def 
  @account_id
end

#allow_commentsObject

Returns the value of attribute allow_comments.



14
15
16
# File 'lib/prx/model/piece.rb', line 14

def allow_comments
  @allow_comments
end

#audio_versionsObject

Returns the value of attribute audio_versions.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def audio_versions
  @audio_versions
end

#broadcast_historyObject

Returns the value of attribute broadcast_history.



13
14
15
# File 'lib/prx/model/piece.rb', line 13

def broadcast_history
  @broadcast_history
end

#created_atObject

Returns the value of attribute created_at.



11
12
13
# File 'lib/prx/model/piece.rb', line 11

def created_at
  @created_at
end

#creatorObject

Returns the value of attribute creator.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def creator
  @creator
end

#creditsObject

Returns the value of attribute credits.



13
14
15
# File 'lib/prx/model/piece.rb', line 13

def credits
  @credits
end

#descriptionObject

Returns the value of attribute description.



11
12
13
# File 'lib/prx/model/piece.rb', line 11

def description
  @description
end

#episode_dateObject

Returns the value of attribute episode_date.



12
13
14
# File 'lib/prx/model/piece.rb', line 12

def episode_date
  @episode_date
end

#episode_hourObject

Returns the value of attribute episode_hour.



12
13
14
# File 'lib/prx/model/piece.rb', line 12

def episode_hour
  @episode_hour
end

#episode_identifierObject

Returns the value of attribute episode_identifier.



12
13
14
# File 'lib/prx/model/piece.rb', line 12

def episode_identifier
  @episode_identifier
end

#episode_numberObject

Returns the value of attribute episode_number.



12
13
14
# File 'lib/prx/model/piece.rb', line 12

def episode_number
  @episode_number
end

#introObject

Returns the value of attribute intro.



13
14
15
# File 'lib/prx/model/piece.rb', line 13

def intro
  @intro
end

#is_shareableObject

Returns the value of attribute is_shareable.



14
15
16
# File 'lib/prx/model/piece.rb', line 14

def is_shareable
  @is_shareable
end

#languageObject

Returns the value of attribute language.



13
14
15
# File 'lib/prx/model/piece.rb', line 13

def language
  @language
end

#lengthObject

Returns the value of attribute length.



13
14
15
# File 'lib/prx/model/piece.rb', line 13

def length
  @length
end

#licenseObject

Returns the value of attribute license.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def license
  @license
end

#network_onlyObject

Returns the value of attribute network_only.



14
15
16
# File 'lib/prx/model/piece.rb', line 14

def network_only
  @network_only
end

#networksObject

Returns the value of attribute networks.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def networks
  @networks
end

#outroObject

Returns the value of attribute outro.



13
14
15
# File 'lib/prx/model/piece.rb', line 13

def outro
  @outro
end

#point_levelObject

Returns the value of attribute point_level.



14
15
16
# File 'lib/prx/model/piece.rb', line 14

def point_level
  @point_level
end

#produced_onObject

Returns the value of attribute produced_on.



11
12
13
# File 'lib/prx/model/piece.rb', line 11

def produced_on
  @produced_on
end

#producersObject

Returns the value of attribute producers.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def producers
  @producers
end

#promosObject

Returns the value of attribute promos.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def promos
  @promos
end

#publish_on_validObject

Returns the value of attribute publish_on_valid.



16
17
18
# File 'lib/prx/model/piece.rb', line 16

def publish_on_valid
  @publish_on_valid
end

#published_atObject

Returns the value of attribute published_at.



11
12
13
# File 'lib/prx/model/piece.rb', line 11

def published_at
  @published_at
end

Returns the value of attribute related_website.



13
14
15
# File 'lib/prx/model/piece.rb', line 13

def related_website
  @related_website
end

#seriesObject

Returns the value of attribute series.



15
16
17
# File 'lib/prx/model/piece.rb', line 15

def series
  @series
end

#short_descriptionObject

Returns the value of attribute short_description.



11
12
13
# File 'lib/prx/model/piece.rb', line 11

def short_description
  @short_description
end

#titleObject

Returns the value of attribute title.



11
12
13
# File 'lib/prx/model/piece.rb', line 11

def title
  @title
end

Instance Method Details

#add_audio(audio = {}) ⇒ Object



24
25
26
27
28
29
# File 'lib/prx/model/piece.rb', line 24

def add_audio(audio={})
  if self.audio_versions.size < 1
    self.audio_versions << AudioVersion.new(:label=>'Piece Audio')
  end
  self.audio_versions[0].audio_files << AudioFile.new(audio)
end