movie_db_gem 0.0.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/lib/movie_db_gem.rb +266 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 96f498a99b4824783dd21a909906e66bbd130f41
|
4
|
+
data.tar.gz: 1ac74088c3c276651be348030997098f97c21c2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e14a2d94b09cbf34d9ca9e736a34f6ce55f4a818e3214402e4f2b803a292a7c50f6d94b08989a3be6b1bf292b954311b0fc4341a7514fbc8438cb3bf144aafbe
|
7
|
+
data.tar.gz: 381140f29dbe84ea763477fc8b8d54cc4cba836e04b0944367da7c57745c74f3f96a888d96a6716f2d7137b20c80f9c810d1bccb4eeb74ae2f4b3105e289bee2
|
data/lib/movie_db_gem.rb
ADDED
@@ -0,0 +1,266 @@
|
|
1
|
+
module MovieDb
|
2
|
+
|
3
|
+
class Movie < Hash
|
4
|
+
|
5
|
+
require 'httparty'
|
6
|
+
require 'hashie'
|
7
|
+
include Hashie::Extensions::Coercion
|
8
|
+
include HTTParty
|
9
|
+
|
10
|
+
@@api_key = "?api_key=0e69e03e8a23c5237e072ba9f699081c"
|
11
|
+
@@base_url = "https://api.themoviedb.org/3/"
|
12
|
+
|
13
|
+
def self.result(url)
|
14
|
+
movie_result = get(url)
|
15
|
+
movie_results = Hashie::Mash.new(movie_result)
|
16
|
+
return movie_results
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.search(query)
|
20
|
+
url = @@base_url + "search/movie" + @@api_key
|
21
|
+
query.each { |key, value| url = url + "&#{key}=#{value}" }
|
22
|
+
if result(url).status_code
|
23
|
+
return "Request not valid"
|
24
|
+
else
|
25
|
+
return result(url)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.upcoming
|
30
|
+
url = @@base_url + "movie/upcoming" + @@api_key
|
31
|
+
if result(url).status_code
|
32
|
+
return "Request not valid"
|
33
|
+
else
|
34
|
+
return result(url)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.top_rated
|
39
|
+
url = @@base_url + "movie/top_rated" + @@api_key
|
40
|
+
if result(url).status_code
|
41
|
+
return "Request not valid"
|
42
|
+
else
|
43
|
+
return result(url)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.popular
|
48
|
+
url = @@base_url + "movie/popular" + @@api_key
|
49
|
+
if result(url).status_code
|
50
|
+
return "Request not valid"
|
51
|
+
else
|
52
|
+
return result(url)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.latest
|
57
|
+
url = @@base_url + "movie/latest" + @@api_key
|
58
|
+
if result(url).status_code
|
59
|
+
return "Request not valid"
|
60
|
+
else
|
61
|
+
return result(url)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.now_playing
|
66
|
+
url = @@base_url + "movie/now_playing" + @@api_key
|
67
|
+
if result(url).status_code
|
68
|
+
return "Request not valid"
|
69
|
+
else
|
70
|
+
return result(url)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.account_states(id)
|
75
|
+
url = @@base_url + "movie/" + id.to_s + "/account_states" + @@api_key
|
76
|
+
if result(url).status_code
|
77
|
+
return "Request not valid"
|
78
|
+
else
|
79
|
+
return result(url)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.alternative_titles(id)
|
84
|
+
url = @@base_url + "movie/" + id.to_s + "/alternative_titles" + @@api_key
|
85
|
+
return result(url)
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.credits(id)
|
89
|
+
url = @@base_url + "movie/" + id.to_s + "/credits" + @@api_key
|
90
|
+
if result(url).status_code
|
91
|
+
return "Request not valid"
|
92
|
+
else
|
93
|
+
return result(url)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.images(id)
|
98
|
+
url = @@base_url + "movie/" + id.to_s + "/images" + @@api_key
|
99
|
+
if result(url).status_code
|
100
|
+
return "Request not valid"
|
101
|
+
else
|
102
|
+
return result(url)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.keywords(id)
|
107
|
+
url = @@base_url + "movie/" + id.to_s + "/keywords" + @@api_key
|
108
|
+
if result(url).status_code
|
109
|
+
return "Request not valid"
|
110
|
+
else
|
111
|
+
return result(url)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.releases(id)
|
116
|
+
url = @@base_url + "movie/" + id.to_s + "/releases" + @@api_key
|
117
|
+
if result(url).status_code
|
118
|
+
return "Request not valid"
|
119
|
+
else
|
120
|
+
return result(url)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.videos(id)
|
125
|
+
url = @@base_url + "movie/" + id.to_s + "/videos" + @@api_key
|
126
|
+
if result(url).status_code
|
127
|
+
return "Request not valid"
|
128
|
+
else
|
129
|
+
return result(url)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.translations(id)
|
134
|
+
url = @@base_url + "movie/" + id.to_s + "/translations" + @@api_key
|
135
|
+
if result(url).status_code
|
136
|
+
return "Request not valid"
|
137
|
+
else
|
138
|
+
return result(url)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.similar(id)
|
143
|
+
url = @@base_url + "movie/" + id.to_s + "/similar" + @@api_key
|
144
|
+
if result(url).status_code
|
145
|
+
return "Request not valid"
|
146
|
+
else
|
147
|
+
return result(url)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.reviews(id)
|
152
|
+
url = @@base_url + "movie/" + id.to_s + "/reviews" + @@api_key
|
153
|
+
if result(url).status_code
|
154
|
+
return "Request not valid"
|
155
|
+
else
|
156
|
+
return result(url)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def self.lists(id)
|
161
|
+
url = @@base_url + "movie/" + id.to_s + "/lists" + @@api_key
|
162
|
+
if result(url).status_code
|
163
|
+
return "Request not valid"
|
164
|
+
else
|
165
|
+
return result(url)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def self.changes(id)
|
170
|
+
url = @@base_url + "movie/" + id.to_s + "/changes" + @@api_key
|
171
|
+
if result(url).status_code
|
172
|
+
return "Request not valid"
|
173
|
+
else
|
174
|
+
return result(url)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def self.trailers(id)
|
179
|
+
url = @@base_url + "movie/" + id.to_s + "/trailers" + @@api_key
|
180
|
+
if result(url).status_code
|
181
|
+
return "Request not valid"
|
182
|
+
else
|
183
|
+
return result(url)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.similar_movies(id)
|
188
|
+
url = @@base_url + "movie/" + id.to_s + "/similar_movies" + @@api_key
|
189
|
+
if result(url).status_code
|
190
|
+
return "Request not valid"
|
191
|
+
else
|
192
|
+
return result(url)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
class Tv < Hash
|
199
|
+
|
200
|
+
require 'httparty'
|
201
|
+
require 'hashie'
|
202
|
+
include Hashie::Extensions::Coercion
|
203
|
+
include HTTParty
|
204
|
+
|
205
|
+
def self.search(query)
|
206
|
+
@api_key = "?api_key=0e69e03e8a23c5237e072ba9f699081c"
|
207
|
+
@base_url = "https://api.themoviedb.org/3/"
|
208
|
+
url = @base_url + "search/tv" + @api_key + "&query=" + query
|
209
|
+
tv_result = get(url)
|
210
|
+
tv_results = Hashie::Mash.new(tv_result)
|
211
|
+
return tv_results
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
class Collection < Hash
|
217
|
+
|
218
|
+
require 'httparty'
|
219
|
+
require 'hashie'
|
220
|
+
include Hashie::Extensions::Coercion
|
221
|
+
include HTTParty
|
222
|
+
|
223
|
+
def self.search(query)
|
224
|
+
@api_key = "?api_key=0e69e03e8a23c5237e072ba9f699081c"
|
225
|
+
@base_url = "https://api.themoviedb.org/3/"
|
226
|
+
url = @base_url + "search/collection" + @api_key + "&query=" + query
|
227
|
+
return get(url)
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
class Person < Hash
|
233
|
+
|
234
|
+
require 'httparty'
|
235
|
+
require 'hashie'
|
236
|
+
include Hashie::Extensions::Coercion
|
237
|
+
include HTTParty
|
238
|
+
|
239
|
+
def self.search(query)
|
240
|
+
@api_key = "?api_key=0e69e03e8a23c5237e072ba9f699081c"
|
241
|
+
@base_url = "https://api.themoviedb.org/3/"
|
242
|
+
url = @base_url + "search/person" + @api_key + "&query=" + query
|
243
|
+
person_result = get(url)
|
244
|
+
person_results = Hashie::Mash.new(person_result)
|
245
|
+
return person_results
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
class Company < Hash
|
251
|
+
|
252
|
+
require 'httparty'
|
253
|
+
require 'hashie'
|
254
|
+
include Hashie::Extensions::Coercion
|
255
|
+
include HTTParty
|
256
|
+
|
257
|
+
def self.search(query)
|
258
|
+
@api_key = "?api_key=0e69e03e8a23c5237e072ba9f699081c"
|
259
|
+
@base_url = "https://api.themoviedb.org/3/"
|
260
|
+
url = @base_url + "search/company" + @api_key + "&query=" + query
|
261
|
+
return get(url)
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: movie_db_gem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- me
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2011-09-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/movie_db_gem.rb
|
20
|
+
homepage:
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.4.7
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: movie_db_gem is the best
|
43
|
+
test_files: []
|