plex-ruby
Advanced tools
+56
-48
@@ -1,32 +0,45 @@ | ||
| ## 0.0.1.alpha | ||
| ## 1.5.0 | ||
| * Initial Release | ||
| * Browsing a library works | ||
| * Sending commands to a clients works intermittently, needs lots of work | ||
| * Fixed `first_*` and `last_*` helper methods to compare `index.to_i` instead | ||
| of just `index` (which is a string) | ||
| * Added `#attribute_hash` method to `Episode`, `Show`, `Season`, `Movie`, and | ||
| `Video`. | ||
| ## 0.1.0 | ||
| ## 1.4.0 | ||
| * Gem released of RubyGems | ||
| * Switched from Array#select().first to Array#detect for performance | ||
| * Plex::Season helper methods | ||
| * #first_episode | ||
| * #last_episode | ||
| * Plex::Show helper methods | ||
| * #first_season | ||
| * #last_season | ||
| * #special_season | ||
| * #first_episode | ||
| * #last_episode | ||
| * Updated Readme to use new helper methods | ||
| * Cleaned up docs by adding @private to internal public methods | ||
| ## 0.2.0 | ||
| ## 1.3.1 | ||
| * Added documentation | ||
| * Added bang methods that clears caches | ||
| * Fix naming of 'libary' to 'library' | ||
| * Moved static content into Constants (Wow!\s) | ||
| * Got rid of stdout garbage | ||
| * Fixed `Show#season` not working | ||
| * Added tests | ||
| ## 0.3.0 | ||
| ## 1.3.0 | ||
| * Now allows for multiple servers | ||
| * Fix a misspelling of 'library' that broke the gem (Sorry!) | ||
| * snake_case() -> underscore() | ||
| * Added Plex class method `camalize` | ||
| * Added singular season and episode methods | ||
| * Attribute methods are now dynamically created in the initializer. This gets ride of | ||
| the lazy loading, but allows this gem to grow with Plex without having to update | ||
| the code every time the API changes. | ||
| ## 0.3.1 | ||
| ## 1.2.0 | ||
| * Fix `gem install plex-ruby`, require `open-uri` as a runtime dependency | ||
| wasn't a good idea | ||
| * `Plex::Client#play_media` now can take an Object that `responds_to(:key)` | ||
| ## 1.0.0 | ||
| ## 1.1.1 | ||
| * Added a test suite that can be run with `rake` | ||
| * I feel this a production ready, will continue to add features | ||
| * Fix code breaking bug in 1.1.0 | ||
@@ -40,38 +53,33 @@ ## 1.1.0 | ||
| ## 1.1.1 | ||
| ## 1.0.0 | ||
| * Fix code breaking bug in 1.1.0 | ||
| * Added a test suite that can be run with `rake` | ||
| * I feel this a production ready, will continue to add features | ||
| ## 1.2.0 | ||
| ## 0.3.1 | ||
| * `Plex::Client#play_media` now can take an Object that `responds_to(:key)` | ||
| * Fix `gem install plex-ruby`, require `open-uri` as a runtime dependency | ||
| wasn't a good idea | ||
| ## 1.3.0 | ||
| ## 0.3.0 | ||
| * snake_case() -> underscore() | ||
| * Added Plex class method `camalize` | ||
| * Added singular season and episode methods | ||
| * Attribute methods are now dynamically created in the initializer. This gets ride of | ||
| the lazy loading, but allows this gem to grow with Plex without having to update | ||
| the code every time the API changes. | ||
| * Now allows for multiple servers | ||
| * Fix a misspelling of 'library' that broke the gem (Sorry!) | ||
| ## 1.3.1 | ||
| ## 0.2.0 | ||
| * Got rid of stdout garbage | ||
| * Fixed `Show#season` not working | ||
| * Added tests | ||
| * Added documentation | ||
| * Added bang methods that clears caches | ||
| * Fix naming of 'libary' to 'library' | ||
| * Moved static content into Constants (Wow!\s) | ||
| ## 1.4.0 | ||
| ## 0.1.0 | ||
| * Switched from Array#select().first to Array#detect for performance | ||
| * Plex::Season helper methods | ||
| * #first_episode | ||
| * #last_episode | ||
| * Plex::Show helper methods | ||
| * #first_season | ||
| * #last_season | ||
| * #special_season | ||
| * #first_episode | ||
| * #last_episode | ||
| * Updated Readme to use new helper methods | ||
| * Cleaned up docs by adding @private to internal public methods | ||
| * Gem released of RubyGems | ||
| ## 0.0.1.alpha | ||
| * Initial Release | ||
| * Browsing a library works | ||
| * Sending commands to a clients works intermittently, needs lots of work | ||
@@ -12,2 +12,7 @@ module Plex | ||
| end | ||
| # Returns the attribute hash that represents this Episode | ||
| def attribute_hash | ||
| video.attribute_hash.merge({'key' => key}) | ||
| end | ||
@@ -24,2 +29,10 @@ # Delegates all method calls to the video object that represents this | ||
| def respond_to?(method) | ||
| super || video.respond_to?(method) | ||
| end | ||
| def methods | ||
| (super + video.methods).uniq | ||
| end | ||
| # @private | ||
@@ -26,0 +39,0 @@ def url #:nodoc: |
@@ -13,2 +13,7 @@ module Plex | ||
| # Returns the attribute hash that represents this Movie | ||
| def attribute_hash | ||
| video.attribute_hash.merge({'key' => key}) | ||
| end | ||
| # Delegates all method calls to the video object that represents this | ||
@@ -24,2 +29,10 @@ # movie, if that video object responds to the method. | ||
| def respond_to?(method) | ||
| super || video.respond_to?(method) | ||
| end | ||
| def methods | ||
| (super + video.methods).uniq | ||
| end | ||
| # @private | ||
@@ -26,0 +39,0 @@ def url #:nodoc: |
@@ -8,3 +8,3 @@ module Plex | ||
| attr_reader :show, :key | ||
| attr_reader :show, :key, :attribute_hash | ||
@@ -16,4 +16,6 @@ # @param [Show] show this Season belongs to | ||
| @key = key | ||
| @attribute_hash = {} | ||
| directory.attributes.each do |method, val| | ||
| @attribute_hash[Plex.underscore(method)] = val.value | ||
| define_singleton_method(Plex.underscore(method).to_sym) do | ||
@@ -27,2 +29,4 @@ val.value | ||
| end | ||
| @attribute_hash.merge({'key' => @key}) | ||
| end | ||
@@ -49,3 +53,3 @@ | ||
| def first_episode | ||
| episodes.inject { |a, b| a.index < b.index ? a : b } | ||
| episodes.min_by { |e| e.index.to_i } | ||
| end | ||
@@ -57,3 +61,3 @@ | ||
| def last_episode | ||
| episodes.inject { |a, b| a.index > b.index ? a : b } | ||
| episodes.max_by { |e| e.index.to_i } | ||
| end | ||
@@ -60,0 +64,0 @@ |
@@ -8,3 +8,3 @@ module Plex | ||
| attr_reader :section, :key | ||
| attr_reader :section, :key, :attribute_hash | ||
@@ -16,4 +16,6 @@ # @param [Section] section this show belongs to | ||
| @key = key | ||
| @attribute_hash = {} | ||
| directory.attributes.each do |method, val| | ||
| @attribute_hash[Plex.underscore(method)] = val.value | ||
| define_singleton_method(Plex.underscore(method).to_sym) do | ||
@@ -27,2 +29,4 @@ val.value | ||
| end | ||
| @attribute_hash.merge({'key' => @key}) | ||
| end | ||
@@ -59,3 +63,3 @@ | ||
| def first_season | ||
| seasons.inject { |a, b| a.index < b.index && a.index > 0 ? a : b } | ||
| seasons.inject { |a, b| a.index.to_i < b.index.to_i && a.index.to_i > 0 ? a : b } | ||
| end | ||
@@ -67,3 +71,3 @@ | ||
| def last_season | ||
| seasons.inject { |a, b| a.index > b.index ? a : b } | ||
| seasons.max_by { |s| s.index.to_i } | ||
| end | ||
@@ -70,0 +74,0 @@ |
| module Plex | ||
| VERSION = "1.4.0" | ||
| VERSION = "1.5.0" | ||
| end |
@@ -8,3 +8,3 @@ module Plex | ||
| attr_reader :media, :genres, :writers, :directors, :roles | ||
| attr_reader :media, :genres, :writers, :directors, :roles, :attribute_hash | ||
@@ -14,3 +14,5 @@ # @param [Nokogiri::XML::Element] nokogiri element that represents this | ||
| 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 | ||
@@ -17,0 +19,0 @@ val.value |
+22
-0
@@ -57,2 +57,24 @@ # Plex-Ruby [](https://secure.travis-ci.org/ekosz/Plex-Ruby) | ||
| You can also use the `attribute_hash` method on an object to get a full list of | ||
| attributes. | ||
| ```ruby | ||
| pp episode.attribute_hash | ||
| #=> | ||
| #{"rating_key"=>"23", | ||
| # "key"=>"/library/metadata/23", | ||
| # "guid"=>"com.plexapp.agents.thetvdb://73545/1/13?lang=en", | ||
| # "type"=>"episode", | ||
| # "title"=>"Kobol's Last Gleaming (2)", | ||
| # "summary"=> | ||
| # "When Commander Adama learns that Kara disobeyed orders and Jumped to Caprica on orders from President Roslin, he demands the president's resignation, with the implied threat of a military coup. Roslin refuses his demand and sparks a confrontation.", | ||
| # "index"=>"13", | ||
| # "rating"=>"8.3", | ||
| # "year"=>"2005", | ||
| # "thumb"=>"/library/metadata/23/thumb?t=1323220437", | ||
| # "originally_available_at"=>"2005-01-24", | ||
| # "added_at"=>"1323213639", | ||
| # "updated_at"=>"1323220437"} | ||
| ``` | ||
| For a full list of commands check out the [documentation](http://rubydoc.info/github/ekosz/Plex-Ruby/master/frames). | ||
@@ -59,0 +81,0 @@ |