Sha256: 3110752c617ae34b7c7f13fc961156df318fa57367f1f63d9d2e797d7ccbf4c1
Contents?: true
Size: 928 Bytes
Versions: 3
Compression:
Stored size: 928 Bytes
Contents
module Nytimes module Movies ## # Represents a link to a multimedia asset from the New York Times. Invariably these are images or thumbnails, but it could also be expanded to # include movies or sound. The following attributes are part of the link. FIXME class MultimediaLink attr_reader :media_type, :url, :height, :width, :credit private_class_method :new def initialize(hash={}) hash.each_pair do |k,v| instance_variable_set("@#{k}", v) end end ## # Create a MultimediaLink object from a hash snippet returned from the API. You should never need to call this. def self.create_from_api(hash={}) return nil if hash.nil? || hash.empty? if hash.key? 'resource' hash = hash['resource'] end new(:media_type => hash['type'], :url => hash['src'], :height => hash['height'], :width => hash['width'], :credit => hash['credit']) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems