map_monkey 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/map_monkey.rb +4 -41
  2. metadata +1 -1
data/lib/map_monkey.rb CHANGED
@@ -3,38 +3,20 @@ require 'rexml/document'
3
3
 
4
4
  class Position
5
5
  def lat(strCity, strStreet, strZip)
6
- # Clean up the string
7
-
8
- city = URI.encode(strCity)
9
- #strCity = strCity.gsub(" ", "+")
10
- #strCity = strCity.gsub("é", "e")
11
- #strCity = strCity.gsub("ä", "a")
12
- #strCity = strCity.gsub("å", "a")
13
- #strCity = strCity.gsub("ö", "o")
14
6
 
7
+ # Clean up the string
8
+ city = URI.encode(strCity)
15
9
  street = URI.encode(strStreet)
16
- #strAddress = strAddress.gsub(" ", "+")
17
- #strAddress = strAddress.gsub("ä", "a")
18
- #strAddress = strAddress.gsub("å", "a")
19
- #strAddress = strAddress.gsub("ö", "o")
20
- #strAdress = strAdress.gsub(".", String.new)
21
-
22
10
  zip = URI.encode(strZip)
23
- #strZip = strZip.gsub(" ", "+")
24
- #strZip = strZip.gsub(".", String.new)
25
11
 
26
12
  # URL setup
27
13
  url = "http://maps.googleapis.com/maps/api/geocode/xml?address=#{ street }#{ zip }#{ city }&sensor=false"
28
14
 
29
- #url = URI.parse(strUrl)
30
- #http = Net::HTTP.new( url.host, url.port )
31
15
  xml_data = Net::HTTP.get_response(URI.parse(url)).body
32
16
 
33
-
34
17
  # xml-response
35
- #data = http.get( url )
36
18
  doc = REXML::Document.new(xml_data)
37
- #doc = Nokogiri::XML(data)
19
+
38
20
  lat = ""
39
21
 
40
22
  doc.elements.each('GeocodeResponse/result/geometry/location/lat') do |ele|
@@ -45,38 +27,19 @@ class Position
45
27
  end
46
28
 
47
29
  def lng(strCity, strStreet, strZip)
30
+
48
31
  # Clean up the string
49
-
50
32
  city = URI.encode(strCity)
51
- #strCity = strCity.gsub(" ", "+")
52
- #strCity = strCity.gsub("é", "e")
53
- #strCity = strCity.gsub("ä", "a")
54
- #strCity = strCity.gsub("å", "a")
55
- #strCity = strCity.gsub("ö", "o")
56
-
57
33
  street = URI.encode(strStreet)
58
- #strAddress = strAddress.gsub(" ", "+")
59
- #strAddress = strAddress.gsub("ä", "a")
60
- #strAddress = strAddress.gsub("å", "a")
61
- #strAddress = strAddress.gsub("ö", "o")
62
- #strAdress = strAdress.gsub(".", String.new)
63
-
64
34
  zip = URI.encode(strZip)
65
- #strZip = strZip.gsub(" ", "+")
66
- #strZip = strZip.gsub(".", String.new)
67
35
 
68
36
  # URL setup
69
37
  url = "http://maps.googleapis.com/maps/api/geocode/xml?address=#{ street }#{ zip }#{ city }&sensor=false"
70
38
 
71
- #url = URI.parse(strUrl)
72
- #http = Net::HTTP.new( url.host, url.port )
73
39
  xml_data = Net::HTTP.get_response(URI.parse(url)).body
74
40
 
75
-
76
41
  # xml-response
77
- #data = http.get( url )
78
42
  doc = REXML::Document.new(xml_data)
79
- #doc = Nokogiri::XML(data)
80
43
 
81
44
  lng = ""
82
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: map_monkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: