Class: WikipediaRestClient::ImageOfTheDay
- Inherits:
-
Object
- Object
- WikipediaRestClient::ImageOfTheDay
- Defined in:
- lib/wikipedia_rest_client/image_of_the_day.rb
Overview
Instance Method Summary collapse
-
#description_text ⇒ Object
Returns description about the image.
-
#image_height ⇒ Object
Returns height of the image.
-
#image_url ⇒ Object
Returns the URL of the image.
-
#image_width ⇒ Object
Returns width of the image.
-
#initialize(json) ⇒ ImageOfTheDay
constructor
Returns.
-
#thumbnail ⇒ Object
Returns the source of the thumbnail image.
-
#thumbnail_height ⇒ Object
Returns height of thumbnail.
-
#thumbnail_width ⇒ Object
Returns width of thumbnail.
-
#title ⇒ Object
Returns the tile of ImageOfTheDay.
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_text ⇒ Object
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_height ⇒ Object
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_url ⇒ Object
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_width ⇒ Object
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 |
#thumbnail ⇒ Object
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_height ⇒ Object
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_width ⇒ Object
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 |
#title ⇒ Object
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 |