Class: Allocine::Season

Inherits:
Object
  • Object
show all
Defined in:
lib/allocine/season.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Season

Returns a new instance of Season.



11
12
13
14
# File 'lib/allocine/season.rb', line 11

def initialize(id)
  @id = id
  @episodes = []
end

Instance Attribute Details

#episodesObject

Returns an Array of Allocine::Episode



42
43
44
# File 'lib/allocine/season.rb', line 42

def episodes
  @episodes
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/allocine/season.rb', line 4

def id
  @id
end

#season_numberObject

Returns season number



22
23
24
# File 'lib/allocine/season.rb', line 22

def season_number
  @season_number
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/allocine/season.rb', line 4

def url
  @url
end

Instance Method Details

#episode_countObject

Returns numbers of episode



27
28
29
# File 'lib/allocine/season.rb', line 27

def episode_count
  document["episodeCount"] rescue nil
end

#episode_idsObject

Returns an Array of episode ids



37
38
39
# File 'lib/allocine/season.rb', line 37

def episode_ids
  document["episode"].map { |episode| episode["code"]} rescue []
end

#episode_numbersObject

Returns numbers of episode



32
33
34
# File 'lib/allocine/season.rb', line 32

def episode_numbers
  document["episode"].size rescue nil
end

#serieObject

Returns parent serie



17
18
19
# File 'lib/allocine/season.rb', line 17

def serie
  Allocine::Serie.new(document["parentSeries"]["code"])
end