Class: TMDBParty::Movie
- Inherits:
-
Object
- Object
- TMDBParty::Movie
- Includes:
- Attributes
- Defined in:
- lib/tmdb_party/movie.rb
Instance Attribute Summary collapse
-
#tmdb ⇒ Object
readonly
Returns the value of attribute tmdb.
Instance Method Summary collapse
- #actors ⇒ Object
- #cast ⇒ Object
- #directors ⇒ Object
- #get_info! ⇒ Object
-
#initialize(values, tmdb) ⇒ Movie
constructor
A new instance of Movie.
- #language ⇒ Object
- #last_modified_at ⇒ Object
- #producers ⇒ Object
- #writers ⇒ Object
Methods included from Attributes
Constructor Details
#initialize(values, tmdb) ⇒ Movie
Returns a new instance of Movie.
22 23 24 25 |
# File 'lib/tmdb_party/movie.rb', line 22 def initialize(values, tmdb) @tmdb = tmdb self.attributes = values end |
Instance Attribute Details
#tmdb ⇒ Object (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
#actors ⇒ Object
51 52 53 |
# File 'lib/tmdb_party/movie.rb', line 51 def actors find_cast('Actors') end |
#cast ⇒ Object
33 34 35 36 |
# File 'lib/tmdb_party/movie.rb', line 33 def cast # TODO: This needs refactoring CastMember.parse(read_or_load_attribute('cast', nil, :get_info!), tmdb) end |
#directors ⇒ Object
47 48 49 |
# File 'lib/tmdb_party/movie.rb', line 47 def directors find_cast('Directing') end |
#get_info! ⇒ Object
27 28 29 30 31 |
# File 'lib/tmdb_party/movie.rb', line 27 def get_info! movie = tmdb.get_info(self.id) @attributes.merge!(movie.attributes) if movie @loaded = true end |
#language ⇒ Object
38 39 40 |
# File 'lib/tmdb_party/movie.rb', line 38 def language read_attribute('language').downcase.to_sym end |
#last_modified_at ⇒ Object
42 43 44 45 |
# File 'lib/tmdb_party/movie.rb', line 42 def last_modified_at # Date from TMDB is always in MST, but no timezone is present in date string Time.parse(read_attribute('last_modified_at') + ' MST') end |
#producers ⇒ Object
59 60 61 |
# File 'lib/tmdb_party/movie.rb', line 59 def producers find_cast('Production') end |
#writers ⇒ Object
55 56 57 |
# File 'lib/tmdb_party/movie.rb', line 55 def writers find_cast('Writing') end |