Sha256: 89bae7f06dcb5691b202581fd29df6cbac1cff82fdfda810c3307e2d69e15419

Contents?: true

Size: 953 Bytes

Versions: 11

Compression:

Stored size: 953 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 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 self.response_attributes
      %w[quality offsetlat offsetlon radius boundingbox name
        line1 line2 line3 line4 cross house street xstreet unittype unit
        neighborhood county 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

11 entries across 11 versions & 1 rubygems

Version Path
geocoder-1.1.4 lib/geocoder/results/yahoo.rb
geocoder-1.1.3 lib/geocoder/results/yahoo.rb
geocoder-1.1.2 lib/geocoder/results/yahoo.rb
geocoder-1.1.1 lib/geocoder/results/yahoo.rb
geocoder-1.1.0 lib/geocoder/results/yahoo.rb
geocoder-1.0.5 lib/geocoder/results/yahoo.rb
geocoder-1.0.4 lib/geocoder/results/yahoo.rb
geocoder-1.0.3 lib/geocoder/results/yahoo.rb
geocoder-1.0.2 lib/geocoder/results/yahoo.rb
geocoder-1.0.1 lib/geocoder/results/yahoo.rb
geocoder-1.0.0 lib/geocoder/results/yahoo.rb