Sha256: 85e7cf67bcb53d117ca24cb737f43d389aca047c84babbe25002d4fe392a2bff

Contents?: true

Size: 792 Bytes

Versions: 4

Compression:

Stored size: 792 Bytes

Contents

module TMDBParty
  class Movie
    include Attributes
    attr_reader :tmdb
    
    attributes :title, :short_overview, :id, :score, :imdb, :type, :url, :popularity, :alternative_title
    attributes :release, :type=>DateTime
    attributes :id, :type => Integer
    attributes :popularity, :score, :type => Float
    attributes :poster, :backdrop, :type => Image
    
    attributes :homepage, :lazy => :get_info!
    attributes :trailer, :lazy => :get_info!, :type=> Video
    attributes :categories, :lazy => :get_info!, :type=> Category
    
    def initialize(values, tmdb)
      @tmdb = tmdb
      self.attributes = values
    end
    
    def get_info!
      movie = tmdb.get_info(self.id)
      @attributes.merge!(movie.attributes) if movie
      @loaded = true
    end

  end
  
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
jduff-tmdb_party-0.0.2 lib/tmdb_party/movie.rb
jduff-tmdb_party-0.1.0 lib/tmdb_party/movie.rb
maddox-tmdb_party-0.1.0 lib/tmdb_party/movie.rb
maddox-tmdb_party-0.2.0 lib/tmdb_party/movie.rb