GuideboxWrapper 0.1.5 → 0.1.6

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: b110d54ad7e5d03c6bc17577230a8327eba185d2
4
- data.tar.gz: 1012d54f76d45c5a1781562a2f04839d31f874fe
3
+ metadata.gz: 6ac4616ee5d13ab0f3f0bb1a6f532ff8a701888b
4
+ data.tar.gz: ce4c0e29f8537538bc20641ee182cdb4aa893d1a
5
5
  SHA512:
6
- metadata.gz: f2e9ea8060bbc54540bf08fbfe1f832edae3f97a6e9eda6d0415ca57d8cc89cb849cc8ec6435c02efe6741178ad28fa15498c9a58ffc1d1694803fb9505e707f
7
- data.tar.gz: 71827204f15785a63d8d9484a1107cb2e24e220d2992a955d6af16885059c76cc08be2f86a08504f95a81c68901d18476f5463865f82efd744f754a87c1359aa
6
+ metadata.gz: c8d7f69fdefbbdea51066b7a06f808a451e65adc4cc9748f71bfc0379cfaa391e5a4ad4b9dad5cf2b8e4806a5457130d732f25bc358f19e08aa16a0f3eac99da
7
+ data.tar.gz: 5923af732cf7ba6089228deb01176c7a72af7df80b81199dcdc9135af68c49ffd0cc1dc03b2f8fa3becbf2b072e6d96c5c853e63b80429caf3d2fddb1b2445e8
Binary file
data/README.md CHANGED
@@ -86,15 +86,15 @@ guidebox_movie.fetch_movie("star wars a new hope")
86
86
 
87
87
  #### Accessbile Movie Attributes
88
88
 
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
89
+ ```ruby
90
+ :id, :title, :release_year, :cast, :writers, :directors, :release_date, :rating, :duration, :themoviedb, :imdb,
91
+ :rottentomatoes, :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
94
  :purchase_android_sources
95
95
  ```
96
96
  These can be easily accessed as follows:
97
- ```
97
+ ```ruby
98
98
  guidebox_movie = GuideboxWrapper::GuideboxMovie.new("YOUR_API_KEY", "region")
99
99
  movie = guidebox_movie.fetch_movie("star wars a new hope")
100
100
 
@@ -50,7 +50,10 @@ module GuideboxWrapper
50
50
  id = set_name_or_id(name_or_id)
51
51
  url += "/movie/" + id.to_s
52
52
  results = @client.query(url)
53
- Movie.new(results)
53
+ url += "/images/all"
54
+ images_results = @client.query(url)
55
+ images = images_results["results"]
56
+ Movie.new(results, images)
54
57
  end
55
58
 
56
59
  def posters(name_or_id)
@@ -1,41 +1,110 @@
1
1
  module GuideboxWrapper
2
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"]
3
+ attr_reader :id, :title, :release_year, :cast, :writers, :directors, :release_date, :rating, :duration, :themoviedb, :imdb, :rottentomatoes, :alternate_titles, :freebase, :wikipedia_id, :metacritic, :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, :posters, :backgrounds, :banners, :thumbnails
4
+
5
+ def initialize(movie_info, images)
6
+ excluded_keys = ["common_sense_media", "poster_120x171", "poster_240x342", "poster_400x570", "social", "trailers"]
7
+ movie_info.each do |key, value|
8
+ unless excluded_keys.include?(key)
9
+ instance_variable_set("@#{key}", value)
10
+ end
11
+ end
25
12
  @facebook_link = movie_info["social"]["facebook"]["link"]
26
13
  @web_trailers = movie_info["trailers"]["web"]
27
14
  @ios_trailers = movie_info["trailers"]["ios"]
28
15
  @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"]
16
+ @posters = images["posters"]
17
+ @backgrounds = images["backgrounds"]
18
+ @banners = images["banners"]
19
+ @thumbnails = images["thumbnails"]
20
+ end
21
+
22
+ def large_posters
23
+ lg_posters ||= []
24
+ for poster in @posters
25
+ lg_posters << poster["large"]
26
+ end
27
+ lg_posters
28
+ end
29
+
30
+ def medium_posters
31
+ md_posters ||= []
32
+ for poster in @posters
33
+ md_posters << poster["medium"]
34
+ end
35
+ md_posters
36
+ end
37
+
38
+ def small_posters
39
+ sm_posters ||= []
40
+ for poster in @posters
41
+ sm_posters << poster["small"]
42
+ end
43
+ sm_posters
44
+ end
45
+
46
+ def xlarge_banners
47
+ xlg_banners ||= []
48
+ for banner in @banners
49
+ xlg_banners << banner["xlarge"]
50
+ end
51
+ xlg_banners
52
+ end
53
+
54
+ def large_banners
55
+ lg_banners ||= []
56
+ for banner in @banners
57
+ lg_banners << banner["large"]
58
+ end
59
+ lg_banners
60
+ end
61
+
62
+ def medium_banners
63
+ md_banners ||= []
64
+ for banner in @banners
65
+ md_banners << banner["medium"]
66
+ end
67
+ md_banners
68
+ end
69
+
70
+ def small_banners
71
+ sm_banners ||= []
72
+ for banner in @banners
73
+ sm_banners << banner["small"]
74
+ end
75
+ sm_banners
76
+ end
77
+
78
+ def xlarge_thumbnails
79
+ xlg_thumbnails ||= []
80
+ for thumbnail in @thumbnails
81
+ xlg_thumbnails << thumbnail["xlarge"]
82
+ end
83
+ xlg_thumbnails
84
+ end
85
+
86
+ def large_thumbnails
87
+ lg_thumbnails ||= []
88
+ for thumbnail in @thumbnails
89
+ lg_thumbnails << thumbnail["large"]
90
+ end
91
+ lg_thumbnails
92
+ end
93
+
94
+ def medium_thumbnails
95
+ md_thumbnails ||= []
96
+ for thumbnail in @thumbnails
97
+ md_thumbnails << thumbnail["medium"]
98
+ end
99
+ md_thumbnails
100
+ end
101
+
102
+ def small_thumbnails
103
+ sm_thumbnails ||= []
104
+ for thumbnail in @thumbnails
105
+ sm_thumbnails << thumbnail["small"]
106
+ end
107
+ sm_thumbnails
39
108
  end
40
109
  end
41
110
  end
@@ -1,3 +1,3 @@
1
1
  module GuideboxWrapper
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Baird
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,7 @@ files:
80
80
  - ".travis.yml"
81
81
  - CODE_OF_CONDUCT.md
82
82
  - Gemfile
83
+ - GuideboxWrapper-0.1.5.gem
83
84
  - GuideboxWrapper.gemspec
84
85
  - LICENSE.txt
85
86
  - README.md