static_map 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/static_map.rb +6 -2
- data/lib/static_map/version.rb +1 -1
- data/test/static_map_test.rb +6 -0
- metadata +1 -1
data/lib/static_map.rb
CHANGED
@@ -42,7 +42,11 @@ module StaticMap
|
|
42
42
|
def save
|
43
43
|
raise "Please set the path argument to save the image" unless @path
|
44
44
|
|
45
|
-
File.open(@path, "w") { |f| f.write(
|
45
|
+
File.open(@path, "w") { |f| f.write(file.read) }
|
46
|
+
end
|
47
|
+
|
48
|
+
def file
|
49
|
+
open(url)
|
46
50
|
end
|
47
51
|
|
48
52
|
def url
|
@@ -65,7 +69,7 @@ module StaticMap
|
|
65
69
|
str << [CGI.escape("label:#{marker[:label]}")] if marker[:label]
|
66
70
|
str << [CGI.escape("#{marker[:location]}")] if marker[:location]
|
67
71
|
str << ["#{marker[:latitude]},#{marker[:longitude]}"] if marker[:latitude] && marker[:longitude]
|
68
|
-
str.map{|v| v }.join("%7C") # %7C
|
72
|
+
str.map{|v| v }.join("%7C") # %7C is | character
|
69
73
|
end.join("&").gsub(/\=\%7C/i, '=')
|
70
74
|
end
|
71
75
|
|
data/lib/static_map/version.rb
CHANGED
data/test/static_map_test.rb
CHANGED
@@ -2,6 +2,7 @@ $:.unshift(File.dirname(__FILE__) + '/../lib/')
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
require 'static_map'
|
5
|
+
require 'tempfile'
|
5
6
|
|
6
7
|
class StaticMapTest < Test::Unit::TestCase
|
7
8
|
|
@@ -49,4 +50,9 @@ class StaticMapTest < Test::Unit::TestCase
|
|
49
50
|
assert File.exists?("./test/tmp.png")
|
50
51
|
# File.delete("./test/tmp.png")
|
51
52
|
end
|
53
|
+
|
54
|
+
def test_file
|
55
|
+
img = StaticMap::Image.new
|
56
|
+
assert_kind_of Tempfile, img.file
|
57
|
+
end
|
52
58
|
end
|