dusty-geocoder 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module Geocoder
17
17
  ##
18
18
  # The current version of the application
19
19
  def self.version
20
- "0.0.2"
20
+ "0.0.3"
21
21
  end
22
22
 
23
23
  ##
@@ -73,7 +73,7 @@ module Geocoder
73
73
  # @return [String] street
74
74
  def street
75
75
  @street ||= @hash["AddressDetails"]["Country"]["AdministrativeArea"]\
76
- ["Locality"]["Thoroughfare"]["ThoroughfareName"]
76
+ ["Locality"]["Thoroughfare"]["ThoroughfareName"] rescue nil
77
77
  end
78
78
 
79
79
  ##
@@ -82,7 +82,7 @@ module Geocoder
82
82
  # @return [String] city
83
83
  def city
84
84
  @city ||= @hash["AddressDetails"]["Country"]["AdministrativeArea"]\
85
- ["Locality"]["LocalityName"]
85
+ ["Locality"]["LocalityName"] rescue nil
86
86
  end
87
87
 
88
88
  ##
@@ -91,7 +91,7 @@ module Geocoder
91
91
  # @return [String] state
92
92
  def state
93
93
  @state ||= @hash["AddressDetails"]["Country"]["AdministrativeArea"]\
94
- ["AdministrativeAreaName"]
94
+ ["AdministrativeAreaName"] rescue nil
95
95
  end
96
96
 
97
97
  ##
@@ -100,7 +100,7 @@ module Geocoder
100
100
  # @return [String] zipcode
101
101
  def zipcode
102
102
  @zipcode ||= @hash["AddressDetails"]["Country"]["AdministrativeArea"]\
103
- ["Locality"]["PostalCode"]["PostalCodeNumber"]
103
+ ["Locality"]["PostalCode"]["PostalCodeNumber"] rescue nil
104
104
  end
105
105
 
106
106
  ##
@@ -108,7 +108,8 @@ module Geocoder
108
108
  #
109
109
  # @return [String] country
110
110
  def country
111
- @country ||= @hash["AddressDetails"]["Country"]["CountryNameCode"]
111
+ @country ||= @hash["AddressDetails"]["Country"]["CountryNameCode"]\
112
+ rescue nil
112
113
  end
113
114
 
114
115
  ##
@@ -120,7 +121,8 @@ module Geocoder
120
121
  # @see accuracy_map
121
122
  # @return [String] accuracy
122
123
  def accuracy
123
- @accuracy ||= accuracy_map[@hash["AddressDetails"]["Accuracy"].to_i]
124
+ @accuracy ||= accuracy_map[@hash["AddressDetails"]["Accuracy"].to_i]\
125
+ rescue nil
124
126
  end
125
127
 
126
128
  ##
@@ -138,7 +140,7 @@ module Geocoder
138
140
  #
139
141
  # @return [Float] latitude
140
142
  def lat
141
- @lat ||= @hash["Point"]["coordinates"][0].to_f
143
+ @lat ||= @hash["Point"]["coordinates"][0].to_f rescue nil
142
144
  end
143
145
 
144
146
  ##
@@ -146,7 +148,7 @@ module Geocoder
146
148
  #
147
149
  # @return [Float] longitude
148
150
  def lng
149
- @lng ||= @hash["Point"]["coordinates"][1].to_f
151
+ @lng ||= @hash["Point"]["coordinates"][1].to_f rescue nil
150
152
  end
151
153
 
152
154
  ##
@@ -154,7 +156,7 @@ module Geocoder
154
156
  #
155
157
  # @return [Float] elevation
156
158
  def elevation
157
- @elevation ||= @hash["Point"]["coordinates"][2].to_f
159
+ @elevation ||= @hash["Point"]["coordinates"][2].to_f rescue nil
158
160
  end
159
161
 
160
162
  private
@@ -166,5 +168,6 @@ module Geocoder
166
168
  def accuracy_map
167
169
  %w{ unknown country state county city zip zip+4 street address }
168
170
  end
171
+
169
172
  end
170
173
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dusty-geocoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dusty Doris