Class: Plex::Video
- Inherits:
-
Object
- Object
- Plex::Video
- Defined in:
- lib/plex-ruby/video.rb
Constant Summary collapse
- ATTRIBUTES =
%w(ratingKey key studio type title titleSort contentRating summary rating viewCount year tagline thumb art duration originallyAvailableAt updatedAt)
Instance Attribute Summary collapse
-
#attribute_hash ⇒ Object
readonly
Returns the value of attribute attribute_hash.
-
#directors ⇒ Object
readonly
Returns the value of attribute directors.
-
#genres ⇒ Object
readonly
Returns the value of attribute genres.
-
#medias ⇒ Object
readonly
Returns the value of attribute medias.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#writers ⇒ Object
readonly
Returns the value of attribute writers.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(node) ⇒ Video
constructor
A new instance of Video.
Constructor Details
#initialize(node) ⇒ Video
Returns a new instance of Video.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/plex-ruby/video.rb', line 12 def initialize(node) @attribute_hash = {} node.attributes.each do |method, val| @attribute_hash[Plex.underscore(method)] = val.value define_singleton_method(Plex.underscore(method).to_sym) do val.value end end @medias = node.search('Media').map { |m| Plex::Media.new(m) } @genres = node.search('Genre').map { |m| Plex::Genre.new(m) } @writers = node.search('Writer').map { |m| Plex::Writer.new(m) } @directors = node.search('Director').map { |m| Plex::Director.new(m) } @roles = node.search('Role').map { |m| Plex::Role.new(m) } end |
Instance Attribute Details
#attribute_hash ⇒ Object (readonly)
Returns the value of attribute attribute_hash.
8 9 10 |
# File 'lib/plex-ruby/video.rb', line 8 def attribute_hash @attribute_hash end |
#directors ⇒ Object (readonly)
Returns the value of attribute directors.
8 9 10 |
# File 'lib/plex-ruby/video.rb', line 8 def directors @directors end |
#genres ⇒ Object (readonly)
Returns the value of attribute genres.
8 9 10 |
# File 'lib/plex-ruby/video.rb', line 8 def genres @genres end |
#medias ⇒ Object (readonly)
Returns the value of attribute medias.
8 9 10 |
# File 'lib/plex-ruby/video.rb', line 8 def medias @medias end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
8 9 10 |
# File 'lib/plex-ruby/video.rb', line 8 def roles @roles end |
#writers ⇒ Object (readonly)
Returns the value of attribute writers.
8 9 10 |
# File 'lib/plex-ruby/video.rb', line 8 def writers @writers end |
Instance Method Details
#==(other) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/plex-ruby/video.rb', line 29 def ==(other) if other.is_a? Video key == other.key else super end end |