simple-mappr 0.0.9 → 0.1.0
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 +4 -4
- data/lib/simple-mappr.rb +7 -5
- data/lib/simple-mappr/constants.rb +1 -1
- data/lib/simple-mappr/transporter.rb +6 -2
- data/lib/simple-mappr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7afe8e3105e63d7770c7e387c799173bd9a34f1e
|
4
|
+
data.tar.gz: f7bfa3556a8cea5ea58ccd006ee51edbc1f055a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86eb7a79b57720af6ff6a20bfaa124cd41d34dc9a616739437d6844c3de693c399fb6b37d994173b18076cba1d68bada1c5aec6db2c79d265bf821c424ef5ca7
|
7
|
+
data.tar.gz: ebf8ce6a1719ea8784895a7e7fbf23bbe243557d87ec7a7e9cf6c26d268f876995b1ef22021c4c9ee54bc4fe8e507bc5f9eb6b27f2cd476ec67d10cfb6c912ce
|
data/lib/simple-mappr.rb
CHANGED
@@ -34,7 +34,9 @@ class SimpleMappr
|
|
34
34
|
#
|
35
35
|
# {
|
36
36
|
# imageURL: "http://img.simplemappr.net/579273e6_1dd1_2.png",
|
37
|
-
#
|
37
|
+
# expiry: "2016-07-22T21:28:38-04:00",
|
38
|
+
# bad_points: [],
|
39
|
+
# bad_drawings: []
|
38
40
|
# }
|
39
41
|
#
|
40
42
|
def create
|
@@ -58,7 +60,7 @@ class SimpleMappr
|
|
58
60
|
end
|
59
61
|
file = [file_title,output].join(".")
|
60
62
|
File.open(file, 'wb') do |fo|
|
61
|
-
fo.write
|
63
|
+
fo.write(Transporter.send_data(@parameters, true))
|
62
64
|
end
|
63
65
|
file
|
64
66
|
end
|
@@ -382,12 +384,12 @@ class SimpleMappr
|
|
382
384
|
end
|
383
385
|
|
384
386
|
##
|
385
|
-
# Include wkt regions as
|
386
|
-
# Specify color, title, and data as keys
|
387
|
+
# Include wkt regions as an Array of Hashes
|
388
|
+
# Specify color, title, and data as keys for each element
|
387
389
|
#
|
388
390
|
# == Example
|
389
391
|
#
|
390
|
-
# instance.wkt = { color: "200,200,200", title: "My Regions", data: "POLYGON((-70 63,-70 48,-106 48,-106 63,-70 63))"}
|
392
|
+
# instance.wkt = [{ color: "200,200,200", title: "My Regions", data: "POLYGON((-70 63,-70 48,-106 48,-106 63,-70 63))" }]
|
391
393
|
#
|
392
394
|
def wkt=(wkt)
|
393
395
|
Validator.validate_wkt(wkt)
|
@@ -6,11 +6,15 @@ require "simple-mappr/validator"
|
|
6
6
|
class SimpleMappr
|
7
7
|
class Transporter
|
8
8
|
|
9
|
-
def self.send_data params
|
9
|
+
def self.send_data params, download = false
|
10
10
|
Validator.validate_type(params, 'Hash')
|
11
11
|
params.delete_if{ |k,v| !v }
|
12
12
|
RestClient.post(API_URL, params) do |response, request, result, &block|
|
13
|
-
|
13
|
+
if response.code == 303 && download
|
14
|
+
response.follow_redirection
|
15
|
+
else
|
16
|
+
JSON.parse(response.body, :symbolize_names => true)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
data/lib/simple-mappr/version.rb
CHANGED