geocord 0.0.1 → 0.0.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/README.md +44 -17
- data/lib/geocord.rb +7 -5
- data/lib/geocord/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3fc4940e4a14bd3518281922cae53fac1d1eea40
|
|
4
|
+
data.tar.gz: 43d2d119373934e2152c423571976a333dcad125
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3089ff0000a8cbfceb3bee2b907853a5c4c861801776e2b2f612373a30668f7d300301a54e9086407ee5d126925beaeec3db4fd5fa8800c945998e717594181
|
|
7
|
+
data.tar.gz: b483cfdfce9ecc6e3f4eafdc0375a5689298fc82d24d93ee705ea23dafc8610d42c62122abcfe4da215b3b249d77524b07e11317bf2f50f9f08ca27e41f0c874
|
data/README.md
CHANGED
|
@@ -1,29 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
GeoCord
|
|
2
|
+
=========
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
Gem para retornar a latitude e Longitude de acordo com o endereço.
|
|
5
|
+
|
|
6
|
+
- Facil utilização.
|
|
7
|
+
- Versão de teste.
|
|
8
|
+
- Contribua.
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
Futuras implementações:
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
- Retornar todas as geolocalizações encontradas em um array.
|
|
13
|
+
- Retornar endereço de latitude e longitude
|
|
14
|
+
- Evoluir testes.
|
|
15
|
+
> Contribua...
|
|
8
16
|
|
|
9
|
-
gem 'geocord'
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
Version
|
|
19
|
+
----
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
0.1
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
Tech
|
|
24
|
+
-----------
|
|
16
25
|
|
|
17
|
-
|
|
26
|
+
GoogleAPI
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
Installation
|
|
29
|
+
--------------
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
```sh
|
|
32
|
+
gem 'geocord'
|
|
22
33
|
|
|
23
|
-
|
|
34
|
+
bundle
|
|
35
|
+
|
|
36
|
+
Ou
|
|
37
|
+
|
|
38
|
+
$ gem install geocord
|
|
39
|
+
rails console
|
|
40
|
+
require 'geocord'
|
|
41
|
+
address = Geocord.process('Rua Adolfo Gordo, Brasil')
|
|
42
|
+
address.latitude => -5.8219534
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
License
|
|
46
|
+
----
|
|
47
|
+
|
|
48
|
+
MIT
|
|
49
|
+
|
|
50
|
+
**Free Software, Hell Yeah!**
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
Contributors
|
|
54
|
+
--------------
|
|
55
|
+
[Sidnei Pacheco](https://github.com/sidneip)
|
|
24
56
|
|
|
25
|
-
1. Fork it ( https://github.com/[my-github-username]/geocord/fork )
|
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
-
5. Create a new Pull Request
|
data/lib/geocord.rb
CHANGED
|
@@ -4,22 +4,24 @@ require 'uri'
|
|
|
4
4
|
require 'json'
|
|
5
5
|
|
|
6
6
|
module Geocord
|
|
7
|
+
GOOGLEAPIS = 'http://maps.googleapis.com/maps/api/geocode/json?address='
|
|
7
8
|
class Cordinate
|
|
8
9
|
attr_accessor :latitude, :longitude
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def self.process(address)
|
|
12
|
-
uri = URI.encode("
|
|
13
|
+
uri = URI.encode("#{GOOGLEAPIS}#{address}&sensor=false")
|
|
13
14
|
uri = URI.parse(uri)
|
|
14
15
|
conn = Faraday.new(:url => uri)
|
|
15
16
|
response = conn.get
|
|
16
17
|
data = JSON.parse(response.body)
|
|
17
18
|
if data['results'].size < 1
|
|
18
|
-
return
|
|
19
|
+
return nil
|
|
19
20
|
else
|
|
20
|
-
cordinate =
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
cordinate = Array.new
|
|
22
|
+
data['results'].each_with_index do |cord, index|
|
|
23
|
+
cordinate[index] = {:endereco => cord['formatted_address'], :latitude => cord['geometry']['location']['lat'], :longitude => cord['geometry']['location']['lng']}
|
|
24
|
+
end
|
|
23
25
|
return cordinate
|
|
24
26
|
end
|
|
25
27
|
end
|
data/lib/geocord/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: geocord
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sidnei Pacheco
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-09-
|
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|