Class: HeadlineResponse::HeadlineItem::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/espn_rb/headline_image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image) ⇒ Image



23
24
25
# File 'lib/espn_rb/headline_image.rb', line 23

def initialize(image)
  @image = image
end

Instance Attribute Details

#imageObject (readonly)

Returns the value of attribute image.



21
22
23
# File 'lib/espn_rb/headline_image.rb', line 21

def image
  @image
end

Instance Method Details

#captionObject

returns caption of image



38
39
40
# File 'lib/espn_rb/headline_image.rb', line 38

def caption
  @image["caption"]
end

#creditObject

returns credit (attribution) of image



53
54
55
# File 'lib/espn_rb/headline_image.rb', line 53

def credit
  @image["credit"]
end

#heightObject

returns height of image



63
64
65
# File 'lib/espn_rb/headline_image.rb', line 63

def height
  @image["height"]
end

#landscape?Boolean

returns true if the image is landscape oriented.



28
29
30
# File 'lib/espn_rb/headline_image.rb', line 28

def landscape?
  @image["width"] > @image["height"]
end

#nameObject

returns name of image



43
44
45
# File 'lib/espn_rb/headline_image.rb', line 43

def name
  @image["name"]
end

#portrait?Boolean

returns true if the image is portrait oriented.



33
34
35
# File 'lib/espn_rb/headline_image.rb', line 33

def portrait?
  !landscape?
end

#urlObject

returns url of image



48
49
50
# File 'lib/espn_rb/headline_image.rb', line 48

def url
  @image["url"]
end

#widthObject

returns width of image



58
59
60
# File 'lib/espn_rb/headline_image.rb', line 58

def width
  @image["width"]
end