Class: Geocoder::Result::SmartyStreets
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::SmartyStreets
show all
- Defined in:
- lib/geocoder/results/smarty_streets.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #latitude, #longitude, #province, #province_code
Instance Method Details
#address ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/geocoder/results/smarty_streets.rb', line 11
def address
[
delivery_line_1,
delivery_line_2,
last_line
].select{ |i| i.to_s != "" }.join(" ")
end
|
#city ⇒ Object
47
48
49
50
51
|
# File 'lib/geocoder/results/smarty_streets.rb', line 47
def city
zipcode_endpoint? ?
city_states.first['city'] :
components['city_name']
end
|
#coordinates ⇒ Object
5
6
7
8
9
|
# File 'lib/geocoder/results/smarty_streets.rb', line 5
def coordinates
%w(latitude longitude).map do |i|
zipcode_endpoint? ? zipcodes.first[i] : metadata[i]
end
end
|
#country ⇒ Object
31
32
33
34
|
# File 'lib/geocoder/results/smarty_streets.rb', line 31
def country
"United States"
end
|
#country_code ⇒ Object
36
37
38
39
|
# File 'lib/geocoder/results/smarty_streets.rb', line 36
def country_code
"US"
end
|
#fips ⇒ Object
65
66
67
68
69
|
# File 'lib/geocoder/results/smarty_streets.rb', line 65
def fips
zipcode_endpoint? ?
zipcodes.first['county_fips'] :
metadata['county_fips']
end
|
#state ⇒ Object
19
20
21
22
23
|
# File 'lib/geocoder/results/smarty_streets.rb', line 19
def state
zipcode_endpoint? ?
city_states.first['state'] :
components['state_abbreviation']
end
|
#state_code ⇒ Object
25
26
27
28
29
|
# File 'lib/geocoder/results/smarty_streets.rb', line 25
def state_code
zipcode_endpoint? ?
city_states.first['state_abbreviation'] :
components['state_abbreviation']
end
|
#street ⇒ Object
Extra methods not in base.rb ————————
43
44
45
|
# File 'lib/geocoder/results/smarty_streets.rb', line 43
def street
components['street_name']
end
|
#zip4 ⇒ Object
Also known as:
postal_code_extended
60
61
62
|
# File 'lib/geocoder/results/smarty_streets.rb', line 60
def zip4
components['plus4_code']
end
|
#zipcode ⇒ Object
Also known as:
postal_code
53
54
55
56
57
|
# File 'lib/geocoder/results/smarty_streets.rb', line 53
def zipcode
zipcode_endpoint? ?
zipcodes.first['zipcode'] :
components['zipcode']
end
|
#zipcode_endpoint? ⇒ Boolean
71
72
73
|
# File 'lib/geocoder/results/smarty_streets.rb', line 71
def zipcode_endpoint?
zipcodes.any?
end
|