Sha256: 5af594c06895ccc630479db819bd840316ae8acce0cfbeebede0f53502d012ab

Contents?: true

Size: 862 Bytes

Versions: 2

Compression:

Stored size: 862 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, :runtime, :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
    attributes :people, :lazy => :get_info!, :type=> Person
    
    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

2 entries across 2 versions & 2 rubygems

Version Path
jduff-tmdb_party-0.2.1 lib/tmdb_party/movie.rb
maddox-tmdb_party-0.2.1 lib/tmdb_party/movie.rb