Sha256: 45fc26137cbaaf0bf60716d3bd850ba8ba1a9226bbffdca239e6379e3819c054

Contents?: true

Size: 737 Bytes

Versions: 3

Compression:

Stored size: 737 Bytes

Contents

module Nytimes
	module Movies
		
		##
		# Represents a link returned from the Reviews API. Each link has a URL, suggested text, and a link_type which gives you some idea of what the remote
		# target of the link is. Possible link types include:
		# FIXME
		class Link
			attr_reader :link_type, :url, :suggested_text
			
			def initialize(hash={})
				@url = hash[:url]
				@link_type = hash[:link_type]
				@suggested_text = hash[:suggested_text]
			end
			
			##
			# Create a Link object from a hash snippet returned from the API. You should never need to call this.
			def self.create_from_api(hash={})
				Link.new :url => hash['url'], :link_type => hash['type'], :suggested_text => hash['suggested_link_text']
			end
		end
	end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
harrisj-nytimes-movies-0.1.0 lib/nytimes/movies/link.rb
harrisj-nytimes-movies-0.1.1 lib/nytimes/movies/link.rb
nytimes-movies-0.1.1 lib/nytimes/movies/link.rb