locationator 0.2.0 → 0.2.1
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.
- data/Gemfile.lock +1 -1
- data/README.md +21 -3
- data/lib/locationator.rb +1 -5
- data/lib/locationator/version.rb +1 -1
- metadata +17 -5
- checksums.yaml +0 -15
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,7 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
|
19
|
+
### Pass an address to Google Maps' Geocoder Service:
|
20
20
|
|
21
21
|
Return the latitude of an address:
|
22
22
|
|
@@ -43,9 +43,27 @@ Return the properly formatted version of an address
|
|
43
43
|
$ Locationator.format("800 W. Huron St Chicago, IL")
|
44
44
|
=> "800 West Huron Street, Chicago, IL 60642, USA"
|
45
45
|
|
46
|
+
### Or use FreeGeoIP to geolocate based on IP address:
|
47
|
+
|
48
|
+
###### (These methods are slower and less precise than passing an address, for pretty obvious reasons.)
|
49
|
+
|
50
|
+
Return the latitude based on a user's IP address:
|
51
|
+
|
52
|
+
$ Locationator.ip_lat
|
53
|
+
=> 41.8953
|
54
|
+
|
55
|
+
Return the longitude based on a user's IP address:
|
56
|
+
|
57
|
+
$ Locationator.ip_lng
|
58
|
+
=> -87.648
|
59
|
+
|
60
|
+
Return an array of the latitude and longitude based on a user's IP address:
|
61
|
+
|
62
|
+
$ Locationator.ip_lat_lng
|
63
|
+
=> [41.8953, -87.648]
|
64
|
+
|
46
65
|
## TODOs
|
47
|
-
|
48
|
-
2. Find a better way of validating the array generated by the lat_lng method.
|
66
|
+
- Find a better way of locating the postal code in Google Maps' JSON response.
|
49
67
|
|
50
68
|
## Contributing
|
51
69
|
|
data/lib/locationator.rb
CHANGED
@@ -23,11 +23,7 @@ module Locationator
|
|
23
23
|
geocodeResponse = get_data(address)
|
24
24
|
myArray.push(geocodeResponse["status"] == "ZERO_RESULTS" ? nil : geocodeResponse["results"][0]["geometry"]["location"]["lat"])
|
25
25
|
myArray.push(geocodeResponse["status"] == "ZERO_RESULTS" ? nil : geocodeResponse["results"][0]["geometry"]["location"]["lng"])
|
26
|
-
|
27
|
-
result = nil
|
28
|
-
else
|
29
|
-
result = myArray
|
30
|
-
end
|
26
|
+
result = myArray == [nil, nil] ? nil : myArray
|
31
27
|
end
|
32
28
|
|
33
29
|
# Returns the zip code for an address
|
data/lib/locationator/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locationator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Lawrence Davis
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -57,25 +62,32 @@ files:
|
|
57
62
|
homepage: https://github.com/lawrencedavis/locationator
|
58
63
|
licenses:
|
59
64
|
- MIT
|
60
|
-
metadata: {}
|
61
65
|
post_install_message:
|
62
66
|
rdoc_options: []
|
63
67
|
require_paths:
|
64
68
|
- lib
|
65
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
66
71
|
requirements:
|
67
72
|
- - ! '>='
|
68
73
|
- !ruby/object:Gem::Version
|
69
74
|
version: '0'
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
hash: -2228869044499632145
|
70
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
71
80
|
requirements:
|
72
81
|
- - ! '>='
|
73
82
|
- !ruby/object:Gem::Version
|
74
83
|
version: '0'
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
hash: -2228869044499632145
|
75
87
|
requirements: []
|
76
88
|
rubyforge_project:
|
77
|
-
rubygems_version:
|
89
|
+
rubygems_version: 1.8.25
|
78
90
|
signing_key:
|
79
|
-
specification_version:
|
91
|
+
specification_version: 3
|
80
92
|
summary: Use Google's geocoding services to get information about any address.
|
81
93
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
ZTkxZGU5ZTZkODY4MDQ5OWI1YjhkMDA1YzRiZjAzODgzNWMwNGViZA==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MjZlNjAwMzM2MGI0MWQyN2VkMjJkOTkxYWIzZmE0M2IyNzMyYWQyZA==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NWExZGE2ZjU4NWI1Zjk3NmUwOWU5ZDUxZWViN2Q0NWNiNThhYjMyNTRkNzAw
|
10
|
-
MTRjYmY0NDA2MmMwZTk5M2NmMjRhYzY2ZWI3NmI2N2M2MzVlOTI5ZDNmZjUz
|
11
|
-
ZTgzZDk4ZWE5YTQ5MDBlNWRjZWYyMDM0N2Q4NGI5NjcxZDBlNjk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDg4YWE3YWE1Mzc0YjAwM2QxYzg5YjNlYmY0ZjQ3ZDliMDhlMjlmMjFiYTc5
|
14
|
-
ODg5YTcyOWIzY2FhYjczMTQ1OWRhYmE0ZTM4MWZhZTE4MGZkNDAyOWFmMWJh
|
15
|
-
MDYyMzdkZDE5ZWU1MTg2ZWE5NmUwNTVlMGJhODc0OWZhYjdlNjg=
|