Class: TmdbInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/dvdprofiler2xbmc/models/tmdb_info.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(options) ⇒ Object

Synopsis

load data from themovieDb.com see TmdbProfile.all for options


14
15
16
17
18
19
20
21
# File 'lib/dvdprofiler2xbmc/models/tmdb_info.rb', line 14

def self.find(options)
  tmdb_info = nil
  profile = TmdbProfile.first(options)
  unless profile.nil?
    tmdb_info = TmdbInfo.new(profile)
  end
  tmdb_info
end

Instance Method Details

#to_xbmc_infoObject

Synopsis

map the tmdb.movie hash into the info hash


45
46
47
48
49
50
51
52
53
# File 'lib/dvdprofiler2xbmc/models/tmdb_info.rb', line 45

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