Class: TmdbInfo
- Inherits:
-
Object
- Object
- TmdbInfo
- Defined in:
- lib/dvdprofiler2xbmc/models/tmdb_info.rb
Class Method Summary collapse
-
.find(options) ⇒ Object
Synopsis load data from themovieDb.com see TmdbProfile.all for options.
Instance Method Summary collapse
-
#initialize(profile) ⇒ TmdbInfo
constructor
A new instance of TmdbInfo.
-
#to_xbmc_info ⇒ Object
Synopsis map the tmdb.movie hash into the info hash.
Constructor Details
#initialize(profile) ⇒ TmdbInfo
Returns a new instance of TmdbInfo.
3 4 5 |
# File 'lib/dvdprofiler2xbmc/models/tmdb_info.rb', line 3 def initialize(profile) @profile = profile end |
Class Method Details
.find(options) ⇒ Object
Synopsis
load data from themovieDb.com see TmdbProfile.all for options
10 11 12 13 14 15 16 17 |
# File 'lib/dvdprofiler2xbmc/models/tmdb_info.rb', line 10 def self.find() tmdb_info = nil profile = TmdbProfile.first() unless profile.nil? tmdb_info = TmdbInfo.new(profile) end tmdb_info end |
Instance Method Details
#to_xbmc_info ⇒ Object
Synopsis
map the tmdb.movie hash into the info hash
41 42 43 44 45 46 47 48 49 |
# File 'lib/dvdprofiler2xbmc/models/tmdb_info.rb', line 41 def to_xbmc_info info = Hash.new unless @profile.movie.blank? TMDB_HASH_TO_INFO_MAP.each do |key, value| info[value] = @profile.movie[key].first unless @profile.movie[key].blank? end end info end |