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.
@@ -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( open(url).read ) }
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
 
@@ -1,3 +1,3 @@
1
1
  module StaticMap
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: static_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: