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.4.9 lib/geocoder/results/telize.rb
geocoder-1.4.8 lib/geocoder/results/telize.rb
geocoder-1.4.7 lib/geocoder/results/telize.rb
geocoder-1.4.6 lib/geocoder/results/telize.rb
geocoder-1.4.5 lib/geocoder/results/telize.rb
geocoder-1.4.4 lib/geocoder/results/telize.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/geocoder-1.4.3/lib/geocoder/results/telize.rb
geocoder-1.4.3 lib/geocoder/results/telize.rb
geocoder-1.4.2 lib/geocoder/results/telize.rb
geocoder-1.4.1 lib/geocoder/results/telize.rb
geocoder-1.4.0 lib/geocoder/results/telize.rb
geocoder-1.3.7 lib/geocoder/results/telize.rb
geocoder-1.3.6 lib/geocoder/results/telize.rb
geocoder-1.3.5 lib/geocoder/results/telize.rb
broken-geocoder-1.3.6 lib/geocoder/results/telize.rb
broken-geocoder-1.3.5 lib/geocoder/results/telize.rb
broken-geocoder-1.3.4 lib/geocoder/results/telize.rb
geocoder-1.3.4 lib/geocoder/results/telize.rb
geocoder-1.3.3 lib/geocoder/results/telize.rb
geocoder-1.3.2 lib/geocoder/results/telize.rb