twofishes 2.1.0.pre.rc.1 → 2.1.0.pre.rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/twofishes/geocode_request.rb +22 -27
- data/lib/twofishes/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c736e4fa16a0dd414258b492bf9e28216159529
|
|
4
|
+
data.tar.gz: 51098838583a9781a6e8993008ae11051cf49ec1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 372613ddb1f2c0aa1c7a475fdf4179a5b36bd309ce55b456110625a367e3ed4517328913e21be545870c80caa8c17470ad0cc0cd328539b7512c6c38f62a5a7d
|
|
7
|
+
data.tar.gz: e9c771da55db7ae6ded344382a4289243316357d68f608a6bc8c19f7b9e8a33f1eef0f19ec1088882b223bc7ee23425604f0aa78add64bcef64477bf00bbab7d
|
|
@@ -13,11 +13,11 @@ module Twofishes
|
|
|
13
13
|
case ll
|
|
14
14
|
when String
|
|
15
15
|
lat, lng = ll.split(/\s*,\s*/)
|
|
16
|
-
|
|
16
|
+
new_point(lat, lng)
|
|
17
17
|
when Array
|
|
18
|
-
|
|
18
|
+
new_point(ll[0], ll[1])
|
|
19
19
|
when Hash
|
|
20
|
-
|
|
20
|
+
new_point(ll[:lat], ll[:lng])
|
|
21
21
|
else
|
|
22
22
|
ll
|
|
23
23
|
end
|
|
@@ -27,42 +27,37 @@ module Twofishes
|
|
|
27
27
|
case bounds
|
|
28
28
|
when String
|
|
29
29
|
ne_lat, ne_lng, sw_lat, sw_lng = bounds.split(/\s*,\s*/)
|
|
30
|
-
|
|
31
|
-
sw = GeocodePoint.new(lat: sw_lat.to_f, lng: sw_lng.to_f)
|
|
32
|
-
GeocodeBoundingBox.new(ne: ne, sw: sw)
|
|
30
|
+
new_bounding_box(ne_lat, ne_lng, sw_lat, sw_lng)
|
|
33
31
|
when Array
|
|
34
|
-
|
|
35
|
-
sw = GeocodePoint.new(lat: bounds[2].to_f, lng: bounds[3].to_f)
|
|
36
|
-
GeocodeBoundingBox.new(ne: ne, sw: sw)
|
|
32
|
+
new_bounding_box(bounds[0], bounds[1], bounds[2], bounds[3])
|
|
37
33
|
when Hash
|
|
38
|
-
|
|
39
|
-
sw = GeocodePoint.new(lat: bounds[:sw_lat].to_f, lng: bounds[:sw_lng].to_f)
|
|
40
|
-
GeocodeBoundingBox.new(ne: ne, sw: sw)
|
|
34
|
+
new_bounding_box(bounds[:ne_lat], bounds[:ne_lng], bounds[:sw_lat], bounds[:sw_lng])
|
|
41
35
|
else
|
|
42
36
|
bounds
|
|
43
37
|
end
|
|
44
38
|
end
|
|
45
39
|
|
|
46
40
|
def substitute_aliases(options)
|
|
47
|
-
options = options.
|
|
41
|
+
options = Hash[options.map{|k,v| [k.to_s.camelize(:lower).to_sym,v] } ]
|
|
48
42
|
|
|
49
|
-
options[:maxInterpretations] ||= options.delete(:
|
|
50
|
-
options[:allowedSources] ||= options.delete(:
|
|
51
|
-
options[:responseIncludes] ||= options.delete(:
|
|
52
|
-
options[:
|
|
53
|
-
options[:woeRestrict] ||= options.delete(:woe_restrict)
|
|
54
|
-
options[:autocompleteBias] ||= options.delete(:autocomplete_bias) || options.delete(:bias)
|
|
43
|
+
options[:maxInterpretations] ||= options.delete(:max)
|
|
44
|
+
options[:allowedSources] ||= options.delete(:sources)
|
|
45
|
+
options[:responseIncludes] ||= options.delete(:includes)
|
|
46
|
+
options[:autocompleteBias] ||= options.delete(:bias)
|
|
55
47
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
end
|
|
48
|
+
options
|
|
49
|
+
end
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
options[:bounds][:ne_lng] = options[:bounds][:ne_lon] if options[:bounds] and options[:bounds][:ne_lon]
|
|
62
|
-
options[:bounds][:sw_lng] = options[:bounds][:sw_lon] if options[:bounds] and options[:bounds][:sw_lon]
|
|
63
|
-
end
|
|
51
|
+
private
|
|
64
52
|
|
|
65
|
-
|
|
53
|
+
def new_bounding_box(ne_lat, ne_lng, sw_lat, sw_lng)
|
|
54
|
+
ne = GeocodePoint.new(lat: ne_lat.to_f, lng: ne_lng.to_f)
|
|
55
|
+
sw = GeocodePoint.new(lat: sw_lat.to_f, lng: sw_lng.to_f)
|
|
56
|
+
GeocodeBoundingBox.new(ne: ne, sw: sw)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def new_point(lat, lng)
|
|
60
|
+
GeocodePoint.new(lat: lat.to_f, lng: lng.to_f)
|
|
66
61
|
end
|
|
67
62
|
end
|
|
68
63
|
end
|
data/lib/twofishes/version.rb
CHANGED