Class: WikipediaRestClient::ImageOfTheDay

Inherits:
Object
  • Object
show all
Defined in:
lib/wikipedia_rest_client/image_of_the_day.rb

Overview

Author:

  • Balaji

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ ImageOfTheDay

Returns



8
9
10
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 8

def initialize(json)
	@data = json["image"]
end

Instance Method Details

#description_textObject

Returns description about the image



48
49
50
51
52
53
54
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 48

def description_text
	if @data["description"] 
		html_data = @data["description"]["text"] 
		parsed_data = Nokogiri::HTML(html_data)
		parsed_data.text
	end
end

#image_heightObject

Returns height of the image



28
29
30
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 28

def image_height
	@data["image"]["height"]
end

#image_urlObject

Returns the URL of the image



18
19
20
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 18

def image_url
	@data["image"]["source"]
end

#image_widthObject

Returns width of the image



23
24
25
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 23

def image_width
	@data["image"]["width"]
end

#thumbnailObject

Returns the source of the thumbnail image



33
34
35
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 33

def thumbnail
	@data["thumbnail"]["source"]
end

#thumbnail_heightObject

Returns height of thumbnail



43
44
45
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 43

def thumbnail_height
	@data["thumbnail"]["height"]
end

#thumbnail_widthObject

Returns width of thumbnail



38
39
40
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 38

def thumbnail_width
	@data["thumbnail"]["width"]
end

#titleObject

Returns the tile of ImageOfTheDay



13
14
15
# File 'lib/wikipedia_rest_client/image_of_the_day.rb', line 13

def title
	@data["title"]
end