GuideboxWrapper 0.1.0
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 +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +19 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +8 -0
- data/GuideboxWrapper.gemspec +31 -0
- data/LICENSE.txt +21 -0
- data/README.md +277 -0
- data/Rakefile +9 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/GuideboxWrapper.rb +4 -0
- data/lib/GuideboxWrapper/guidebox_wrapper.rb +25 -0
- data/lib/GuideboxWrapper/movie.rb +265 -0
- data/lib/GuideboxWrapper/query_builders/movie/movie_query_builders.rb +29 -0
- data/lib/GuideboxWrapper/query_builders/tv/tv_query_builders.rb +29 -0
- data/lib/GuideboxWrapper/tv.rb +231 -0
- data/lib/GuideboxWrapper/version.rb +3 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 781382e9ef5bb0f587c224c9b8bb1c4aa8e80264
|
4
|
+
data.tar.gz: ab6bdad42303169407dcc08a089d6622d841d54e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 854b11bc754973e7ed5908a0293a3c9c7bd416943d37433e39f1156271f0c322d5b3e989ba621eb06a55e922ab100a5d8488dd0234bb8d30e62bd117c467f0d1
|
7
|
+
data.tar.gz: 98860e92bf0c9c856c66c492f1df28eda5e41de7605748c89c5cb194c1d14256cf45070ab778cdc89818c1c9be5c64eab39dbe40c86e15048d1fcaf28f469409
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- 2.2.1
|
6
|
+
|
7
|
+
script: 'bundle exec rake'
|
8
|
+
|
9
|
+
notifications:
|
10
|
+
email:
|
11
|
+
recipients:
|
12
|
+
- tmobaird@gmail.com
|
13
|
+
- tbaird@mail.umw.edu
|
14
|
+
on_success: change # default: change
|
15
|
+
on_failure: always # default: always
|
16
|
+
|
17
|
+
addons:
|
18
|
+
code_climate:
|
19
|
+
repo_token: a8b1370c362034c18a1c27ee8abdec1c17939bbeb4c041f06219d03ab29762c6
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'GuideboxWrapper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "GuideboxWrapper"
|
8
|
+
spec.version = GuideboxWrapper::VERSION
|
9
|
+
spec.authors = ["Thomas Baird"]
|
10
|
+
spec.email = ["tbaird@mail.umw.edu"]
|
11
|
+
|
12
|
+
# if spec.respond_to?(:metadata)
|
13
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
14
|
+
# end
|
15
|
+
|
16
|
+
spec.summary = %q{A ruby wrapper for the Guidebox API.}
|
17
|
+
spec.description = %q{This gem is a ruby wrapper for the Guidebox API. Guidebox is a big database of movie/tv-show information. This gem allows you to query this api easily for different pieces of data.}
|
18
|
+
spec.homepage = "https://github.com/tmobaird/GuideboxWrapper"
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
29
|
+
spec.add_development_dependency "json", "~> 1.8"
|
30
|
+
|
31
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Thomas Baird
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,277 @@
|
|
1
|
+
# GuideboxWrapper
|
2
|
+
|
3
|
+
[](https://codeclimate.com/github/tmobaird/GuideboxWrapper)
|
4
|
+
[](https://codeclimate.com/github/tmobaird/GuideboxWrapper/coverage)
|
5
|
+
[](https://travis-ci.org/tmobaird/GuideboxWrapper)
|
6
|
+
|
7
|
+
Guidebox Wrapper is a Ruby Wrapper for the Guidebox API. The Guidebox API contains tons of information about tv shows and movies. This gem will help you extract data from this API in a simple way. It contains an array of different methods that allow you to obtain different information about a movie/tv show.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'GuideboxWrapper'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install GuideboxWrapper
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
To use this gem you must first register for a personal API key on Guidebox's website. This registration page can be found here: [Guidebox API key registration page](https://api.guidebox.com/production-key). Once you obtain your personal API key (which should be randomized string of numbers and characters) you will be able to start using this gem.
|
28
|
+
|
29
|
+
**Do not use yet, this Gem is not currently active on RubyGems**
|
30
|
+
|
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
|
+
|
33
|
+
```ruby
|
34
|
+
GuideboxWrapper::Tv.new("YOUR_API_KEY", "region") # region can be "all", "US" (United States), "GB" (Great Britain), etc
|
35
|
+
|
36
|
+
GuideboxWrapper::Movie.new("YOUR_API_KEY", "region") # region can be "all", "US" (United States), "GB" (Great Britain), etc
|
37
|
+
```
|
38
|
+
|
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
|
+
|
41
|
+
```ruby
|
42
|
+
tv = GuideboxWrapper::Tv.new("YOUR_API_KEY", "region")
|
43
|
+
tv.quota
|
44
|
+
# => 5500
|
45
|
+
|
46
|
+
movie = GuideboxWrapper::Movie.new("YOUR_API_KEY", "region")
|
47
|
+
movie.quota
|
48
|
+
# => 5500
|
49
|
+
```
|
50
|
+
Here are all the helper methods within this wrapper for the Movie and Tv classes:
|
51
|
+
|
52
|
+
#### Movie Helpers
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
guidebox_movie = GuideboxWrapper::Movie.new("YOUR_API_KEY", "region")
|
56
|
+
|
57
|
+
guidebox_movie.search_for("star wars a new hope")
|
58
|
+
# => [{"id"=>55413, "title"=>"Star Wars: Episode IV: A New Hope", "release_year"=>1977, "themoviedb"=>11, ...}]
|
59
|
+
|
60
|
+
guidebox_movie.search_for_by_provider("star wars a new hope", "amazon_prime")
|
61
|
+
# => [{"id"=>55413, "title"=>"Star Wars: Episode IV: A New Hope", "release_year"=>1977, "themoviedb"=>11, ...}]
|
62
|
+
|
63
|
+
guidebox_movie.search_by_db_id(11, "themoviedb")
|
64
|
+
# => {"id"=>55413, "title"=>"Star Wars: Episode IV: A New Hope", "release_year"=>1977, "themoviedb"=>11, ...}
|
65
|
+
|
66
|
+
guidebox_movie.show_information("star wars a new hope")
|
67
|
+
# => {"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
|
+
|
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
|
+
guidebox_movie.posters("star wars a new hope")
|
133
|
+
# => [{"large"=>{"url"=>"http://static-api.guidebox.com/022615/thumbnails_movies/-alt--55413-2929921416-5712237544-4512474872-large-400x570-alt-.jpg", "width"=>400, "height"=>570}, ...]
|
134
|
+
|
135
|
+
guidebox_movie.thumbnail_images("star wars a new hope")
|
136
|
+
# => [{"xlarge"=>{"url"=>"http://static-api.guidebox.com/012915/movies/thumbnails/55413-4649667824-932900156-9715580251-608x342.jpg", "width"=>608, "height"=>342}, "large"=>{"url"=>"http://static-api.guidebox.com/012915/movies/thumbnails/55413-4649667824-932900156-9715580251-448x252.jpg", "width"=>448, "height"=>252}, ...]
|
137
|
+
|
138
|
+
guidebox_movie.banner_images("star wars a new hope")
|
139
|
+
# => [{"xlarge"=>{"url"=>"http://static-api.guidebox.com/012915/movies/banners/55413-9158895025-3035124387-2547398284-1300x240.jpg", "width"=>1300, "height"=>240}, "large"=>{"url"=>"http://static-api.guidebox.com/012915/movies/banners/55413-9158895025-3035124387-2547398284-1000x185.jpg", "width"=>1000, "height"=>185}, ...]
|
140
|
+
|
141
|
+
guidebox_movie.background_images("star wars a new hope")
|
142
|
+
# => [{"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
|
+
|
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"}]
|
158
|
+
|
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"}]
|
161
|
+
|
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____"}]
|
164
|
+
|
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}]}, ...]
|
167
|
+
|
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}]}]
|
170
|
+
|
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}]}]
|
173
|
+
```
|
174
|
+
|
175
|
+
#### Tv Helpers
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
guidebox_tv = GuideboxWrapper::Tv.new("YOUR_API_KEY", "region")
|
179
|
+
|
180
|
+
guidebox_tv.search_for("entourage")
|
181
|
+
# => [{"id"=>6085, "title"=>"Entourage", "alternate_titles"=>[], "container_show"=>0, "first_aired"=>"2004-07-18", "imdb_id"=>"tt0387199", ...}, ...]
|
182
|
+
|
183
|
+
guidebox_tv.search_for_by_provider("entourage", "hbo")
|
184
|
+
# => [{"id"=>6085, "title"=>"Entourage", "alternate_titles"=>[], "container_show"=>0, "first_aired"=>"2004-07-18", "imdb_id"=>"tt0387199", ...}, ...]
|
185
|
+
|
186
|
+
guidebox_tv.search_by_db_id("tt0387199", "imdb")
|
187
|
+
# => {"id"=>6085, "title"=>"Entourage", "alternate_titles"=>[], "container_show"=>0, "first_aired"=>"2004-07-18", "imdb_id"=>"tt0387199", ...}
|
188
|
+
|
189
|
+
guidebox_tv.show_information("entourage")
|
190
|
+
# => {"id"=>6085, "title"=>"Entourage", "alternate_titles"=>[], "status"=>"Ended", "type"=>"television", "container_show"=>0, "first_aired"=>"2004-07-18", "network"=>"HBO", "channels"=>[{"id"=>36, "name"=>"HBO", "short_name"=>"hbo", ...}
|
191
|
+
|
192
|
+
guidebox_tv.seasons("entourage")
|
193
|
+
# => [{"season_number"=>1, "first_airdate"=>"2004-07-18"}, {"season_number"=>2, "first_airdate"=>"2005-06-05"}, {"season_number"=>3, "first_airdate"=>"2006-06-11"}, {"season_number"=>4, "first_airdate"=>"2007-06-17"}, ...]
|
194
|
+
|
195
|
+
guidebox_tv.cast("entourage")
|
196
|
+
# => [{"id"=>40080, "name"=>"Kevin Connolly", "character_name"=>"Eric Murphy"}, {"id"=>349611, "name"=>"Adrian Grenier", "character_name"=>"Vincent Chase"}, {"id"=>275528, "name"=>"Jerry Ferrara", "character_name"=>"Turtle"}, {"id"=>71709, "name"=>"Kevin Dillon", "character_name"=>"Johnny \"Drama\" Chase"}, {"id"=>491504, "name"=>"Jeremy Piven", "character_name"=>"Ari Gold"}, ...]
|
197
|
+
|
198
|
+
guidebox_tv.status("entourage")
|
199
|
+
# => "Ended"
|
200
|
+
|
201
|
+
guidebox_tv.type("entourage")
|
202
|
+
# => "television"
|
203
|
+
|
204
|
+
guidebox_tv.first_aired("entourage")
|
205
|
+
# => "2004-07-18"
|
206
|
+
|
207
|
+
guidebox_tv.network("entourage")
|
208
|
+
# => "HBO"
|
209
|
+
|
210
|
+
guidebox_tv.channel_information("entourage")
|
211
|
+
# => [{"id"=>36, "name"=>"HBO", "short_name"=>"hbo", "channel_type"=>"television", "artwork_208x117"=>"http://static-api.guidebox.com/041014/thumbnails_small/36-4192732312-208x117-channel.jpg", ...}]
|
212
|
+
|
213
|
+
guidebox_tv.runtime("entourage")
|
214
|
+
# => 30
|
215
|
+
|
216
|
+
guidebox_tv.genres("entourage")
|
217
|
+
# => [{"id"=>6, "title"=>"Comedy"}, {"id"=>9, "title"=>"Drama"}]
|
218
|
+
|
219
|
+
guidebox_tv.tags("entourage")
|
220
|
+
# => [{"id"=>919, "tag"=>"beverly hills"}, {"id"=>1624, "tag"=>"beverly hills california"}, {"id"=>44, "tag"=>"male friendship"}, {"id"=>293, "tag"=>"aspiring actor"}, {"id"=>295, "tag"=>"hollywood"}, ...]
|
221
|
+
|
222
|
+
guidebox_tv.overview("entourage")
|
223
|
+
# => "Vincent Chase is a young actor whose career is on the rise. Joining him on his journey to stardom are his childhood buddies Eric, Turtle, his brother Johnny Drama and his hot-tempered agent Ari Gold. Together, they'll navigate the highs and lows of Hollywood's fast lane, where the stakes are higher -- and the money and temptations greater -- than ever before. "
|
224
|
+
|
225
|
+
guidebox_tv.air_day_of_week("entourage")
|
226
|
+
# => "Sunday"
|
227
|
+
|
228
|
+
guidebox_tv.air_time("entourage")
|
229
|
+
# => "10:30 PM"
|
230
|
+
|
231
|
+
guidebox_tv.rating("entourage")
|
232
|
+
# => "TV-MA"
|
233
|
+
|
234
|
+
guidebox_tv.imdb_id("entourage")
|
235
|
+
# => "tt0387199"
|
236
|
+
|
237
|
+
guidebox_tv.metacritic_link("entourage")
|
238
|
+
# => "http://www.metacritic.com/tv/entourage"
|
239
|
+
|
240
|
+
guidebox_tv.wikipedia_id("entourage")
|
241
|
+
# => 907282
|
242
|
+
|
243
|
+
guidebox_tv.facebook_link("entourage")
|
244
|
+
# => "https://www.facebook.com/Entourage"
|
245
|
+
|
246
|
+
guidebox_tv.twitter_link("entourage")
|
247
|
+
# => nil
|
248
|
+
|
249
|
+
guidebox_tv.related_show("entourage")
|
250
|
+
# => {"total_results"=>6, "total_returned"=>6, "results"=>[{"id"=>300, "title"=>"Suits", "alternate_titles"=>[], "container_show"=>0, "first_aired"=>"2011-06-23", "imdb_id"=>"tt1632701", "tvdb"=>247808, "themoviedb"=>37680, "freebase"=>"/m/0gg70vv", "wikipedia_id"=>30987670, "tvrage"=>{"tvrage_id"=>27518, "link"=>"http://www.tvrage.com/shows/id-27518"}, "artwork_208x117"=>"http://static-api.guidebox.com/091414/thumbnails_small/300-4352846579-208x117-show-thumbnail.jpg", "artwork_304x171"=>"http://static-api.guidebox.com/091414/thumbnails_medium/300-2030188479-304x171-show-thumbnail.jpg", "artwork_448x252"=>"http://static-api.guidebox.com/091414/thumbnails_large/300-9888987527-448x252-show-thumbnail.jpg", "artwork_608x342"=>"http://static-api.guidebox.com/091414/thumbnails_xlarge/300-9276088145-608x342-show-thumbnail.jpg"}, ...]}
|
251
|
+
|
252
|
+
guidebox_tv.posters("entourage")
|
253
|
+
# => [{"xlarge"=>{"url"=>"http://static-api.guidebox.com/012915/shows/posters/6085-3725524591-5295090941-3912000982-600x855.jpg", "width"=>600, "height"=>855}, "large"=>{"url"=>"http://static-api.guidebox.com/012915/shows/posters/6085-3725524591-5295090941-3912000982-400x570.jpg", "width"=>400, "height"=>570}, ...}]
|
254
|
+
|
255
|
+
guidebox_tv.thumbnail_images("entourage")
|
256
|
+
# => [{"xlarge"=>{"url"=>"http://static-api.guidebox.com/091414/thumbnails_xlarge/6085-6340779560-608x342-show-thumbnail.jpg", "width"=>608, "height"=>342}, "large"=>{"url"=>"http://static-api.guidebox.com/091414/thumbnails_large/6085-6218685578-448x252-show-thumbnail.jpg", "width"=>448, "height"=>252}, ...}]
|
257
|
+
|
258
|
+
guidebox_tv.banner_images("entourage")
|
259
|
+
# => [{"xlarge"=>{"url"=>"http://static-api.guidebox.com/012915/shows/banners/6085-6918728002-5154230813-6413012026-1300x240.jpg", "width"=>1300, "height"=>240}, "large"=>{"url"=>"http://static-api.guidebox.com/012915/shows/banners/6085-6918728002-5154230813-6413012026-1000x185.jpg", "width"=>1000, "height"=>185}, ...]
|
260
|
+
|
261
|
+
guidebox_tv.background_images("entourage")
|
262
|
+
# => [{"original"=>{"url"=>"http://static-api.guidebox.com/012915/shows/backgrounds/6085-96932638085-133215735918-888.jpg", "width"=>1280, "height"=>720}, "original_width"=>1280, "original_height"=>720, "image_rating"=>0}, ...]
|
263
|
+
```
|
264
|
+
|
265
|
+
## Development
|
266
|
+
|
267
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
268
|
+
|
269
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
270
|
+
|
271
|
+
## Contributing
|
272
|
+
|
273
|
+
1. Fork it ( https://github.com/[my-github-username]/GuideboxWrapper/fork )
|
274
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
275
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
276
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
277
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "GuideboxWrapper"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module GuideboxWrapper
|
5
|
+
class Client
|
6
|
+
def query(url)
|
7
|
+
JSON.parse(open(url).read)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
class GuideboxApi
|
11
|
+
def initialize(key, region)
|
12
|
+
@key = key
|
13
|
+
@region = region
|
14
|
+
@base_url = "http://api-public.guidebox.com/v1.43/#{region}/#{key}"
|
15
|
+
@client = Client.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def quota
|
19
|
+
url = @base_url + "/quota"
|
20
|
+
results = @client.query(url)
|
21
|
+
results["monthly_quota"]["current"]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,265 @@
|
|
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
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module MovieQueryBuilders
|
2
|
+
def build_query(name)
|
3
|
+
url = @base_url
|
4
|
+
words = name.split(" ")
|
5
|
+
url += "/search/movie/title/"
|
6
|
+
for word in words
|
7
|
+
url += word
|
8
|
+
unless word == words.last
|
9
|
+
url += "+"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
url
|
13
|
+
end
|
14
|
+
|
15
|
+
def search_and_set_url(name)
|
16
|
+
id = self.search_for(name).first["id"]
|
17
|
+
url = @base_url
|
18
|
+
url + "/movie/" + id.to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_name_or_id(name_or_id)
|
22
|
+
if name_or_id.is_a?(String)
|
23
|
+
id = self.search_for(name_or_id).first["id"]
|
24
|
+
else
|
25
|
+
id = name_or_id
|
26
|
+
end
|
27
|
+
id
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module TvQueryBuilders
|
2
|
+
def build_query(name)
|
3
|
+
url = @base_url
|
4
|
+
words = name.split(" ")
|
5
|
+
url += "/search/title/"
|
6
|
+
for word in words
|
7
|
+
url += word
|
8
|
+
unless word == words.last
|
9
|
+
url += "+"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
url
|
13
|
+
end
|
14
|
+
|
15
|
+
def search_and_set_url(name)
|
16
|
+
id = self.search_for(name).first["id"]
|
17
|
+
url = @base_url
|
18
|
+
url + "/show/" + id.to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_name_or_id(name_or_id)
|
22
|
+
if name_or_id.is_a?(String)
|
23
|
+
id = self.search_for(name_or_id).first["id"]
|
24
|
+
else
|
25
|
+
id = name_or_id
|
26
|
+
end
|
27
|
+
id
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,231 @@
|
|
1
|
+
require 'GuideboxWrapper/query_builders/tv/tv_query_builders'
|
2
|
+
|
3
|
+
module GuideboxWrapper
|
4
|
+
class Tv < GuideboxApi
|
5
|
+
include TvQueryBuilders
|
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
|
+
# Search for show by external db id
|
24
|
+
def search_by_db_id(id, type)
|
25
|
+
url = @base_url
|
26
|
+
url += "/search/id/"
|
27
|
+
case type
|
28
|
+
when "tvdb"
|
29
|
+
url += "tvdb/"
|
30
|
+
url += id.to_s
|
31
|
+
when "themoviedb"
|
32
|
+
url += "themoviedb/"
|
33
|
+
url += id.to_s
|
34
|
+
when "imdb"
|
35
|
+
url += "imdb/"
|
36
|
+
url += id
|
37
|
+
else
|
38
|
+
puts "That id type does not exist"
|
39
|
+
return
|
40
|
+
end
|
41
|
+
@client.query(url)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Get all tv show info
|
45
|
+
def show_information(name)
|
46
|
+
id = self.search_for(name).first["id"]
|
47
|
+
url = @base_url
|
48
|
+
url += "/show/" + id.to_s
|
49
|
+
@client.query(url)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get all seasons of show by name
|
53
|
+
def seasons(name)
|
54
|
+
id = self.search_for(name).first["id"]
|
55
|
+
url = @base_url
|
56
|
+
url += "/show/" + id.to_s + "/seasons"
|
57
|
+
data = @client.query(url)
|
58
|
+
data["results"]
|
59
|
+
end
|
60
|
+
|
61
|
+
# Get the cast of show by show name
|
62
|
+
def cast(name)
|
63
|
+
url = search_and_set_url(name)
|
64
|
+
results = @client.query(url)
|
65
|
+
results["cast"]
|
66
|
+
end
|
67
|
+
|
68
|
+
# Get the status of show by name ex. Ended
|
69
|
+
def status(name)
|
70
|
+
url = search_and_set_url(name)
|
71
|
+
results = @client.query(url)
|
72
|
+
results["status"]
|
73
|
+
end
|
74
|
+
|
75
|
+
# Get type of show by name ex. TV
|
76
|
+
def type(name)
|
77
|
+
url = search_and_set_url(name)
|
78
|
+
results = @client.query(url)
|
79
|
+
results["type"]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Get show first aired date by name
|
83
|
+
def first_aired(name)
|
84
|
+
url = search_and_set_url(name)
|
85
|
+
results = @client.query(url)
|
86
|
+
results["first_aired"]
|
87
|
+
end
|
88
|
+
|
89
|
+
# Get network aired on, ex HBO
|
90
|
+
def network(name)
|
91
|
+
url = search_and_set_url(name)
|
92
|
+
results = @client.query(url)
|
93
|
+
results["network"]
|
94
|
+
end
|
95
|
+
|
96
|
+
# Get channel information of show by name
|
97
|
+
def channel_information(name)
|
98
|
+
url = search_and_set_url(name)
|
99
|
+
results = @client.query(url)
|
100
|
+
results["channels"]
|
101
|
+
end
|
102
|
+
|
103
|
+
# Get runtime of show by name
|
104
|
+
def runtime(name)
|
105
|
+
url = search_and_set_url(name)
|
106
|
+
results = @client.query(url)
|
107
|
+
results["runtime"]
|
108
|
+
end
|
109
|
+
|
110
|
+
# Get genres of show by show name ex. Drama, Comedy
|
111
|
+
def genres(name)
|
112
|
+
url = search_and_set_url(name)
|
113
|
+
results = @client.query(url)
|
114
|
+
results["genres"]
|
115
|
+
end
|
116
|
+
|
117
|
+
# Get tags of show by name
|
118
|
+
def tags(name)
|
119
|
+
url = search_and_set_url(name)
|
120
|
+
results = @client.query(url)
|
121
|
+
results["tags"]
|
122
|
+
end
|
123
|
+
|
124
|
+
# Get overview or description of show by name
|
125
|
+
def overview(name)
|
126
|
+
url = search_and_set_url(name)
|
127
|
+
results = @client.query(url)
|
128
|
+
results["overview"]
|
129
|
+
end
|
130
|
+
|
131
|
+
# Get air day of the week by show name
|
132
|
+
def air_day_of_week(name)
|
133
|
+
url = search_and_set_url(name)
|
134
|
+
results = @client.query(url)
|
135
|
+
results["air_day_of_week"]
|
136
|
+
end
|
137
|
+
|
138
|
+
# Get air time of the day by show name
|
139
|
+
def air_time(name)
|
140
|
+
url = search_and_set_url(name)
|
141
|
+
results = @client.query(url)
|
142
|
+
results["air_time"]
|
143
|
+
end
|
144
|
+
|
145
|
+
# Get show rating by name ex. TV-MA
|
146
|
+
def rating(name)
|
147
|
+
url = search_and_set_url(name)
|
148
|
+
results = @client.query(url)
|
149
|
+
results["rating"]
|
150
|
+
end
|
151
|
+
|
152
|
+
# Get imdb id by show name
|
153
|
+
def imdb_id(name)
|
154
|
+
url = search_and_set_url(name)
|
155
|
+
results = @client.query(url)
|
156
|
+
results["imdb_id"]
|
157
|
+
end
|
158
|
+
|
159
|
+
# Get metacritic link by show name
|
160
|
+
def metacritic_link(name)
|
161
|
+
url = search_and_set_url(name)
|
162
|
+
results = @client.query(url)
|
163
|
+
results["metacritic"]
|
164
|
+
end
|
165
|
+
|
166
|
+
# Get wikipedia id by show name
|
167
|
+
def wikipedia_id(name)
|
168
|
+
url = search_and_set_url(name)
|
169
|
+
results = @client.query(url)
|
170
|
+
results["wikipedia_id"]
|
171
|
+
end
|
172
|
+
|
173
|
+
# Get facebook_link by show name
|
174
|
+
def facebook_link(name)
|
175
|
+
url = search_and_set_url(name)
|
176
|
+
results = @client.query(url)
|
177
|
+
results["social"]["facebook"]["link"]
|
178
|
+
end
|
179
|
+
|
180
|
+
# Get twitter_link by name
|
181
|
+
def twitter_link(name)
|
182
|
+
url = search_and_set_url(name)
|
183
|
+
results = @client.query(url)
|
184
|
+
results["social"]["twitter"]["link"]
|
185
|
+
end
|
186
|
+
|
187
|
+
# Gets all related tv shows by show id
|
188
|
+
def related_shows(name)
|
189
|
+
id = self.search_for(name).first["id"]
|
190
|
+
url = @base_url
|
191
|
+
url += "/show/" + id.to_s + "/related"
|
192
|
+
@client.query(url)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Gets all tv show movie posters
|
196
|
+
def posters(name_or_id)
|
197
|
+
url = @base_url
|
198
|
+
id = set_name_or_id(name_or_id)
|
199
|
+
url += "/show/" + id.to_s + "/images/posters"
|
200
|
+
results = @client.query(url)
|
201
|
+
results["results"]["posters"]
|
202
|
+
end
|
203
|
+
|
204
|
+
# Gets all show thumbnail images by name or id
|
205
|
+
def thumbnail_images(name_or_id)
|
206
|
+
url = @base_url
|
207
|
+
id = set_name_or_id(name_or_id)
|
208
|
+
url += "/show/" + id.to_s + "/images/thumbnails"
|
209
|
+
results = @client.query(url)
|
210
|
+
results["results"]["thumbnails"]
|
211
|
+
end
|
212
|
+
|
213
|
+
# Gets all show banner images by name or id
|
214
|
+
def banner_images(name_or_id)
|
215
|
+
url = @base_url
|
216
|
+
id = set_name_or_id(name_or_id)
|
217
|
+
url += "/show/" + id.to_s + "/images/banners"
|
218
|
+
results = @client.query(url)
|
219
|
+
results["results"]["banners"]
|
220
|
+
end
|
221
|
+
|
222
|
+
# Gets all show background images by name or id
|
223
|
+
def background_images(name_or_id)
|
224
|
+
url = @base_url
|
225
|
+
id = set_name_or_id(name_or_id)
|
226
|
+
url += "/show/" + id.to_s + "/images/backgrounds"
|
227
|
+
results = @client.query(url)
|
228
|
+
results["results"]["backgrounds"]
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: GuideboxWrapper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas Baird
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.8'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.8'
|
69
|
+
description: This gem is a ruby wrapper for the Guidebox API. Guidebox is a big database
|
70
|
+
of movie/tv-show information. This gem allows you to query this api easily for different
|
71
|
+
pieces of data.
|
72
|
+
email:
|
73
|
+
- tbaird@mail.umw.edu
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- ".travis.yml"
|
81
|
+
- CODE_OF_CONDUCT.md
|
82
|
+
- Gemfile
|
83
|
+
- GuideboxWrapper.gemspec
|
84
|
+
- LICENSE.txt
|
85
|
+
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- bin/console
|
88
|
+
- bin/setup
|
89
|
+
- lib/GuideboxWrapper.rb
|
90
|
+
- lib/GuideboxWrapper/guidebox_wrapper.rb
|
91
|
+
- lib/GuideboxWrapper/movie.rb
|
92
|
+
- lib/GuideboxWrapper/query_builders/movie/movie_query_builders.rb
|
93
|
+
- lib/GuideboxWrapper/query_builders/tv/tv_query_builders.rb
|
94
|
+
- lib/GuideboxWrapper/tv.rb
|
95
|
+
- lib/GuideboxWrapper/version.rb
|
96
|
+
homepage: https://github.com/tmobaird/GuideboxWrapper
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata: {}
|
100
|
+
post_install_message:
|
101
|
+
rdoc_options: []
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.4.6
|
117
|
+
signing_key:
|
118
|
+
specification_version: 4
|
119
|
+
summary: A ruby wrapper for the Guidebox API.
|
120
|
+
test_files: []
|