Class: TvdbPartyV2::Banner

Inherits:
Object
  • Object
show all
Defined in:
lib/tvdb_party_v2/banner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Banner

Returns a new instance of Banner.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tvdb_party_v2/banner.rb', line 5

def initialize(options = {})
  @banner_type = options["keyType"]
  @banner_resolution = options["resolution"]
  @subkey = options["subKey"]
  @path = options["fileName"]

  if options["ratingsInfo"]["average"] && options["ratingsInfo"]["average"] > 0
    @ratingaverage = options["ratingsInfo"]["average"].to_f
  else
    @ratingaverage = 0
  end

  if options["ratingsInfo"]["count"] && options["ratingsInfo"]["count"] > 0
    @ratingcount = options["ratingsInfo"]["count"]
  else
    @ratingcount = 0
  end

end

Instance Attribute Details

Returns the value of attribute banner_resolution.



3
4
5
# File 'lib/tvdb_party_v2/banner.rb', line 3

def banner_resolution
  @banner_resolution
end

Returns the value of attribute banner_type.



3
4
5
# File 'lib/tvdb_party_v2/banner.rb', line 3

def banner_type
  @banner_type
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/tvdb_party_v2/banner.rb', line 3

def path
  @path
end

#ratingaverageObject

Returns the value of attribute ratingaverage.



3
4
5
# File 'lib/tvdb_party_v2/banner.rb', line 3

def ratingaverage
  @ratingaverage
end

#ratingcountObject

Returns the value of attribute ratingcount.



3
4
5
# File 'lib/tvdb_party_v2/banner.rb', line 3

def ratingcount
  @ratingcount
end

#subkeyObject

Returns the value of attribute subkey.



3
4
5
# File 'lib/tvdb_party_v2/banner.rb', line 3

def subkey
  @subkey
end

#thumbnail_pathObject

Returns the value of attribute thumbnail_path.



3
4
5
# File 'lib/tvdb_party_v2/banner.rb', line 3

def thumbnail_path
  @thumbnail_path
end

Instance Method Details

#thumb_urlObject



29
30
31
# File 'lib/tvdb_party_v2/banner.rb', line 29

def thumb_url
  "https://www.thetvdb.com/banners/_cache/" + @path
end

#urlObject



25
26
27
# File 'lib/tvdb_party_v2/banner.rb', line 25

def url
  "https://www.thetvdb.com/banners/" + @path
end