Class: TMDBParty::Movie

Inherits:
Object
  • Object
show all
Includes:
Attributes
Defined in:
lib/tmdb_party/movie.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Attributes

included

Constructor Details

#initialize(values, tmdb) ⇒ Movie

Returns a new instance of Movie.



21
22
23
24
# File 'lib/tmdb_party/movie.rb', line 21

def initialize(values, tmdb)
  @tmdb = tmdb
  self.attributes = values
end

Instance Attribute Details

#tmdbObject (readonly)

Returns the value of attribute tmdb.



4
5
6
# File 'lib/tmdb_party/movie.rb', line 4

def tmdb
  @tmdb
end

Instance Method Details

#actorsObject



36
37
38
# File 'lib/tmdb_party/movie.rb', line 36

def actors
  find_cast('Actor')
end

#backdropsObject



48
49
50
# File 'lib/tmdb_party/movie.rb', line 48

def backdrops
  process_art(flattened_backdrops)
end

#directorsObject



32
33
34
# File 'lib/tmdb_party/movie.rb', line 32

def directors
  find_cast('Director')
end

#flattened_backdropsObject



19
# File 'lib/tmdb_party/movie.rb', line 19

alias_method :flattened_backdrops, :backdrops

#flattened_postersObject



18
# File 'lib/tmdb_party/movie.rb', line 18

alias_method :flattened_posters, :posters

#get_info!Object



26
27
28
29
30
# File 'lib/tmdb_party/movie.rb', line 26

def get_info!
  movie = tmdb.get_info(self.id)
  @attributes.merge!(movie.attributes) if movie
  @loaded = true
end

#postersObject



44
45
46
# File 'lib/tmdb_party/movie.rb', line 44

def posters
  process_art(flattened_posters)
end

#writersObject



40
41
42
# File 'lib/tmdb_party/movie.rb', line 40

def writers
  find_cast('Writer')
end