Class: TivoHMO::Adapters::Plex::Season
- Inherits:
-
Object
- Object
- TivoHMO::Adapters::Plex::Season
- Includes:
- GemLogger::LoggerSupport, MonitorMixin, TivoHMO::API::Container
- Defined in:
- lib/tivohmo/adapters/plex/season.rb
Instance Attribute Summary collapse
-
#delegate ⇒ Object
readonly
Returns the value of attribute delegate.
Attributes included from TivoHMO::API::Container
Attributes included from TivoHMO::API::Node
#app, #content_type, #created_at, #identifier, #modified_at, #parent, #root, #source_format, #title
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(delegate) ⇒ Season
constructor
A new instance of Season.
Methods included from TivoHMO::API::Container
Methods included from TivoHMO::API::Node
#add_child, #app?, #find, #root?, #title_path, #to_s, #tree_string
Constructor Details
#initialize(delegate) ⇒ Season
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tivohmo/adapters/plex/season.rb', line 12 def initialize(delegate) # delegate is a Plex::Season @delegate = delegate super(delegate.key) self.title = delegate.title self.modified_at = Time.at(delegate.updated_at.to_i) rescue nil self.created_at = Time.at(delegate.added_at.to_i) rescue nil end |
Instance Attribute Details
#delegate ⇒ Object (readonly)
Returns the value of attribute delegate.
10 11 12 |
# File 'lib/tivohmo/adapters/plex/season.rb', line 10 def delegate @delegate end |
Instance Method Details
#children ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tivohmo/adapters/plex/season.rb', line 23 def children synchronize do if super.blank? Array(delegate.episodes).each do |media| add_child(Episode.new(media)) end end end super end |