netflix_roulette 0.0.2 → 1.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 +8 -8
- data/lib/netflix_roulette.rb +19 -11
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTFmNWM5MDAxOGViZThkYTM1ZTIyYzhhYjYxMmNkNjQ4N2E5YjFmNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzBjZjE1MGQ0MWYzZGViZjM4NTkxMWRlMjJlNTUwM2M3YWQ1M2Y4OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzhjZWQ4ODE4ZjA0MWMzNmU5NWYxZjJkYTk3ZTc1YjA1MzNiMmQzMDMwOTY3
|
10
|
+
YjE2M2M5ZGZlM2NiNzM0YjAyYjcwYjY3YWQzYzUwNWIxZWIzYjdjMjhhNGVl
|
11
|
+
YTlhNDI4NDExY2FkMzUzOWY4MGU4NDg1ZTc5YTM1MjRiZjgwMDc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTdlNDBkZTZkOWVmNzkxNDJjYjkxY2RkN2Y2NDU5MmI2ZThkMTczZjA4MTNk
|
14
|
+
NzRkZGMyNTNmMWY5NzAxMzU2NDFhMzAwNjc0Y2U3ZjliNzFiMTE0OWU1Njc2
|
15
|
+
YjlmNGJmM2M0N2ZjYzlmZDhkN2U4ZDYyNDY0ZTc1OGE5Nzc2OWU=
|
data/lib/netflix_roulette.rb
CHANGED
@@ -12,15 +12,24 @@ class NetflixRoulette
|
|
12
12
|
get_media_category: "category",
|
13
13
|
get_media_summary: "summary",
|
14
14
|
get_media_director: "director",
|
15
|
-
get_netflix_id: "show_id"
|
15
|
+
get_netflix_id: "show_id",
|
16
|
+
get_runtime: "runtime"
|
16
17
|
}.each_pair do |method_name, key|
|
17
18
|
define_method method_name do |title, year = 0|
|
18
|
-
client(title, year).fetch[key] || "Unable to locate data"
|
19
|
+
client(title: title, year: year).fetch[key] || "Unable to locate data"
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
def get_all_data(title, year = 0)
|
23
|
-
client(title, year).fetch
|
24
|
+
client(title: title, year: year).fetch
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_media_for_actor(actor)
|
28
|
+
client(actor: actor).fetch
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_media_for_director(director)
|
32
|
+
client(director: director).fetch
|
24
33
|
end
|
25
34
|
|
26
35
|
def get_version
|
@@ -29,8 +38,8 @@ class NetflixRoulette
|
|
29
38
|
|
30
39
|
private
|
31
40
|
|
32
|
-
def client(
|
33
|
-
Client.new
|
41
|
+
def client(query)
|
42
|
+
Client.new query
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|
@@ -38,11 +47,10 @@ class NetflixRoulette
|
|
38
47
|
API_URL = URI("http://netflixroulette.net/api/api.php")
|
39
48
|
API_VERSION = "5.0"
|
40
49
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
@
|
45
|
-
@year = year
|
50
|
+
def initialize(query = {})
|
51
|
+
{ year: 0 }.merge(query) if query.has_key? :title
|
52
|
+
|
53
|
+
@query = query
|
46
54
|
end
|
47
55
|
|
48
56
|
def version
|
@@ -51,7 +59,7 @@ class NetflixRoulette
|
|
51
59
|
|
52
60
|
def fetch
|
53
61
|
uri = API_URL
|
54
|
-
uri.query = URI.encode_www_form
|
62
|
+
uri.query = URI.encode_www_form @query
|
55
63
|
response = Net::HTTP.get_response uri
|
56
64
|
|
57
65
|
result = JSON.parse response.body
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netflix_roulette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Österreicher
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webmock
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: A simple interface to access the Netflix Roulette API http://netflixroulette.net/api/
|
42
70
|
email: d.oesterreicher@gmail.com
|
43
71
|
executables: []
|