Sha256: d0a80c0d1816db94c15283c6a504930c3ec9b710060aa9f0a80e88551a49b2d5

Contents?: true

Size: 1.04 KB

Versions: 72

Compression:

Stored size: 1.04 KB

Contents

require_relative 'alternate_county'

module SmartyStreets
  module USZipcode
    # See "https://smartystreets.com/docs/cloud/us-zipcode-api#zipcodes"
    class ZipCode
      attr_reader :longitude, :county_name, :zipcode, :zipcode_type, :county_fips,
                  :latitude, :precision, :default_city, :alternate_counties,
                  :state_abbreviation, :state

      def initialize(obj)
        @zipcode = obj['zipcode']
        @zipcode_type = obj['zipcode_type']
        @default_city = obj['default_city']
        @county_fips = obj['county_fips']
        @county_name = obj['county_name']
        @latitude = obj['latitude']
        @longitude = obj['longitude']
        @precision = obj['precision']
        @state = obj['state']
        @state_abbreviation = obj['state_abbreviation']
        alternate_counties = obj.fetch('alternate_counties', [])

        @alternate_counties = []

        alternate_counties.each do |county|
          @alternate_counties.push(USZipcode::AlternateCounty.new(county))
        end
      end
    end
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
smartystreets_ruby_sdk-5.20.6 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.20.4 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.20.3 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.20.2 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.19.0 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.18.1 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.18.0 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.17.2 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.17.1 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.17.0 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.16.2 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.16.1 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.16.0 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.15.4 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.15.3 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.15.2 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.15.1 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.15.0 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.14.22 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb
smartystreets_ruby_sdk-5.14.19 lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb