Sha256: e65cf03ce0916b04ec76fda0b8be37e93902247dd100ebdc67e24b943985adcd
Contents?: true
Size: 954 Bytes
Versions: 3
Compression:
Stored size: 954 Bytes
Contents
require 'nokogiri' module WikipediaRestClient # @author Balaji class ImageOfTheDay # Returns def initialize(json) @data = json["image"] end # Returns the tile of ImageOfTheDay def title @data["title"] end # Returns the URL of the image def image_url @data["image"]["source"] end # Returns width of the image def image_width @data["image"]["width"] end # Returns height of the image def image_height @data["image"]["height"] end # Returns the source of the thumbnail image def thumbnail @data["thumbnail"]["source"] end # Returns width of thumbnail def thumbnail_width @data["thumbnail"]["width"] end # Returns height of thumbnail def thumbnail_height @data["thumbnail"]["height"] end # Returns description about the image def description_text html_data = @data["description"]["text"] parsed_data = Nokogiri::HTML(html_data) parsed_data.text end end end
Version data entries
3 entries across 3 versions & 1 rubygems