Class: Allocine::Serie
Instance Attribute Summary
Attributes inherited from AllocineBase
#id, #title, #url
Instance Method Summary
collapse
#actors, #countries, #directors, #genres, #length, #original_title, #plot, #poster, #press_rating, #production_year, #release_date, #trailer, #trailer_id, #user_rating
Constructor Details
#initialize(allocine_id, title = nil) ⇒ Serie
Returns a new instance of Serie.
9
10
11
12
|
# File 'lib/allocine/serie.rb', line 9
def initialize(allocine_id, title = nil)
@id = allocine_id
@url = "http://api.allocine.fr/rest/v3/tvseries?partner=YW5kcm9pZC12M3M&code=#{allocine_id}&profile=large&format=json"
end
|
Instance Method Details
#number_of_episodes ⇒ Object
18
19
20
|
# File 'lib/allocine/serie.rb', line 18
def number_of_episodes
document["episodeCount"] rescue nil
end
|
#number_of_seasons ⇒ Object
14
15
16
|
# File 'lib/allocine/serie.rb', line 14
def number_of_seasons
document["seasonCount"] rescue nil
end
|
#season_ids ⇒ Object
30
31
32
|
# File 'lib/allocine/serie.rb', line 30
def season_ids
document["season"].map { |season| season["code"]} rescue []
end
|
#seasons ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/allocine/serie.rb', line 34
def seasons
s = []
season_ids.each do |allocine_id|
s << Allocine::Season.new(allocine_id)
end
s
end
|
#year_end ⇒ Object
26
27
28
|
# File 'lib/allocine/serie.rb', line 26
def year_end
document["yearEnd"] rescue nil
end
|
#year_start ⇒ Object
22
23
24
|
# File 'lib/allocine/serie.rb', line 22
def year_start
document["yearStart"] rescue nil
end
|