Class: YahooWeather::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/yahoo-weather/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Image

Returns a new instance of Image.



18
19
20
21
22
23
24
# File 'lib/yahoo-weather/image.rb', line 18

def initialize (payload)
  @title = payload.xpath('title').first.content
  @link = payload.xpath('link').first.content
  @url = payload.xpath('url').first.content
  @height = payload.xpath('height').first.content.to_i
  @width = payload.xpath('width').first.content.to_i
end

Instance Attribute Details

#heightObject (readonly)

the height of the image in pixels.



3
4
5
# File 'lib/yahoo-weather/image.rb', line 3

def height
  @height
end

the url intended to be used as a link wrapping the image, for instance, to send the user to the main Yahoo Weather home page.



7
8
9
# File 'lib/yahoo-weather/image.rb', line 7

def link
  @link
end

#titleObject (readonly)

the title of hte image.



10
11
12
# File 'lib/yahoo-weather/image.rb', line 10

def title
  @title
end

#urlObject (readonly)

the full url to the image.



13
14
15
# File 'lib/yahoo-weather/image.rb', line 13

def url
  @url
end

#widthObject (readonly)

the width of the image in pixels.



16
17
18
# File 'lib/yahoo-weather/image.rb', line 16

def width
  @width
end