googlestaticmap 1.1.3 → 1.1.4
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/History.txt +3 -0
- data/lib/googlestaticmap.rb +8 -6
- data/test/tc_google_static_map.rb +2 -2
- data/test/tc_map_marker.rb +6 -1
- data/test/tc_map_path_and_polygon.rb +6 -1
- metadata +9 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ff2ebb1801c05d4809f1747c82f079cbed2b7ccc
|
4
|
+
data.tar.gz: 042aaceadc71f079c683b3d4cbb7fd3dc8c9db01
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d4be157dc6dd3058897e5c1b5c51fb2ec8991dd8fadfcdcc30c38141a402286f76cb540643ca085eeda6bfb309c793b1f2edc570105a96842269029f439cd12
|
7
|
+
data.tar.gz: 56d3a7f1461f6186321ba86e29497f883eb398017076e8202c6584d53d05b5ce2a10a7797b72ccfda692d14b7c439353da6d5ad3d07df3a6b45a172dffd31179
|
data/History.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
== 1.1.4 / 2013-07-04
|
2
|
+
* Properly URL encoding the URLs, caused an issue when using URI.parse on generated URLs (thanks nathany!)
|
3
|
+
|
1
4
|
=== 1.1.3 / 2012-07-08
|
2
5
|
* Fixed a Ruby 1.9.3 compatibility issue (thanks dusanb!)
|
3
6
|
* Fixed a Ruby 1.8.7 compatibility issue introduced in 1.1.1
|
data/lib/googlestaticmap.rb
CHANGED
@@ -60,6 +60,8 @@ require 'net/http'
|
|
60
60
|
require 'net/https' if RUBY_VERSION < "1.9"
|
61
61
|
require File.dirname(__FILE__) + '/googlestaticmap_helper'
|
62
62
|
|
63
|
+
MAP_SEPARATOR = CGI.escape("|")
|
64
|
+
|
63
65
|
# Main class for creating a static map. Create an instance, Set attributes
|
64
66
|
# that describe properties of the map. Then call url to get a URL that you
|
65
67
|
# can use as the src of an img tag. You can also call get_map to actually
|
@@ -108,7 +110,7 @@ class GoogleStaticMap
|
|
108
110
|
# * terrain
|
109
111
|
# * hybrid - satellite imagery with roads
|
110
112
|
attr_accessor :maptype
|
111
|
-
|
113
|
+
|
112
114
|
# If you need to use a proxy server to reach Google, set the name/address
|
113
115
|
# of the proxy server here
|
114
116
|
attr_accessor :proxy_address
|
@@ -121,7 +123,7 @@ class GoogleStaticMap
|
|
121
123
|
defaults = {:width => 500, :height => 350, :markers => [],
|
122
124
|
:sensor => false, :maptype => "roadmap", :paths => [],
|
123
125
|
:proxy_port => nil, :proxy_address => nil,}
|
124
|
-
|
126
|
+
|
125
127
|
attributes = defaults.merge(attrs)
|
126
128
|
attributes.each {|k,v| self.send("#{k}=".to_sym,v)}
|
127
129
|
end
|
@@ -255,8 +257,8 @@ class MapMarker
|
|
255
257
|
# If the icon URL is URL encoded, it won't work
|
256
258
|
val = (k[0] == "icon" ? k[1] : CGI.escape(k[1].to_s))
|
257
259
|
"#{k[0]}:#{val}"
|
258
|
-
end.join(
|
259
|
-
s <<
|
260
|
+
end.join(MAP_SEPARATOR)
|
261
|
+
s << MAP_SEPARATOR << @location.to_s
|
260
262
|
end
|
261
263
|
end
|
262
264
|
|
@@ -285,8 +287,8 @@ class MapPath
|
|
285
287
|
def to_s
|
286
288
|
raise Exception.new("Need more than one point for the path") unless @points && @points.length > 1
|
287
289
|
attrs = GoogleStaticMapHelpers.safe_instance_variables(self, ["points"])
|
288
|
-
s = attrs.to_a.collect {|k| "#{k[0]}:#{CGI.escape(k[1].to_s)}"}.join(
|
289
|
-
s <<
|
290
|
+
s = attrs.to_a.collect {|k| "#{k[0]}:#{CGI.escape(k[1].to_s)}"}.join(MAP_SEPARATOR)
|
291
|
+
s << MAP_SEPARATOR << @points.join(MAP_SEPARATOR)
|
290
292
|
end
|
291
293
|
end
|
292
294
|
|
@@ -12,7 +12,7 @@ class MockSuccess < Net::HTTPSuccess #:nodoc: all
|
|
12
12
|
|
13
13
|
def body
|
14
14
|
@data
|
15
|
-
end
|
15
|
+
end
|
16
16
|
end
|
17
17
|
|
18
18
|
class MockFailure < Net::HTTPServiceUnavailable #:nodoc: all
|
@@ -68,7 +68,7 @@ class GoogleStaticMapTest < Test::Unit::TestCase #:nodoc: all
|
|
68
68
|
assert u.include?("scale=2")
|
69
69
|
assert u.include?("asdf")
|
70
70
|
assert u.include?("http://maps.google.com")
|
71
|
-
assert u.include?("color:0x00FF00FF
|
71
|
+
assert u.include?("color:0x00FF00FF#{MAP_SEPARATOR}fillcolor:0x00FF0060#{MAP_SEPARATOR}38.8,-77.5#{MAP_SEPARATOR}38.8,-76.9#{MAP_SEPARATOR}39.2,-76.9#{MAP_SEPARATOR}39.2,-77.5#{MAP_SEPARATOR}38.8,-77.5"), "Polygon not in URL"
|
72
72
|
assert u.include?("Washington%2C+DC")
|
73
73
|
|
74
74
|
f = nil
|
data/test/tc_map_marker.rb
CHANGED
@@ -33,12 +33,17 @@ class MapMarkerTest < Test::Unit::TestCase #:nodoc: all
|
|
33
33
|
m = default_marker
|
34
34
|
s = nil
|
35
35
|
assert_nothing_raised {s = m.to_s}
|
36
|
-
assert_equal 6, s.split(
|
36
|
+
assert_equal 6, s.split(MAP_SEPARATOR).length
|
37
37
|
assert s.include?(CGI.escape("Washington, DC"))
|
38
38
|
assert s.include?("color:green")
|
39
39
|
assert s.include?("icon:http://www.google.com")
|
40
40
|
end
|
41
41
|
|
42
|
+
def test_string_is_a_valid_ruby_uri
|
43
|
+
m = default_marker
|
44
|
+
URI.parse(m.to_s)
|
45
|
+
end
|
46
|
+
|
42
47
|
private
|
43
48
|
def default_marker
|
44
49
|
MapMarker.new(:color => "green",
|
@@ -30,12 +30,17 @@ class MapPathAndPolygonTest < Test::Unit::TestCase #:nodoc: all
|
|
30
30
|
p = default_path
|
31
31
|
s = nil
|
32
32
|
assert_nothing_raised { s = p.to_s }
|
33
|
-
assert_equal 4, s.split(
|
33
|
+
assert_equal 4, s.split(MAP_SEPARATOR).length
|
34
34
|
assert s.include?("color:0xFF0000FF")
|
35
35
|
assert s.include?("loc1")
|
36
36
|
assert s.include?("loc2")
|
37
37
|
end
|
38
38
|
|
39
|
+
def test_string_is_a_valid_ruby_uri
|
40
|
+
m = default_path
|
41
|
+
URI.parse(m.to_s)
|
42
|
+
end
|
43
|
+
|
39
44
|
def test_polygon
|
40
45
|
# Polygon inherits from MapPath and uses MapPath's to_s method, so only
|
41
46
|
# limited testing needs to happen here
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googlestaticmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brent Sowers
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Easily retrieve single PNG, GIF, or JPG map images from Google with your
|
15
14
|
own custom markers and paths using the Static Maps API service with this gem. Simply
|
@@ -25,39 +24,38 @@ files:
|
|
25
24
|
- lib/googlestaticmap.rb
|
26
25
|
- lib/googlestaticmap_helper.rb
|
27
26
|
- test/tc_map_path_and_polygon.rb
|
27
|
+
- test/tc_map_location.rb
|
28
28
|
- test/tc_google_static_map.rb
|
29
29
|
- test/tc_helper.rb
|
30
30
|
- test/tc_map_marker.rb
|
31
|
-
- test/tc_map_location.rb
|
32
31
|
- README
|
33
32
|
- History.txt
|
34
33
|
homepage: http://www.coordinatecommons.com/googlestaticmap/
|
35
34
|
licenses: []
|
35
|
+
metadata: {}
|
36
36
|
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
require_paths:
|
39
39
|
- lib
|
40
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
41
|
requirements:
|
43
|
-
- -
|
42
|
+
- - '>='
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
46
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
46
|
requirements:
|
49
|
-
- -
|
47
|
+
- - '>='
|
50
48
|
- !ruby/object:Gem::Version
|
51
49
|
version: '0'
|
52
50
|
requirements: []
|
53
51
|
rubyforge_project:
|
54
|
-
rubygems_version:
|
52
|
+
rubygems_version: 2.0.3
|
55
53
|
signing_key:
|
56
|
-
specification_version:
|
54
|
+
specification_version: 4
|
57
55
|
summary: Class for retrieving maps from the Google Maps Static API service
|
58
56
|
test_files:
|
59
57
|
- test/tc_map_path_and_polygon.rb
|
58
|
+
- test/tc_map_location.rb
|
60
59
|
- test/tc_google_static_map.rb
|
61
60
|
- test/tc_helper.rb
|
62
61
|
- test/tc_map_marker.rb
|
63
|
-
- test/tc_map_location.rb
|