atdis 0.3.1 → 0.3.2
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/atdis/models/info.rb +12 -1
- data/lib/atdis/version.rb +1 -1
- data/spec/atdis/models/info_spec.rb +5 -0
- 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: 661d7d16f8ddc03b59e867f8a1bf3a691d66f02a
|
4
|
+
data.tar.gz: 0630e75e2045725a519b3fe7b1e6995b0184f2e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac95146aa0dd9a03477ec1f7aad2380d0291a1f6585c951f4f6bcef334bc286b25354763f3a4cb2aff618e95b098ff50245d05934e87ed1ca943e9770f648085
|
7
|
+
data.tar.gz: 1d1faec28b50806f0b1f804b21d62e3d013cd855cdabed897bcf90ebca6123cfcf4847ade63f6c1f765379828baf10b3482709357b9f15c7fda1f7f207dd6a7f
|
data/lib/atdis/models/info.rb
CHANGED
@@ -54,11 +54,22 @@ module ATDIS
|
|
54
54
|
# TODO Validate contents of estimated_cost
|
55
55
|
|
56
56
|
def dat_id_is_url_encoded!
|
57
|
-
if dat_id &&
|
57
|
+
if dat_id && !Info.url_encoded?(dat_id)
|
58
58
|
errors.add(:dat_id, ErrorMessage.new("should be url encoded", "4.3.1"))
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
def self.url_encoded?(s)
|
63
|
+
url_encoded = true
|
64
|
+
s.each_char do |c|
|
65
|
+
# These characters are the valid ones in a url encoded string
|
66
|
+
unless c =~ /[a-zA-Z0-9\-_.~%+]/
|
67
|
+
url_encoded = false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
url_encoded
|
71
|
+
end
|
72
|
+
|
62
73
|
def related_apps_url_format
|
63
74
|
if related_apps.respond_to?(:all?) && !related_apps.all? {|url| url.to_s =~ /atdis\/1.0\/[^\/]+\.json/}
|
64
75
|
errors.add(:related_apps, ErrorMessage.new("contains url(s) not in the expected format", "4.3.1"))
|
data/lib/atdis/version.rb
CHANGED
@@ -182,6 +182,11 @@ describe ATDIS::Models::Info do
|
|
182
182
|
a.should_not be_valid
|
183
183
|
a.errors.messages.should == {dat_id: [ATDIS::ErrorMessage["should be url encoded", "4.3.1"]]}
|
184
184
|
end
|
185
|
+
|
186
|
+
it "should be valid if url encoded" do
|
187
|
+
a.dat_id = "010%2F2014%2F00000031%2F001"
|
188
|
+
a.should be_valid
|
189
|
+
end
|
185
190
|
end
|
186
191
|
|
187
192
|
describe "#description=" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atdis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Landauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|