Class: Ym4r::YahooMaps::BuildingBlock::MapImage::Result

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

Overview

Contains a result match from the Yahoo! Maps Map Image service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



56
57
58
# File 'lib/ym4r/yahoo_maps/building_block/map_image.rb', line 56

def url
  @url
end

#warningObject

Returns the value of attribute warning

Returns:

  • (Object)

    the current value of warning



56
57
58
# File 'lib/ym4r/yahoo_maps/building_block/map_image.rb', line 56

def warning
  @warning
end

Instance Method Details

#download_to(file) ⇒ Object

Downloads the image to file.



59
60
61
62
63
64
# File 'lib/ym4r/yahoo_maps/building_block/map_image.rb', line 59

def download_to(file)
  data = open(url).read
  open(file,"wb") do |f|
    f.write data
  end
end

#exact_match?Boolean

Indicates if the location passed in the request could be exactly identified.

Returns:

  • (Boolean)


67
68
69
# File 'lib/ym4r/yahoo_maps/building_block/map_image.rb', line 67

def exact_match?
  warning.nil?
end