class GuideboxWrapper::GuideboxTv

Public Instance Methods

fetch_tv_show(name_or_id) click to toggle source
# File lib/GuideboxWrapper/guidebox_tv.rb, line 73
def fetch_tv_show(name_or_id)
  url = @base_url
  id = set_name_or_id(name_or_id)
  url += "/show/" + id.to_s
  results = @client.query(url)
  Tv.new(results)
end
fetch_tv_show_by_db_id(id, type) click to toggle source
# File lib/GuideboxWrapper/guidebox_tv.rb, line 45
def fetch_tv_show_by_db_id(id, type)
  url = @base_url + "/search/id/"
  case type
  when "tvdb"
    url += "tvdb/" + id.to_s
  when "themoviedb"
    url += "themoviedb/" + id.to_s
  when "imdb"
    url += "imdb/" + id
  else
    puts "That id type does not exist"
    return
  end
  id = @client.query(url)["id"]
  url = @base_url
  url += "/show/" + id.to_s
  results = @client.query(url)
  Tv.new(results)
end
search_by_db_id(id, type) click to toggle source

Search for show by external db id

# File lib/GuideboxWrapper/guidebox_tv.rb, line 25
def search_by_db_id(id, type)
  url = @base_url
  url += "/search/id/"
  case type
  when "tvdb"
    url += "tvdb/"
    url += id.to_s
  when "themoviedb"
    url += "themoviedb/"
    url += id.to_s
  when "imdb"
    url += "imdb/"
    url += id
  else
    puts "That id type does not exist"
    return
  end
  @client.query(url)
end
search_for(name) click to toggle source

Search for show

# File lib/GuideboxWrapper/guidebox_tv.rb, line 8
def search_for(name)
  url = build_query(name)
  url += '/fuzzy/web'
  data = @client.query(url)
  sleep(1)
  data["results"]
end
search_for_by_provider(name, provider) click to toggle source

Search by provider

# File lib/GuideboxWrapper/guidebox_tv.rb, line 17
def search_for_by_provider(name, provider)
  url = build_query(name)
  url += '/fuzzy/' + provider + "/web"
  data = @client.query(url)
  data["results"]
end
show_information(name) click to toggle source

Get all tv show info

# File lib/GuideboxWrapper/guidebox_tv.rb, line 66
def show_information(name)
  id = self.search_for(name).first["id"]
  url = @base_url
  url += "/show/" + id.to_s
  @client.query(url)
end