film_on 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/film_on/models/movie.rb +18 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e90957e7c38e5ca34508ffaaf3401086d13fd86
4
- data.tar.gz: 72c2071448384b697a74d1dfd6655a0ec2e5d280
3
+ metadata.gz: 4787ad8b4cebe28bc0697fdd716a4c1a585a12b5
4
+ data.tar.gz: dd0e52bf341b6458aebeac666a3a18dd3f983722
5
5
  SHA512:
6
- metadata.gz: 1729168b90f1197aa23946b7a9171f994434fe06976c54c5c645c394157710afb61d82e7ac1838ccb289eacd8061eeb38ffc27754e77f74c3e868ebe6598e937
7
- data.tar.gz: c9689f75ed3fa79a49db0526c686aedc687abf6865a32e17c301bb1063c351d5d6d30831b5f07bb03cd7799899e41a658f35bdb412988be6b22921dd2f82e678
6
+ metadata.gz: ceb65b48a1bf538e31fd72934a794d1ee27f5205a2e77d8f469e16aa70d97e26ad8f06dc74d639cc9ad5c296fe9d04d80a4c1d62ddbb9591dbeab09903df7e09
7
+ data.tar.gz: 108a188e016bcaf4e3b42ef0c544c54755629f6c8a506e2b7b6a308890ca558ee809db4aec9337e3dc08a2a6dd1619873078ec0c4b2d123ab8343f2dce0dab28
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.13
1
+ 0.0.14
@@ -8,10 +8,12 @@ module FilmOn
8
8
 
9
9
  class Movie
10
10
 
11
+ Image = Struct.new(:type, :width, :height, :url)
12
+
11
13
  attr_reader :id, :title, :slug, :description, :type_id, :series_number, :episodes_count, :vendor_id, :vendorka_id
12
14
  attr_reader :content_host, :low_quality_file_id, :high_quality_file_id, :parent_id, :exists_on_edgecast
13
15
  attr_reader :is_featured, :is_enabled, :deleted_at, :genres, :cast, :crew, :artwork, :poster, :georule, :type
14
- attr_reader :streams, :content_blocked
16
+ attr_reader :streams, :content_blocked, :poster_small, :poster_medium, :poster_large
15
17
 
16
18
  def initialize(hash)
17
19
  @id = hash["id"]
@@ -35,13 +37,27 @@ module FilmOn
35
37
  @cast = hash["cast"]
36
38
  @crew = hash["crew"]
37
39
  @artwork = hash["artwork"] #TODO convert to image structs
38
- @poster = hash["poster"] #TODO convert to image structs
40
+ @poster = hash["poster"]
41
+ @poster_small = get_image(:small, hash["poster"])
42
+ @poster_medium = get_image(:medium, hash["poster"])
43
+ @poster_large = get_image(:large, hash["poster"])
39
44
  @georule = hash["georule"]
40
45
  @type = hash["type"]
41
46
  @streams = hash["streams"]
42
47
  @content_blocked = hash["content_blocked"]
43
48
  end
44
49
 
50
+ def get_image(type, image)
51
+ return {} unless image.is_a?(Hash)
52
+ case type
53
+ when :small
54
+ image = (image["thumbs"] && image["thumbs"]["thumb_120p"]) ? image["thumbs"]["thumb_120p"] : image
55
+ when :medium
56
+ image = (image["thumbs"] && image["thumbs"]["thumb_220p"]) ? image["thumbs"]["thumb_220p"] : image
57
+ end
58
+ Image.new(image["type"], image["width"], image["height"], image["url"])
59
+ end
60
+
45
61
  end
46
62
 
47
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: film_on
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Hanscombe