Sha256: d85eb00ab77067cce7fd311fe43a09430c6f65315b406b369943e3003c3f27fb

Contents?: true

Size: 904 Bytes

Versions: 8

Compression:

Stored size: 904 Bytes

Contents

require 'geocoder/results/base'

module Geocoder::Result
  class Yahoo < Base

    def address(format = :full)
      (1..4).to_a.map{ |i| @data["line#{i}"] }.reject{ |i| i.nil? or i == "" }.join(", ")
    end

    def city
      @data['city']
    end

    def country
      @data['country']
    end

    def country_code
      @data['countrycode']
    end

    def postal_code
      @data['postal']
    end

    def self.response_attributes
      %w[quality offsetlat offsetlon radius boundingbox name
        line1 line2 line3 line4 cross house street xstreet unittype unit postal
        neighborhood city county state country countrycode statecode countycode
        level0 level1 level2 level3 level4 level0code level1code level2code
        timezone areacode uzip hash woeid woetype]
    end

    response_attributes.each do |a|
      define_method a do
        @data[a]
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
geocoder-0.9.13 lib/geocoder/results/yahoo.rb
geocoder-0.9.12 lib/geocoder/results/yahoo.rb
rails-geocoder-0.9.11 lib/geocoder/results/yahoo.rb
geocoder-0.9.11 lib/geocoder/results/yahoo.rb
geocoder-0.9.10 lib/geocoder/results/yahoo.rb
rails-geocoder-0.9.10 lib/geocoder/results/yahoo.rb
rails-geocoder-0.9.9 lib/geocoder/results/yahoo.rb
geocoder-0.9.9 lib/geocoder/results/yahoo.rb