Class: Allocine::Serie

Inherits:
AllocineBase show all
Defined in:
lib/allocine_parser/serie.rb

Instance Attribute Summary

Attributes inherited from AllocineBase

#id, #title, #url

Instance Method Summary collapse

Methods inherited from AllocineBase

#actors, #actors_ids, #actors_name, #countries, #directors, #directors_ids, #directors_name, #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


9
10
11
12
# File 'lib/allocine_parser/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_episodesObject


18
19
20
# File 'lib/allocine_parser/serie.rb', line 18

def number_of_episodes
  document["episodeCount"] rescue nil
end

#number_of_seasonsObject


14
15
16
# File 'lib/allocine_parser/serie.rb', line 14

def number_of_seasons
  document["seasonCount"] rescue nil
end

#season_idsObject


30
31
32
# File 'lib/allocine_parser/serie.rb', line 30

def season_ids
  document["season"].map { |season| season["code"]} rescue []
end

#seasonsObject


34
35
36
37
38
39
40
# File 'lib/allocine_parser/serie.rb', line 34

def seasons
  s = []
  season_ids.each do |allocine_id|
    s << Allocine::Season.new(allocine_id)
  end
  s
end

#year_endObject


26
27
28
# File 'lib/allocine_parser/serie.rb', line 26

def year_end
  document["yearEnd"] rescue nil
end

#year_startObject


22
23
24
# File 'lib/allocine_parser/serie.rb', line 22

def year_start
  document["yearStart"] rescue nil
end