Class: GuideboxWrapper::GuideboxTv
- Inherits:
-
GuideboxApi
- Object
- GuideboxApi
- GuideboxWrapper::GuideboxTv
- Includes:
- TvQueryBuilders
- Defined in:
- lib/GuideboxWrapper/guidebox_tv.rb
Instance Attribute Summary
Attributes inherited from GuideboxApi
Instance Method Summary collapse
- #fetch_tv_show(name_or_id) ⇒ Object
- #fetch_tv_show_by_db_id(id, type) ⇒ Object
-
#search_by_db_id(id, type) ⇒ Object
Search for show by external db id.
-
#search_for(name) ⇒ Object
Search for show.
-
#search_for_by_provider(name, provider) ⇒ Object
Search by provider.
-
#show_information(name) ⇒ Object
Get all tv show info.
Methods included from TvQueryBuilders
#build_query, #search_and_set_url, #set_name_or_id
Methods inherited from GuideboxApi
Constructor Details
This class inherits a constructor from GuideboxWrapper::GuideboxApi
Instance Method Details
#fetch_tv_show(name_or_id) ⇒ Object
73 74 75 76 77 78 79 |
# 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) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# 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) ⇒ Object
Search for show by external db id
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# 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) ⇒ Object
Search for show
8 9 10 11 12 13 14 |
# 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) ⇒ Object
Search by provider
17 18 19 20 21 22 |
# 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) ⇒ Object
Get all tv show info
66 67 68 69 70 71 |
# 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 |