simple-mappr 0.0.7 → 0.0.8
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 +18 -1
- data/lib/simple-mappr/validator.rb +11 -0
- data/lib/simple-mappr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5279d796f1799b338d41d29a9ad1975fd893dbe7
|
4
|
+
data.tar.gz: 15188cca04a9223f3cf0d46290bb1eed887cb864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62361c6b4a3295ca8a722afe8eab27d4b7de0461dcd34f0c724869ea42ee24b16cb3b73d38cd074b3678861b015f3812db7511b1d277bff187ac298f49402367
|
7
|
+
data.tar.gz: b7ef6be1a8086357d001e26222842d922c9881d4253eab80750bac45c8322bc089f23cff3df813bca1d04d98aef5e79bddb47f416fb1aee5d53878b9c4d3e03a
|
data/lib/simple-mappr.rb
CHANGED
@@ -33,7 +33,7 @@ class SimpleMappr
|
|
33
33
|
# == Example Output
|
34
34
|
#
|
35
35
|
# {
|
36
|
-
# imageURL: "http://img.simplemappr.
|
36
|
+
# imageURL: "http://img.simplemappr.net/579273e6_1dd1_2.png",
|
37
37
|
# expiry: "2016-07-22T21:28:38-04:00"
|
38
38
|
# }
|
39
39
|
#
|
@@ -381,6 +381,23 @@ class SimpleMappr
|
|
381
381
|
@parameters[:width] || nil
|
382
382
|
end
|
383
383
|
|
384
|
+
##
|
385
|
+
# Include wkt regions as a Hash
|
386
|
+
# Specify color, title, and data as keys
|
387
|
+
#
|
388
|
+
# == Example
|
389
|
+
#
|
390
|
+
# instance.wkt = { color: "200,200,200", title: "My Regions", data: "POLYGON((-70 63,-70 48,-106 48,-106 63,-70 63))"}
|
391
|
+
#
|
392
|
+
def wkt=(wkt)
|
393
|
+
Validator.validate_wkt(wkt)
|
394
|
+
@parameters[:wkt] = wkt
|
395
|
+
end
|
396
|
+
|
397
|
+
def wkt
|
398
|
+
@parameters[:wkt] || nil
|
399
|
+
end
|
400
|
+
|
384
401
|
##
|
385
402
|
# Specify a zoom level, centred on the geographic center of all points
|
386
403
|
# Must be less than or eqaual to 10
|
@@ -142,5 +142,16 @@ class SimpleMappr
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
def self.validate_wkt(data)
|
146
|
+
validate_type(data, 'Array')
|
147
|
+
data.each { |item| validate_type(item, 'Hash') }
|
148
|
+
if !(data[0].keys - [:data, :title, :color]).empty?
|
149
|
+
raise InvalidParameterValue, "wkt must be an Array of Hashes in the form [{ data: \"\", title: \"\", color: \"\" }]"
|
150
|
+
end
|
151
|
+
if data[0].key?(:color)
|
152
|
+
validate_color(data[0][:color])
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
145
156
|
end
|
146
157
|
end
|
data/lib/simple-mappr/version.rb
CHANGED
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
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David P. Shorthouse
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '9.0'
|
83
83
|
description: A gem to access the SimpleMappr API
|
84
|
-
email:
|
84
|
+
email: davidpshorthouse@gmail.coms
|
85
85
|
executables: []
|
86
86
|
extensions: []
|
87
87
|
extra_rdoc_files: []
|