Sha256: 67160c633b3709a660cc2066fe01f2de812caafc73259f65ee76cbe230e26a34

Contents?: true

Size: 1.08 KB

Versions: 25

Compression:

Stored size: 1.08 KB

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 state
      @data['state']
    end

    def state_code
      @data['statecode']
    end

    def country
      @data['country']
    end

    def country_code
      @data['countrycode']
    end

    def postal_code
      @data['postal']
    end

    def address_hash
      @data['hash']
    end

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

    response_attributes.each do |a|
      unless method_defined?(a)
        define_method a do
          @data[a]
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
geocoder-1.3.0 lib/geocoder/results/yahoo.rb
geocoder-1.2.14 lib/geocoder/results/yahoo.rb
geocoder-1.2.13 lib/geocoder/results/yahoo.rb
geocoder-1.2.12 lib/geocoder/results/yahoo.rb
geocoder-1.2.11 lib/geocoder/results/yahoo.rb
geocoder-1.2.10 lib/geocoder/results/yahoo.rb
geocoder-1.2.9 lib/geocoder/results/yahoo.rb
geocoder-1.2.8 lib/geocoder/results/yahoo.rb
geocoder-1.2.7 lib/geocoder/results/yahoo.rb
geocoder-kb-1.2.6 lib/geocoder/results/yahoo.rb
geocoder-1.2.6 lib/geocoder/results/yahoo.rb
bw-geocoder-1.2.6 lib/geocoder/results/yahoo.rb
bw-geocoder-1.2.5 lib/geocoder/results/yahoo.rb
geocoder-1.2.5 lib/geocoder/results/yahoo.rb
geocoder-1.2.4 lib/geocoder/results/yahoo.rb
geocoder-1.2.3 lib/geocoder/results/yahoo.rb
geocoder-1.2.2 lib/geocoder/results/yahoo.rb
geocoder-1.2.1 lib/geocoder/results/yahoo.rb
geocoder-1.2.0 lib/geocoder/results/yahoo.rb
geocoder-1.1.9 lib/geocoder/results/yahoo.rb