geo_lat_lng_smt 0.0.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.
- checksums.yaml +7 -0
- data/lib/geo_lat_lng_smt.rb +20 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 129b42c9e27a6749a51478196799855506db5ac7
|
4
|
+
data.tar.gz: d8b9995410ca8c3843d5158a12abcb6f1562359d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b5c88506b703dc15fef81c22592baeac8f7ab8cdc63fd81ceed6ea9fcaabf5fcc4e18421b6a49c257493af7c5816d4ac0a4831baea0b5b47c25a68ab9a51be94
|
7
|
+
data.tar.gz: 92fc127e1e11b5d44f851f0783e0e0ba157e26c42f3454bf4cd827e77439ddb7e8668cc6291b21d51592cd1719df636345a9b9279756c7d35fb81816bc3fcfe8
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# geo_lat_lng_smt.rb
|
2
|
+
require 'rest-client'
|
3
|
+
require 'crack'
|
4
|
+
|
5
|
+
class GeoLatLng
|
6
|
+
def initialize(addr)
|
7
|
+
# Instance variables
|
8
|
+
@base_google_url = "http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address="
|
9
|
+
@addr = addr
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_coordinates_from_address
|
13
|
+
res = RestClient.get(URI.encode("#{@base_google_url}#{@addr}"))
|
14
|
+
parsed_res = Crack::XML.parse(res)
|
15
|
+
lat = parsed_res["GeocodeResponse"]["result"]["geometry"]["location"]["lat"]
|
16
|
+
lng = parsed_res["GeocodeResponse"]["result"]["geometry"]["location"]["lng"]
|
17
|
+
return "#{lat}, #{lng}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: geo_lat_lng_smt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Satish Talim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The gem gets the latitude and longitude coordinates for any given address
|
14
|
+
email:
|
15
|
+
- satish@rubylearning.org
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/geo_lat_lng_smt.rb
|
21
|
+
homepage: http://rubylearning.org/
|
22
|
+
licenses: []
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.0.2
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Geo Lat and Long
|
44
|
+
test_files: []
|