Class: SmartyStreets::USZipcode::ZipCode

Inherits:
Object
  • Object
show all
Defined in:
lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ ZipCode

Returns a new instance of ZipCode.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 11

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

Instance Attribute Details

#alternate_countiesObject (readonly)

Returns the value of attribute alternate_counties.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def alternate_counties
  @alternate_counties
end

#county_fipsObject (readonly)

Returns the value of attribute county_fips.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def county_fips
  @county_fips
end

#county_nameObject (readonly)

Returns the value of attribute county_name.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def county_name
  @county_name
end

#default_cityObject (readonly)

Returns the value of attribute default_city.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def default_city
  @default_city
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def longitude
  @longitude
end

#precisionObject (readonly)

Returns the value of attribute precision.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def precision
  @precision
end

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def state
  @state
end

#state_abbreviationObject (readonly)

Returns the value of attribute state_abbreviation.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def state_abbreviation
  @state_abbreviation
end

#zipcodeObject (readonly)

Returns the value of attribute zipcode.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def zipcode
  @zipcode
end

#zipcode_typeObject (readonly)

Returns the value of attribute zipcode_type.



7
8
9
# File 'lib/smartystreets_ruby_sdk/us_zipcode/zip_code.rb', line 7

def zipcode_type
  @zipcode_type
end