Class: Ym4r::YahooMaps::BuildingBlock::Traffic::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/ym4r/yahoo_maps/building_block/traffic.rb

Overview

Contains a result from the Yahoo! Maps Traffic REST service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def description
  @description
end

#directionObject

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def direction
  @direction
end

#end_dateObject

Returns the value of attribute end_date

Returns:

  • (Object)

    the current value of end_date



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def end_date
  @end_date
end

#image_urlObject

Returns the value of attribute image_url

Returns:

  • (Object)

    the current value of image_url



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def image_url
  @image_url
end

#latitudeObject

Returns the value of attribute latitude

Returns:

  • (Object)

    the current value of latitude



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def latitude
  @latitude
end

#longitudeObject

Returns the value of attribute longitude

Returns:

  • (Object)

    the current value of longitude



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def longitude
  @longitude
end

#report_dateObject

Returns the value of attribute report_date

Returns:

  • (Object)

    the current value of report_date



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def report_date
  @report_date
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def severity
  @severity
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def title
  @title
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def type
  @type
end

#update_dateObject

Returns the value of attribute update_date

Returns:

  • (Object)

    the current value of update_date



89
90
91
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89

def update_date
  @update_date
end

Instance Method Details

#download_to(file) ⇒ Object

Downloads the image (if there is one) to file.



92
93
94
95
96
97
98
99
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 92

def download_to(file)
  if has_image?
    data = open(image_url).read
    open(file,"wb") do |f|
      f.write data
    end
  end
end

#has_image?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 101

def has_image?
  ! image_url.nil?
end

#latlonObject

Convenience method for the lazy.



111
112
113
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 111

def latlon
  [latitude,longitude]
end

#lonlatObject

Convenience method for the lazy.



106
107
108
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 106

def lonlat
  [longitude,latitude]
end