Sha256: 83c50c60ab2882b2fd6328789184a3d6bb5cf9e32d4f30ed6395a4c6bdee6e59

Contents?: true

Size: 811 Bytes

Versions: 63

Compression:

Stored size: 811 Bytes

Contents

require 'geocoder/results/base'

module Geocoder::Result
  class BaiduIp < Base
    def coordinates
      [point['y'].to_f, point['x'].to_f]
    end

    def address
      @data['address']
    end

    def state
      province
    end

    def province
      address_detail['province']
    end

    def city
      address_detail['city']
    end

    def district
      address_detail['district']
    end

    def street
      address_detail['street']
    end

    def street_number
      address_detail['street_number']
    end

    def state_code
      ""
    end

    def postal_code
      ""
    end

    def country
      "China"
    end

    def country_code
      "CN"
    end

    private
    def address_detail
      @data['address_detail']
    end

    def point
      @data['point']
    end
  end
end

Version data entries

63 entries across 63 versions & 6 rubygems

Version Path
geocoder-1.8.3 lib/geocoder/results/baidu_ip.rb
geocoder-1.8.2 lib/geocoder/results/baidu_ip.rb
geocoder-1.8.1 lib/geocoder/results/baidu_ip.rb
geocoder-1.8.0 lib/geocoder/results/baidu_ip.rb
geocoder-1.7.5 lib/geocoder/results/baidu_ip.rb
geocoder-1.7.4 lib/geocoder/results/baidu_ip.rb
geocoder-1.7.3 lib/geocoder/results/baidu_ip.rb
geocoder-1.7.2 lib/geocoder/results/baidu_ip.rb
geocoder-1.7.1 lib/geocoder/results/baidu_ip.rb
geocoder-1.7.0 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.7 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.6 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.5 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.4 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.3 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.2 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.1 lib/geocoder/results/baidu_ip.rb
geocoder-1.6.0 lib/geocoder/results/baidu_ip.rb
geocoder-1.5.2 lib/geocoder/results/baidu_ip.rb
really-broken-geocoder-2.0.0 lib/geocoder/results/baidu_ip.rb