Class: GuideboxWrapper::GuideboxTv

Inherits:
GuideboxApi show all
Includes:
TvQueryBuilders
Defined in:
lib/GuideboxWrapper/guidebox_tv.rb

Instance Method Summary collapse

Methods included from TvQueryBuilders

#build_query, #search_and_set_url, #set_name_or_id

Methods inherited from GuideboxApi

#initialize, #quota

Constructor Details

This class inherits a constructor from GuideboxWrapper::GuideboxApi

Instance Method Details

#air_day_of_week(name) ⇒ Object

Get air day of the week by show name



132
133
134
135
136
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 132

def air_day_of_week(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["air_day_of_week"]
end

#air_time(name) ⇒ Object

Get air time of the day by show name



139
140
141
142
143
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 139

def air_time(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["air_time"]
end

#background_images(name_or_id) ⇒ Object

Gets all show background images by name or id



223
224
225
226
227
228
229
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 223

def background_images(name_or_id)
  url = @base_url
  id = set_name_or_id(name_or_id)
  url += "/show/" + id.to_s + "/images/backgrounds"
  results = @client.query(url)
  results["results"]["backgrounds"]
end

Gets all show banner images by name or id



214
215
216
217
218
219
220
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 214

def banner_images(name_or_id)
  url = @base_url
  id = set_name_or_id(name_or_id)
  url += "/show/" + id.to_s + "/images/banners"
  results = @client.query(url)
  results["results"]["banners"]
end

#cast(name) ⇒ Object

Get the cast of show by show name



62
63
64
65
66
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 62

def cast(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["cast"]
end

#channel_information(name) ⇒ Object

Get channel information of show by name



97
98
99
100
101
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 97

def channel_information(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["channels"]
end

Get facebook_link by show name



174
175
176
177
178
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 174

def facebook_link(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["social"]["facebook"]["link"]
end

#first_aired(name) ⇒ Object

Get show first aired date by name



83
84
85
86
87
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 83

def first_aired(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["first_aired"]
end

#genres(name) ⇒ Object

Get genres of show by show name ex. Drama, Comedy



111
112
113
114
115
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 111

def genres(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["genres"]
end

#imdb_id(name) ⇒ Object

Get imdb id by show name



153
154
155
156
157
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 153

def imdb_id(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["imdb_id"]
end

Get metacritic link by show name



160
161
162
163
164
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 160

def metacritic_link(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["metacritic"]
end

#network(name) ⇒ Object

Get network aired on, ex HBO



90
91
92
93
94
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 90

def network(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["network"]
end

#overview(name) ⇒ Object

Get overview or description of show by name



125
126
127
128
129
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 125

def overview(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["overview"]
end

#posters(name_or_id) ⇒ Object

Gets all tv show movie posters



196
197
198
199
200
201
202
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 196

def posters(name_or_id)
  url = @base_url
  id = set_name_or_id(name_or_id)
  url += "/show/" + id.to_s + "/images/posters"
  results = @client.query(url)
  results["results"]["posters"]
end

#rating(name) ⇒ Object

Get show rating by name ex. TV-MA



146
147
148
149
150
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 146

def rating(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["rating"]
end

Gets all related tv shows by show id



188
189
190
191
192
193
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 188

def related_shows(name)
  id = self.search_for(name).first["id"]
  url = @base_url
  url += "/show/" + id.to_s + "/related"
  @client.query(url)
end

#runtime(name) ⇒ Object

Get runtime of show by name



104
105
106
107
108
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 104

def runtime(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["runtime"]
end

#search_by_db_id(id, type) ⇒ Object

Search for show by external db id



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 24

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



7
8
9
10
11
12
13
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 7

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



16
17
18
19
20
21
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 16

def search_for_by_provider(name, provider)
  url = build_query(name)
  url += '/fuzzy/' + provider + "/web"
  data = @client.query(url)
  data["results"]
end

#seasons(name) ⇒ Object

Get all seasons of show by name



53
54
55
56
57
58
59
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 53

def seasons(name)
  id = self.search_for(name).first["id"]
  url = @base_url
  url += "/show/" + id.to_s + "/seasons"
  data = @client.query(url)
  data["results"]
end

#show_information(name) ⇒ Object

Get all tv show info



45
46
47
48
49
50
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 45

def show_information(name)
  id = self.search_for(name).first["id"]
  url = @base_url
  url += "/show/" + id.to_s
  @client.query(url)
end

#status(name) ⇒ Object

Get the status of show by name ex. Ended



69
70
71
72
73
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 69

def status(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["status"]
end

#tags(name) ⇒ Object

Get tags of show by name



118
119
120
121
122
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 118

def tags(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["tags"]
end

#thumbnail_images(name_or_id) ⇒ Object

Gets all show thumbnail images by name or id



205
206
207
208
209
210
211
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 205

def thumbnail_images(name_or_id)
  url = @base_url
  id = set_name_or_id(name_or_id)
  url += "/show/" + id.to_s + "/images/thumbnails"
  results = @client.query(url)
  results["results"]["thumbnails"]
end

Get twitter_link by name



181
182
183
184
185
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 181

def twitter_link(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["social"]["twitter"]["link"]
end

#type(name) ⇒ Object

Get type of show by name ex. TV



76
77
78
79
80
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 76

def type(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["type"]
end

#wikipedia_id(name) ⇒ Object

Get wikipedia id by show name



167
168
169
170
171
# File 'lib/GuideboxWrapper/guidebox_tv.rb', line 167

def wikipedia_id(name)
  url = search_and_set_url(name)
  results = @client.query(url)
  results["wikipedia_id"]
end