Class: Ym4r::YahooMaps::BuildingBlock::Traffic::Result
- Inherits:
-
Struct
- Object
- Struct
- Ym4r::YahooMaps::BuildingBlock::Traffic::Result
- 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
-
#description ⇒ Object
Returns the value of attribute description.
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#report_date ⇒ Object
Returns the value of attribute report_date.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#update_date ⇒ Object
Returns the value of attribute update_date.
Instance Method Summary collapse
-
#download_to(file) ⇒ Object
Downloads the image (if there is one) to
file. - #has_image? ⇒ Boolean
-
#latlon ⇒ Object
Convenience method for the lazy.
-
#lonlat ⇒ Object
Convenience method for the lazy.
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def description @description end |
#direction ⇒ Object
Returns the value of attribute direction
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def direction @direction end |
#end_date ⇒ Object
Returns the value of attribute end_date
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def end_date @end_date end |
#image_url ⇒ Object
Returns the value of attribute image_url
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def image_url @image_url end |
#latitude ⇒ Object
Returns the value of attribute latitude
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def longitude @longitude end |
#report_date ⇒ Object
Returns the value of attribute report_date
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def report_date @report_date end |
#severity ⇒ Object
Returns the value of attribute severity
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def severity @severity end |
#title ⇒ Object
Returns the value of attribute title
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def title @title end |
#type ⇒ Object
Returns the value of attribute type
89 90 91 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 89 def type @type end |
#update_date ⇒ Object
Returns the value of attribute 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
101 102 103 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 101 def has_image? ! image_url.nil? end |
#latlon ⇒ Object
Convenience method for the lazy.
111 112 113 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 111 def latlon [latitude,longitude] end |
#lonlat ⇒ Object
Convenience method for the lazy.
106 107 108 |
# File 'lib/ym4r/yahoo_maps/building_block/traffic.rb', line 106 def lonlat [longitude,latitude] end |