Class: TMDB::TV

Inherits:
Object
  • Object
show all
Defined in:
lib/tmdb/tv.rb

Class Method Summary collapse

Class Method Details

.id(tv_id) ⇒ Object



16
17
18
19
# File 'lib/tmdb/tv.rb', line 16

def self.id(tv_id)
  options = { api_key: TMDB::API.api_key }
  Hashie::Mash.new(TMDB::API.get("/3/tv/#{tv_id}", query: options))
end

.search(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/tmdb/tv.rb', line 6

def self.search(options = {})
  options.merge!(api_key: TMDB::API.api_key)
  results = TMDB::API.get("/3/search/tv", query: options)['results']
  tv_shows = []
  results.each do |result|
    tv_shows.push(Hashie::Mash.new(result))
  end
  return tv_shows
end