GuideboxWrapper 0.1.0 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 781382e9ef5bb0f587c224c9b8bb1c4aa8e80264
4
- data.tar.gz: ab6bdad42303169407dcc08a089d6622d841d54e
3
+ metadata.gz: b110d54ad7e5d03c6bc17577230a8327eba185d2
4
+ data.tar.gz: 1012d54f76d45c5a1781562a2f04839d31f874fe
5
5
  SHA512:
6
- metadata.gz: 854b11bc754973e7ed5908a0293a3c9c7bd416943d37433e39f1156271f0c322d5b3e989ba621eb06a55e922ab100a5d8488dd0234bb8d30e62bd117c467f0d1
7
- data.tar.gz: 98860e92bf0c9c856c66c492f1df28eda5e41de7605748c89c5cb194c1d14256cf45070ab778cdc89818c1c9be5c64eab39dbe40c86e15048d1fcaf28f469409
6
+ metadata.gz: f2e9ea8060bbc54540bf08fbfe1f832edae3f97a6e9eda6d0415ca57d8cc89cb849cc8ec6435c02efe6741178ad28fa15498c9a58ffc1d1694803fb9505e707f
7
+ data.tar.gz: 71827204f15785a63d8d9484a1107cb2e24e220d2992a955d6af16885059c76cc08be2f86a08504f95a81c68901d18476f5463865f82efd744f754a87c1359aa
data/README.md CHANGED
@@ -31,19 +31,19 @@ To use this gem you must first register for a personal API key on Guidebox's web
31
31
  The API helpers throughout this gem can be called on either Tv or Movie objects. These objects can be initialized by doing the following:
32
32
 
33
33
  ```ruby
34
- GuideboxWrapper::Tv.new("YOUR_API_KEY", "region") # region can be "all", "US" (United States), "GB" (Great Britain), etc
34
+ GuideboxWrapper::GuideboxTv.new("YOUR_API_KEY", "region") # region can be "all", "US" (United States), "GB" (Great Britain), etc
35
35
 
36
- GuideboxWrapper::Movie.new("YOUR_API_KEY", "region") # region can be "all", "US" (United States), "GB" (Great Britain), etc
36
+ GuideboxWrapper::GuideboxMovie.new("YOUR_API_KEY", "region") # region can be "all", "US" (United States), "GB" (Great Britain), etc
37
37
  ```
38
38
 
39
39
  Keep in mind that Guidebox has some restrictions on the amount of API calls that can be made per month and per second. The API is limited to 100,000 API calls a month and 1 API call per second. The monthy limit of 100,000 resets on the 1st of every month. To check the amont of API calls you have made in the current month use the quota helper. It can be called on either a GuideboxWrapper::Movie Or GuideboxWrapper::Tv object as follows:
40
40
 
41
41
  ```ruby
42
- tv = GuideboxWrapper::Tv.new("YOUR_API_KEY", "region")
42
+ tv = GuideboxWrapper::GuideboxTv.new("YOUR_API_KEY", "region")
43
43
  tv.quota
44
44
  # => 5500
45
45
 
46
- movie = GuideboxWrapper::Movie.new("YOUR_API_KEY", "region")
46
+ movie = GuideboxWrapper::GuideboxMovie.new("YOUR_API_KEY", "region")
47
47
  movie.quota
48
48
  # => 5500
49
49
  ```
@@ -52,11 +52,13 @@ Here are all the helper methods within this wrapper for the Movie and Tv classes
52
52
  #### Movie Helpers
53
53
 
54
54
  ```ruby
55
- guidebox_movie = GuideboxWrapper::Movie.new("YOUR_API_KEY", "region")
55
+ guidebox_movie = GuideboxWrapper::GuideboxMovie.new("YOUR_API_KEY", "region")
56
56
 
57
+ # Returns an array of results in search by movie title
57
58
  guidebox_movie.search_for("star wars a new hope")
58
59
  # => [{"id"=>55413, "title"=>"Star Wars: Episode IV: A New Hope", "release_year"=>1977, "themoviedb"=>11, ...}]
59
60
 
61
+ # Returns an array of results in search by movie title and provider
60
62
  guidebox_movie.search_for_by_provider("star wars a new hope", "amazon_prime")
61
63
  # => [{"id"=>55413, "title"=>"Star Wars: Episode IV: A New Hope", "release_year"=>1977, "themoviedb"=>11, ...}]
62
64
 
@@ -66,69 +68,6 @@ guidebox_movie.search_by_db_id(11, "themoviedb")
66
68
  guidebox_movie.show_information("star wars a new hope")
67
69
  # => {"id"=>55413, "title"=>"Star Wars: Episode IV: A New Hope", "release_year"=>1977, "themoviedb"=>11, "alternate_titles"=>["Star Wars", "Star Wars Episode IV - A New Hope", "Star Wars Episode 4 - A New Hope", "Star Wars Episode IV", "Star Wars 4", "Star Wars: Episode IV - A New Hope - Despecialized Edition", "Star Wars Episode IV: A New Hope", "Star Wars: Episode IV - A New Hope", "Star Wars: A New Hope", "Star Wars: A New Hope (Bonus Features)"], "imdb"=>"tt0076759", "pre_order"=>false, "release_date"=>"1977-05-25", "rating"=>"PG", "rottentomatoes"=>11292, "freebase"=>"/m/0dtfn", "wikipedia_id"=>52549, "metacritic"=>"http://www.metacritic.com/movie/star-wars-episode-iv---a-new-hope", "common_sense_media"=>nil, "overview"=>"Princess Leia is captured and held hostage by the evil Imperial forces in their effort to take over the galactic Empire. Venturesome Luke Skywalker and dashing captain Han Solo team together with the loveable robot duo R2-D2 and C-3PO to rescue the beautiful princess and restore peace and justice in the Empire.", ...}
68
70
 
69
- guidebox_movie.cast("star wars a new hope")
70
- # => [{"id"=>300791, "name"=>"Mark Hamill", "character_name"=>"Luke Skywalker"}, {"id"=>212668, "name"=>"Harrison Ford", "character_name"=>"Han Solo"}, {"id"=>577359, "name"=>"Carrie Fisher", "character_name"=>"Leia Organa"}, ...]
71
-
72
- guidebox_movie.writers("star wars a new hope")
73
- # => [{"id"=>527769, "name"=>"George Lucas"}]
74
-
75
- guidebox_movie.directors("star wars a new hope")
76
- # => [{"id"=>527769, "name"=>"George Lucas"}]
77
-
78
- guidebox_movie.release_year("star wars a new hope")
79
- # => 1977
80
-
81
- guidebox_movie.release_date("star wars a new hope")
82
- # => "1977-05-25"
83
-
84
- guidebox_movie.rating("star wars a new hope")
85
- # => "PG"
86
-
87
- guidebox_movie.duration("star wars a new hope")
88
- # => 7260
89
-
90
- guidebox_movie.themoviedb_id("star wars a new hope")
91
- # => 11
92
-
93
- guidebox_movie.imdb_id("star wars a new hope")
94
- # => "tt0076759"
95
-
96
- guidebox_movie.rotten_tomatoes_id("star wars a new hope")
97
- # => 11292
98
-
99
- guidebox_movie.alternate_titles("star wars a new hope")
100
- # => ["Star Wars", "Star Wars Episode IV - A New Hope", "Star Wars Episode 4 - A New Hope", "Star Wars Episode IV", "Star Wars 4", "Star Wars: Episode IV - A New Hope - Despecialized Edition", "Star Wars Episode IV: A New Hope", "Star Wars: Episode IV - A New Hope", "Star Wars: A New Hope", "Star Wars: A New Hope (Bonus Features)"]
101
-
102
- guidebox_movie.freebase("star wars a new hope")
103
- # => "/m/0dtfn"
104
-
105
- guidebox_movie.wikipedia_id("star wars a new hope")
106
- # => 52549
107
-
108
- guidebox_movie.metacritic_link("star wars a new hope")
109
- # => "http://www.metacritic.com/movie/star-wars-episode-iv---a-new-hope"
110
-
111
- guidebox_movie.overview("star wars a new hope")
112
- # => "Princess Leia is captured and held hostage by the evil Imperial forces in their effort to take over the galactic Empire. Venturesome Luke Skywalker and dashing captain Han Solo team together with the loveable robot duo R2-D2 and C-3PO to rescue the beautiful princess and restore peace and justice in the Empire."
113
-
114
- guidebox_movie.genres("star wars a new hope")
115
- # => [{"id"=>3, "title"=>"Adventure"}, {"id"=>1, "title"=>"Action"}, {"id"=>21, "title"=>"Science-Fiction"}]
116
-
117
- guidebox_movie.tags("star wars a new hope")
118
- # => [{"id"=>1594, "tag"=>"galaxy"}, {"id"=>9191, "tag"=>"hermit"}, {"id"=>2186, "tag"=>"star wars"}, {"id"=>9192, "tag"=>"death star"}, {"id"=>9193, "tag"=>"lightsaber"}, {"id"=>5558, "tag"=>"jedi"}, ...]
119
-
120
- guidebox_movie.facebook_link("star wars revenge of the sith")
121
- # => "https://www.facebook.com/pages/Star-Wars-Episode-III-Revenge-of-the-Sith/105663472799675"
122
-
123
- guidebox_movie.web_trailers("star wars revenge of the sith")
124
- # => [{"type"=>"Main Trailer", "source"=>"guidebox", "display_name"=>"Guidebox", "link"=>"http://www.guidebox.com/watch-now.php?video=53201", "embed"=>"http://api-widget.guidebox.com/embed.php?video=53201"}]
125
-
126
- guidebox_movie.ios_trailers("star wars revenge of the sith")
127
- # => [{"type"=>"Main Trailer", "source"=>"guidebox", "display_name"=>"Guidebox", "link"=>"http://www.guidebox.com/watch-now.php?video=53201", "embed"=>"http://api-widget.guidebox.com/embed.php?video=53201"}]
128
-
129
- guidebox_movie.android_trailers("star wars revenge of the sith")
130
- # => [{"type"=>"Main Trailer", "source"=>"guidebox", "display_name"=>"Guidebox", "link"=>"http://www.guidebox.com/watch-now.php?video=53201", "embed"=>"http://api-widget.guidebox.com/embed.php?video=53201"}]
131
-
132
71
  guidebox_movie.posters("star wars a new hope")
133
72
  # => [{"large"=>{"url"=>"http://static-api.guidebox.com/022615/thumbnails_movies/-alt--55413-2929921416-5712237544-4512474872-large-400x570-alt-.jpg", "width"=>400, "height"=>570}, ...]
134
73
 
@@ -141,41 +80,38 @@ guidebox_movie.banner_images("star wars a new hope")
141
80
  guidebox_movie.background_images("star wars a new hope")
142
81
  # => [{"original"=>{"url"=>"http://static-api.guidebox.com/012915/movies/backgrounds/55413-83836050721-144034282636-0.jpg", "width"=>1920, "height"=>1080}, "original_width"=>1920, "original_height"=>1080, "image_rating"=>0}, {"original"=>{"url"=>"http://static-api.guidebox.com/012915/movies/backgrounds/55413-206143594668-179262854890-0.jpg", "width"=>1920, "height"=>1080}, "original_width"=>1920, "original_height"=>1080, "image_rating"=>0}, {"original"=>{"url"=>"http://static-api.guidebox.com/012915/movies/backgrounds/55413-187622151929-44181177682-0.jpg", "width"=>1920, "height"=>1080}, "original_width"=>1920, "original_height"=>1080, "image_rating"=>0}]
143
82
 
144
- guidebox_movie.free_web_sources("star wars a new hope")
145
- # => []
146
-
147
- guidebox_movie.free_ios_sources("star wars a new hope")
148
- # => []
149
-
150
- guidebox_movie.free_android_sources("star wars a new hope")
151
- # => []
152
-
153
- guidebox_movie.tv_everywhere_web_sources("godzilla")
154
- # => [{"source"=>"xfinity_tveverywhere", "display_name"=>"Xfinity", "tv_channel"=>"Cinemax", "link"=>"http://xfinitytv.comcast.net/watch/Godzilla/7874134385186056112/574211139668/Godzilla-%28Cinemax%29/videos"}, ...]
155
-
156
- guidebox_movie.tv_everywhere_ios_sources("godzilla")
157
- # => [{"source"=>"maxgo", "display_name"=>"MAX GO", "tv_channel"=>"Cinemax", "link"=>"maxgo://deeplink/MO.MO/MGOROSTGP38072", "app_name"=>"MAX GO", "app_link"=>1, "app_required"=>1, "app_download_link"=>"itms-apps://itunes.apple.com/app/max-go/id453560335"}]
83
+ guidebox_movie.fetch_movie("star wars a new hope")
84
+ # => <Movie>
85
+ ```
158
86
 
159
- guidebox_movie.tv_everywhere_android_sources("godzilla")
160
- # => [{"source"=>"maxgo", "display_name"=>"MAX GO", "tv_channel"=>"Cinemax", "link"=>"maxgo://deeplink/MO.MO/MGOROSTGP38072", "app_name"=>"MAX GO", "app_link"=>1, "app_required"=>1, "app_download_link"=>"https://play.google.com/store/apps/details?id=com.MAXGo"}]
87
+ #### Accessbile Movie Attributes
161
88
 
162
- guidebox_movie.subscription_web_sources("star wars a new hope")
163
- # => [{"source"=>"now_tv", "display_name"=>"NOW TV", "link"=>"http://watch.nowtv.com/watch-movies/star-wars-episode-iv-new-hope-1977/d3742a916796e410VgnVCM1000000b43150a____"}]
89
+ ```
90
+ :id, :title, :release_year, :cast, :writers, :directors, :release_date, :rating, :duration, :themoviedb_id, :imdb_id
91
+ :rotten_tomatoes_id, :alternate_titles, :freebase, :wikipedia_id, :metacritic_link, :overview, :genres, :tags, :facebook_link
92
+ :web_trailers, :ios_trailers, :android_trailers, :free_web_sources, :free_ios_sources, :free_android_sources, :tv_everywhere_web_sources
93
+ :tv_everywhere_ios_sources, :tv_everywhere_android_sources, :subscription_web_sources, :purchase_web_sources, :purchase_ios_sources
94
+ :purchase_android_sources
95
+ ```
96
+ These can be easily accessed as follows:
97
+ ```
98
+ guidebox_movie = GuideboxWrapper::GuideboxMovie.new("YOUR_API_KEY", "region")
99
+ movie = guidebox_movie.fetch_movie("star wars a new hope")
164
100
 
165
- guidebox_movie.purchase_web_sources("star wars a new hope")
166
- # => [{"source"=>"itunes", "display_name"=>"iTunes", "link"=>"https://itunes.apple.com/us/movie/star-wars-a-new-hope/id978943481?uo=4&at=10laHb", "formats"=>[{"price"=>"19.99", "format"=>"SD", "type"=>"purchase", "pre_order"=>false}, {"price"=>"19.99", "format"=>"HD", "type"=>"purchase", "pre_order"=>false}]}, ...]
101
+ movie.title
102
+ # => "Star Wars: Episode IV: A New Hope"
167
103
 
168
- guidebox_movie.purchase_ios_sources("star wars a new hope")
169
- # => [{"source"=>"itunes", "display_name"=>"iTunes", "link"=>"itms://itunes.apple.com/us/movie/star-wars-a-new-hope/id978943481?uo=4&at=10laHb", "app_name"=>"iTunes", "app_link"=>1, "app_required"=>1, "app_download_link"=>"itms-apps://", "formats"=>[{"price"=>"19.99", "format"=>"SD", "type"=>"purchase", "pre_order"=>false}, {"price"=>"19.99", "format"=>"HD", "type"=>"purchase", "pre_order"=>false}]}]
104
+ movie.rating
105
+ # => "PG"
170
106
 
171
- guidebox_movie.purchase_android_sources("star wars a new hope")
172
- # => [{"source"=>"google_play", "display_name"=>"Google Play", "link"=>"https://play.google.com/store/movies/details?id=yYNSSNJ0z_U", "app_name"=>"Google Play", "app_link"=>0, "app_required"=>0, "app_download_link"=>"https://play.google.com/store", "formats"=>[{"price"=>"19.99", "format"=>"HD", "type"=>"purchase", "pre_order"=>false}]}]
107
+ movie.cast
108
+ # => [{"id"=>300791, "name"=>"Mark Hamill", "character_name"=>"Luke Skywalker"}, {"id"=>212668, "name"=>"Harrison Ford", "character_name"=>"Han Solo"}, {"id"=>577359, "name"=>"Carrie Fisher", "character_name"=>"Leia Organa"}, {"id"=>485272, "name"=>"Peter Cushing", "character_name"=>"Grand Moff Tarkin"}, {"id"=>532256, "name"=>"Alec Guinness", "character_name"=>"Obi-Wan Kenobi"}, {"id"=>491391, "name"=>"Anthony Daniels", "character_name"=>"C-3PO"}, {"id"=>153815, "name"=>"Kenny Baker", "character_name"=>"R2-D2"}, {"id"=>274194, "name"=>"Peter Mayhew", "character_name"=>"Chewbacca"}, ...]
173
109
  ```
174
110
 
175
111
  #### Tv Helpers
176
112
 
177
113
  ```ruby
178
- guidebox_tv = GuideboxWrapper::Tv.new("YOUR_API_KEY", "region")
114
+ guidebox_tv = GuideboxWrapper::GuideboxTv.new("YOUR_API_KEY", "region")
179
115
 
180
116
  guidebox_tv.search_for("entourage")
181
117
  # => [{"id"=>6085, "title"=>"Entourage", "alternate_titles"=>[], "container_show"=>0, "first_aired"=>"2004-07-18", "imdb_id"=>"tt0387199", ...}, ...]
@@ -1,4 +1,4 @@
1
1
  require_relative 'GuideboxWrapper/guidebox_wrapper'
2
- require_relative 'GuideboxWrapper/tv'
3
- require_relative 'GuideboxWrapper/movie'
2
+ require_relative 'GuideboxWrapper/guidebox_tv'
3
+ require_relative 'GuideboxWrapper/guidebox_movie'
4
4
  require_relative 'GuideboxWrapper/version'
@@ -0,0 +1,88 @@
1
+ require 'GuideboxWrapper/query_builders/movie/movie_query_builders'
2
+ require 'GuideboxWrapper/movie/movie'
3
+
4
+ module GuideboxWrapper
5
+ class GuideboxMovie < GuideboxApi
6
+ include MovieQueryBuilders
7
+ # Search for show
8
+ def search_for(name)
9
+ url = build_query(name)
10
+ url += '/fuzzy/web'
11
+ data = @client.query(url)
12
+ sleep(1)
13
+ data["results"]
14
+ end
15
+
16
+ # Search by provider
17
+ def search_for_by_provider(name, provider)
18
+ url = build_query(name)
19
+ url += '/fuzzy/' + provider + '/web'
20
+ data = @client.query(url)
21
+ data["results"]
22
+ end
23
+
24
+ def search_by_db_id(id, type)
25
+ url = @base_url
26
+ url += "/search/movie/id/"
27
+ case type
28
+ when "themoviedb"
29
+ url += "themoviedb/"
30
+ url += id.to_s
31
+ when "imdb"
32
+ url += "imdb/"
33
+ url += id
34
+ else
35
+ puts "That id type does not exist"
36
+ return
37
+ end
38
+ @client.query(url)
39
+ end
40
+
41
+ def show_information(name)
42
+ id = self.search_for(name).first["id"]
43
+ url = @base_url
44
+ url += "/movie/" + id.to_s
45
+ @client.query(url)
46
+ end
47
+
48
+ def fetch_movie(name_or_id)
49
+ url = @base_url
50
+ id = set_name_or_id(name_or_id)
51
+ url += "/movie/" + id.to_s
52
+ results = @client.query(url)
53
+ Movie.new(results)
54
+ end
55
+
56
+ def posters(name_or_id)
57
+ url = @base_url
58
+ id = set_name_or_id(name_or_id)
59
+ url += "/movie/" + id.to_s + "/images/posters"
60
+ results = @client.query(url)
61
+ results["results"]["posters"]
62
+ end
63
+
64
+ def thumbnail_images(name_or_id)
65
+ url = @base_url
66
+ id = set_name_or_id(name_or_id)
67
+ url += "/movie/" + id.to_s + "/images/thumbnails"
68
+ results = @client.query(url)
69
+ results["results"]["thumbnails"]
70
+ end
71
+
72
+ def banner_images(name_or_id)
73
+ url = @base_url
74
+ id = set_name_or_id(name_or_id)
75
+ url += "/movie/" + id.to_s + "/images/banners"
76
+ results = @client.query(url)
77
+ results["results"]["banners"]
78
+ end
79
+
80
+ def background_images(name_or_id)
81
+ url = @base_url
82
+ id = set_name_or_id(name_or_id)
83
+ url += "/movie/" + id.to_s + "/images/backgrounds"
84
+ results = @client.query(url)
85
+ results["results"]["backgrounds"]
86
+ end
87
+ end
88
+ end
@@ -1,7 +1,7 @@
1
1
  require 'GuideboxWrapper/query_builders/tv/tv_query_builders'
2
2
 
3
3
  module GuideboxWrapper
4
- class Tv < GuideboxApi
4
+ class GuideboxTv < GuideboxApi
5
5
  include TvQueryBuilders
6
6
  # Search for show
7
7
  def search_for(name)
@@ -0,0 +1,41 @@
1
+ module GuideboxWrapper
2
+ class Movie
3
+ attr_reader :id, :title, :release_year, :cast, :writers, :directors, :release_date, :rating, :duration, :themoviedb_id, :imdb_id, :rotten_tomatoes_id, :alternate_titles, :freebase, :wikipedia_id, :metacritic_link, :overview, :genres, :tags, :facebook_link, :web_trailers, :ios_trailers, :android_trailers, :free_web_sources, :free_ios_sources, :free_android_sources, :tv_everywhere_web_sources, :tv_everywhere_ios_sources, :tv_everywhere_android_sources, :subscription_web_sources, :purchase_web_sources, :purchase_ios_sources, :purchase_android_sources
4
+
5
+ def initialize(movie_info)
6
+ @id = movie_info["id"]
7
+ @title = movie_info["title"]
8
+ @release_year = movie_info["release_year"]
9
+ @cast = movie_info["cast"]
10
+ @writers = movie_info["writers"]
11
+ @directors = movie_info["directors"]
12
+ @release_date = movie_info["release_date"]
13
+ @rating = movie_info["rating"]
14
+ @duration = movie_info["duration"]
15
+ @themoviedb_id = movie_info["themoviedb"]
16
+ @imdb_id = movie_info["imdb"]
17
+ @rotten_tomatoes_id = movie_info["rottentomatoes"]
18
+ @alternate_titles = movie_info["alternate_titles"]
19
+ @freebase = movie_info["freebase"]
20
+ @wikipedia_id = movie_info["wikipedia_id"]
21
+ @metacritic_link = movie_info["metacritic"]
22
+ @overview = movie_info["overview"]
23
+ @genres = movie_info["genres"]
24
+ @tags = movie_info["tags"]
25
+ @facebook_link = movie_info["social"]["facebook"]["link"]
26
+ @web_trailers = movie_info["trailers"]["web"]
27
+ @ios_trailers = movie_info["trailers"]["ios"]
28
+ @android_trailers = movie_info["trailers"]["android"]
29
+ @free_web_sources = movie_info["free_web_sources"]
30
+ @free_ios_sources = movie_info["free_ios_sources"]
31
+ @free_android_sources = movie_info["free_android_sources"]
32
+ @tv_everywhere_web_sources = movie_info["tv_everywhere_web_sources"]
33
+ @tv_everywhere_ios_sources = movie_info["tv_everywhere_ios_sources"]
34
+ @tv_everywhere_android_sources = movie_info["tv_everywhere_android_sources"]
35
+ @subscription_web_sources = movie_info["subscription_web_sources"]
36
+ @purchase_web_sources = movie_info["purchase_web_sources"]
37
+ @purchase_ios_sources = movie_info["purchase_ios_sources"]
38
+ @purchase_android_sources = movie_info["purchase_android_sources"]
39
+ end
40
+ end
41
+ end
@@ -1,3 +1,3 @@
1
1
  module GuideboxWrapper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: GuideboxWrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Baird
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-29 00:00:00.000000000 Z
11
+ date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,11 +87,12 @@ files:
87
87
  - bin/console
88
88
  - bin/setup
89
89
  - lib/GuideboxWrapper.rb
90
+ - lib/GuideboxWrapper/guidebox_movie.rb
91
+ - lib/GuideboxWrapper/guidebox_tv.rb
90
92
  - lib/GuideboxWrapper/guidebox_wrapper.rb
91
- - lib/GuideboxWrapper/movie.rb
93
+ - lib/GuideboxWrapper/movie/movie.rb
92
94
  - lib/GuideboxWrapper/query_builders/movie/movie_query_builders.rb
93
95
  - lib/GuideboxWrapper/query_builders/tv/tv_query_builders.rb
94
- - lib/GuideboxWrapper/tv.rb
95
96
  - lib/GuideboxWrapper/version.rb
96
97
  homepage: https://github.com/tmobaird/GuideboxWrapper
97
98
  licenses:
@@ -1,265 +0,0 @@
1
- require 'GuideboxWrapper/query_builders/movie/movie_query_builders'
2
-
3
- module GuideboxWrapper
4
- class Movie < GuideboxApi
5
- include MovieQueryBuilders
6
- # Search for show
7
- def search_for(name)
8
- url = build_query(name)
9
- url += '/fuzzy/web'
10
- data = @client.query(url)
11
- sleep(1)
12
- data["results"]
13
- end
14
-
15
- # Search by provider
16
- def search_for_by_provider(name, provider)
17
- url = build_query(name)
18
- url += '/fuzzy/' + provider + '/web'
19
- data = @client.query(url)
20
- data["results"]
21
- end
22
-
23
- def search_by_db_id(id, type)
24
- url = @base_url
25
- url += "/search/movie/id/"
26
- case type
27
- when "themoviedb"
28
- url += "themoviedb/"
29
- url += id.to_s
30
- when "imdb"
31
- url += "imdb/"
32
- url += id
33
- else
34
- puts "That id type does not exist"
35
- return
36
- end
37
- @client.query(url)
38
- end
39
-
40
- def show_information(name)
41
- id = self.search_for(name).first["id"]
42
- url = @base_url
43
- url += "/movie/" + id.to_s
44
- @client.query(url)
45
- end
46
-
47
- def cast(name)
48
- url = search_and_set_url(name)
49
- results = @client.query(url)
50
- results["cast"]
51
- end
52
-
53
- def writers(name)
54
- url = search_and_set_url(name)
55
- results = @client.query(url)
56
- results["writers"]
57
- end
58
-
59
- def directors(name)
60
- url = search_and_set_url(name)
61
- results = @client.query(url)
62
- results["directors"]
63
- end
64
-
65
- def release_year(name)
66
- url = search_and_set_url(name)
67
- results = @client.query(url)
68
- results["release_year"]
69
- end
70
-
71
- def release_date(name)
72
- url = search_and_set_url(name)
73
- results = @client.query(url)
74
- results["release_date"]
75
- end
76
-
77
- def rating(name)
78
- url = search_and_set_url(name)
79
- results = @client.query(url)
80
- results["rating"]
81
- end
82
-
83
- def duration(name)
84
- url = search_and_set_url(name)
85
- results = @client.query(url)
86
- results["duration"]
87
- end
88
-
89
- def themoviedb_id(name)
90
- url = search_and_set_url(name)
91
- results = @client.query(url)
92
- results["themoviedb"]
93
- end
94
-
95
- def imdb_id(name)
96
- url = search_and_set_url(name)
97
- results = @client.query(url)
98
- results["imdb"]
99
- end
100
-
101
- def rotten_tomatoes_id(name)
102
- url = search_and_set_url(name)
103
- results = @client.query(url)
104
- results["rottentomatoes"]
105
- end
106
-
107
- def alternate_titles(name)
108
- url = search_and_set_url(name)
109
- results = @client.query(url)
110
- results["alternate_titles"]
111
- end
112
-
113
- def freebase(name)
114
- url = search_and_set_url(name)
115
- results = @client.query(url)
116
- results["freebase"]
117
- end
118
-
119
- def wikipedia_id(name)
120
- url = search_and_set_url(name)
121
- results = @client.query(url)
122
- results["wikipedia_id"]
123
- end
124
-
125
- def metacritic_link(name)
126
- url = search_and_set_url(name)
127
- results = @client.query(url)
128
- results["metacritic"]
129
- end
130
-
131
- def overview(name)
132
- url = search_and_set_url(name)
133
- results = @client.query(url)
134
- results["overview"]
135
- end
136
-
137
- def genres(name)
138
- url = search_and_set_url(name)
139
- results = @client.query(url)
140
- results["genres"]
141
- end
142
-
143
- def tags(name)
144
- url = search_and_set_url(name)
145
- results = @client.query(url)
146
- results["tags"]
147
- end
148
-
149
- def facebook_link(name)
150
- url = search_and_set_url(name)
151
- results = @client.query(url)
152
- results["social"]["facebook"]["link"]
153
- end
154
-
155
- def web_trailers(name)
156
- url = search_and_set_url(name)
157
- results = @client.query(url)
158
- results["trailers"]["web"]
159
- end
160
-
161
- def ios_trailers(name)
162
- url = search_and_set_url(name)
163
- results = @client.query(url)
164
- results["trailers"]["ios"]
165
- end
166
-
167
- def android_trailers(name)
168
- url = search_and_set_url(name)
169
- results = @client.query(url)
170
- results["trailers"]["android"]
171
- end
172
-
173
- def posters(name_or_id)
174
- url = @base_url
175
- id = set_name_or_id(name_or_id)
176
- url += "/movie/" + id.to_s + "/images/posters"
177
- results = @client.query(url)
178
- results["results"]["posters"]
179
- end
180
-
181
- def thumbnail_images(name_or_id)
182
- url = @base_url
183
- id = set_name_or_id(name_or_id)
184
- url += "/movie/" + id.to_s + "/images/thumbnails"
185
- results = @client.query(url)
186
- results["results"]["thumbnails"]
187
- end
188
-
189
- def banner_images(name_or_id)
190
- url = @base_url
191
- id = set_name_or_id(name_or_id)
192
- url += "/movie/" + id.to_s + "/images/banners"
193
- results = @client.query(url)
194
- results["results"]["banners"]
195
- end
196
-
197
- def background_images(name_or_id)
198
- url = @base_url
199
- id = set_name_or_id(name_or_id)
200
- url += "/movie/" + id.to_s + "/images/backgrounds"
201
- results = @client.query(url)
202
- results["results"]["backgrounds"]
203
- end
204
-
205
- def free_web_sources(name)
206
- url = search_and_set_url(name)
207
- results = @client.query(url)
208
- results["free_web_sources"]
209
- end
210
-
211
- def free_ios_sources(name)
212
- url = search_and_set_url(name)
213
- results = @client.query(url)
214
- results["free_ios_sources"]
215
- end
216
-
217
- def free_android_sources(name)
218
- url = search_and_set_url(name)
219
- results = @client.query(url)
220
- results["free_android_sources"]
221
- end
222
-
223
- def tv_everywhere_web_sources(name)
224
- url = search_and_set_url(name)
225
- results = @client.query(url)
226
- results["tv_everywhere_web_sources"]
227
- end
228
-
229
- def tv_everywhere_ios_sources(name)
230
- url = search_and_set_url(name)
231
- results = @client.query(url)
232
- results["tv_everywhere_ios_sources"]
233
- end
234
-
235
- def tv_everywhere_android_sources(name)
236
- url = search_and_set_url(name)
237
- results = @client.query(url)
238
- results["tv_everywhere_android_sources"]
239
- end
240
-
241
- def subscription_web_sources(name)
242
- url = search_and_set_url(name)
243
- results = @client.query(url)
244
- results["subscription_web_sources"]
245
- end
246
-
247
- def purchase_web_sources(name)
248
- url = search_and_set_url(name)
249
- results = @client.query(url)
250
- results["purchase_web_sources"]
251
- end
252
-
253
- def purchase_ios_sources(name)
254
- url = search_and_set_url(name)
255
- results = @client.query(url)
256
- results["purchase_ios_sources"]
257
- end
258
-
259
- def purchase_android_sources(name)
260
- url = search_and_set_url(name)
261
- results = @client.query(url)
262
- results["purchase_android_sources"]
263
- end
264
- end
265
- end