film_on 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/film_on/base.rb +4 -3
- data/lib/film_on/services.rb +21 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9efdd8dd4b4cdcca8b5a343771f6df528fdd4380
|
4
|
+
data.tar.gz: bb6089ae1d5deb0456fc66b27a700ec4b3d2fd70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb4467b49dade7576649770380ec9d1c013e937f29200ede41dbab47b3e95ffffb5e87b5298a614470ef796895759ac720df30e12d6442c4f4c486c7c77936d7
|
7
|
+
data.tar.gz: c3b47e63d510f8f9dfb0d89a44cc29b6d8cdad7f1954fe4d86a9fc189591f577512790b8ee743d9634479bd766229782e216a0a4dcebfddafb5e50dfd4100b6b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/film_on/base.rb
CHANGED
@@ -19,7 +19,8 @@ module FilmOn
|
|
19
19
|
|
20
20
|
def init_request
|
21
21
|
response = get("init")
|
22
|
-
|
22
|
+
init_hash = JSON.parse(response)
|
23
|
+
@session_key = init_hash["session_key"]
|
23
24
|
self
|
24
25
|
end
|
25
26
|
|
@@ -31,7 +32,7 @@ module FilmOn
|
|
31
32
|
full_service_url = "#{protocol}#{URI}#{service}"
|
32
33
|
response = HTTParty.post(full_service_url, {body: query, headers: {'Content-Type' => 'application/json'}})
|
33
34
|
if response && response.code == 200
|
34
|
-
return
|
35
|
+
return response.body
|
35
36
|
else
|
36
37
|
response.response
|
37
38
|
end
|
@@ -43,7 +44,7 @@ module FilmOn
|
|
43
44
|
full_service_url = "#{protocol}#{URI}#{service}?#{query.map{|k,v| "#{k}=#{v}"}.join("&")}"
|
44
45
|
response = HTTParty.get(full_service_url)
|
45
46
|
if response && response.code == 200
|
46
|
-
return
|
47
|
+
return response.body
|
47
48
|
else
|
48
49
|
response.response
|
49
50
|
end
|
data/lib/film_on/services.rb
CHANGED
@@ -2,21 +2,36 @@ module FilmOn
|
|
2
2
|
|
3
3
|
module Services
|
4
4
|
|
5
|
-
def channel(id)
|
5
|
+
def channel(id, opts={})
|
6
6
|
return @channel[id] if @channel[id]
|
7
|
-
|
7
|
+
json = get("channel/#{id}")
|
8
|
+
if opts[:json]
|
9
|
+
@channel[id] = json
|
10
|
+
return json
|
11
|
+
end
|
12
|
+
hash = JSON.parse(json)
|
8
13
|
@channel[id] = FilmOn::Channel.new(hash)
|
9
14
|
end
|
10
15
|
|
11
|
-
def channels
|
16
|
+
def channels(opts={})
|
12
17
|
return @channels if @channels
|
13
|
-
|
18
|
+
json = get("channels")
|
19
|
+
if opts[:json]
|
20
|
+
@channels = json
|
21
|
+
return json
|
22
|
+
end
|
23
|
+
hash = JSON.parse(json)
|
14
24
|
@channels = hash.map{|ch| FilmOn::Channel.new(ch)}
|
15
25
|
end
|
16
26
|
|
17
|
-
def groups
|
27
|
+
def groups(opts={})
|
18
28
|
return @groups if @groups
|
19
|
-
|
29
|
+
json = get("groups")
|
30
|
+
if opts[:json]
|
31
|
+
@groups = json
|
32
|
+
return json
|
33
|
+
end
|
34
|
+
hash = JSON.parse(json)
|
20
35
|
@groups = hash.map{|gr| FilmOn::Group.new(gr)}
|
21
36
|
end
|
22
37
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: film_on
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Hanscombe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|