Sha256: b8c0d10d0474e1dafc01c2053cc684aaa0322cacbe256ac06863148f240886ca

Contents?: true

Size: 773 Bytes

Versions: 37

Compression:

Stored size: 773 Bytes

Contents

require 'geocoder/results/base'

module Geocoder::Result
  class Telize < Base

    def address(format = :full)
      s = state_code.to_s == "" ? "" : ", #{state_code}"
      "#{city}#{s} #{postal_code}, #{country}".sub(/^[ ,]*/, "")
    end

    def city
      @data['city']
    end

    def state
      @data['region']
    end

    def state_code
      @data['region_code']
    end

    def country
      @data['country']
    end

    def country_code
      @data['country_code']
    end

    def postal_code
      @data['postal_code']
    end

    def self.response_attributes
      %w[timezone isp dma_code area_code ip asn continent_code country_code3]
    end

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

Version data entries

37 entries across 37 versions & 5 rubygems

Version Path
geocoder-1.3.1 lib/geocoder/results/telize.rb
geocoder-1.3.0 lib/geocoder/results/telize.rb
geocoder-1.2.14 lib/geocoder/results/telize.rb
geocoder-1.2.13 lib/geocoder/results/telize.rb
geocoder-1.2.12 lib/geocoder/results/telize.rb
geocoder-1.2.11 lib/geocoder/results/telize.rb
geocoder-1.2.10 lib/geocoder/results/telize.rb
geocoder-1.2.9 lib/geocoder/results/telize.rb
geocoder-1.2.8 lib/geocoder/results/telize.rb
geocoder-1.2.7 lib/geocoder/results/telize.rb
geocoder-kb-1.2.6 lib/geocoder/results/telize.rb
geocoder-1.2.6 lib/geocoder/results/telize.rb
bw-geocoder-1.2.6 lib/geocoder/results/telize.rb
bw-geocoder-1.2.5 lib/geocoder/results/telize.rb
geocoder-1.2.5 lib/geocoder/results/telize.rb
geocoder-1.2.4 lib/geocoder/results/telize.rb
geocoder-1.2.3 lib/geocoder/results/telize.rb