simple-mappr 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98b0042f09a1e062032ed8664d56f699e499bbd0
4
- data.tar.gz: 698bfa83339b4a764d3fe9b01b21d93aec85d529
3
+ metadata.gz: e4004acbac50f68a55b67776b47aeb2855336b99
4
+ data.tar.gz: bf019aa91227af84255bba397d61c1a7563b3556
5
5
  SHA512:
6
- metadata.gz: 0ff3434460cb11efd18af65340b30827802e8f8c6115ea5ad6e92344cc8e1f7084d5b972ebfa852f298e3139e0f774e589ae9ca6e12e5684badb4c78f2634d5c
7
- data.tar.gz: 60b4680bea267d6ab5ee90de4c87b9c220b0b37454327f76cb4de69856776b327a3b81b468d02ad0e1b88215808c5ce448d91da4b1f000a98eeb560d50592e70
6
+ metadata.gz: 008db01cb68e3c11068493c14689857f705e35b3c65c4943c9377af3c761417d68295310fb1a5efbe6e0695bece609c2870506447b49ac864aeaca913a9b40e8
7
+ data.tar.gz: e7e4c20bbf46d1125542849917c9bf610c5eb6bc86e378408a24c281b61de8deddc505c30b5167eb8211c003245fe899a9a1c933047d44bfc0a3d0426114990b
@@ -2,6 +2,7 @@ require "simple-mappr/constants"
2
2
  require "simple-mappr/exceptions"
3
3
  require "simple-mappr/transporter"
4
4
  require "simple-mappr/validator"
5
+ require "simple-mappr/version"
5
6
 
6
7
  class SimpleMappr
7
8
 
@@ -40,6 +41,28 @@ class SimpleMappr
40
41
  Transporter.send_data @parameters
41
42
  end
42
43
 
44
+ ##
45
+ # Send the SimpleMappr object to the RESTful API and a file title
46
+ # without extension and download the resulting image
47
+ # Returns the file path for the downloaded file
48
+ #
49
+ # == Example
50
+ #
51
+ # instance.download("/tmp/my_map")
52
+ # Returns
53
+ # /tmp/my_map.png
54
+ #
55
+ def download(file_title = nil)
56
+ if !file_title
57
+ raise InvalidParameterValue, "File path is required"
58
+ end
59
+ file = [file_title,output].join(".")
60
+ File.open(file, 'wb') do |fo|
61
+ fo.write open(create[:imageURL]).read
62
+ end
63
+ file
64
+ end
65
+
43
66
  ##
44
67
  # Set a bounding box in decimal degrees as minx,miny,maxx,maxy
45
68
  #
@@ -77,7 +100,7 @@ class SimpleMappr
77
100
  #
78
101
  # == Example
79
102
  #
80
- # instance.file = "/Users/SimpleMappr/demo.txt"
103
+ # instance.file_path = "/Users/SimpleMappr/demo.txt"
81
104
  #
82
105
  def file_path=(file_path)
83
106
  Validator.validate_type(file_path, 'File')
@@ -145,7 +168,7 @@ class SimpleMappr
145
168
  #
146
169
  # == Example
147
170
  #
148
- # instance.layers = ['My First Legend','My Second Legend']
171
+ # instance.legend = ['My First Legend','My Second Legend']
149
172
  #
150
173
  def legend=(legend)
151
174
  Validator.validate_type(legend, 'Array')
@@ -202,7 +225,7 @@ class SimpleMappr
202
225
  end
203
226
 
204
227
  def output
205
- @parameters[:output] || nil
228
+ @parameters[:output] || "png"
206
229
  end
207
230
 
208
231
  ##
@@ -1,5 +1,6 @@
1
1
  require "rest_client"
2
2
  require "json"
3
+ require "open-uri"
3
4
  require "simple-mappr/validator"
4
5
 
5
6
  class SimpleMappr
@@ -1,5 +1,5 @@
1
1
  class SimpleMappr
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-mappr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.5.1
132
+ rubygems_version: 2.4.5.1
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: A gem to access the SimpleMappr API