wsdsl 0.3.2 → 0.3.3
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.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/params_verification.rb +3 -2
- data/spec/params_verification_spec.rb +9 -0
- data/wsdsl.gemspec +2 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Or a more complex example:
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# service.param :delta, :optional => true, :type => 'float'
|
47
|
-
#
|
47
|
+
# All params are optional by default.
|
48
48
|
# service.param :epsilon, :type => 'string'
|
49
49
|
|
50
50
|
service.params.namespace :user do |user|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/lib/params_verification.rb
CHANGED
@@ -51,7 +51,7 @@ module ParamsVerification
|
|
51
51
|
end
|
52
52
|
|
53
53
|
# dupe the params so we don't modify the passed value
|
54
|
-
updated_params = params.dup
|
54
|
+
updated_params = params.dup
|
55
55
|
# Required param verification
|
56
56
|
service_params.list_required.each do |rule|
|
57
57
|
updated_params = validate_required_rule(rule, updated_params)
|
@@ -119,7 +119,8 @@ module ParamsVerification
|
|
119
119
|
# checks type
|
120
120
|
elsif rule.options[:type]
|
121
121
|
verify_cast(param_name, param_value, rule.options[:type])
|
122
|
-
|
122
|
+
end
|
123
|
+
if rule.options[:options] || rule.options[:in]
|
123
124
|
choices = rule.options[:options] || rule.options[:in]
|
124
125
|
if rule.options[:type]
|
125
126
|
# Force the cast so we can compare properly
|
@@ -82,6 +82,15 @@ describe ParamsVerification do
|
|
82
82
|
service.should_not be_nil
|
83
83
|
lambda{ ParamsVerification.validate!(params, service.defined_params) }.should raise_exception(ParamsVerification::InvalidParamValue)
|
84
84
|
end
|
85
|
+
|
86
|
+
it "should raise an exception when a required param is present but doesn't match the limited set of options" do
|
87
|
+
service = describe_service "search" do |service|
|
88
|
+
service.params { |p| p.string :by, :options => ['name', 'code', 'last_four'], :required => true }
|
89
|
+
end
|
90
|
+
params = {'by' => 'foo'}
|
91
|
+
lambda{ ParamsVerification.validate!(params, service.defined_params) }.should raise_exception(ParamsVerification::InvalidParamValue)
|
92
|
+
end
|
93
|
+
|
85
94
|
|
86
95
|
it "should validate that no params are passed when accept_no_params! is set on a service" do
|
87
96
|
service = WSList.all.find{|s| s.url == "services/test_no_params.xml"}
|
data/wsdsl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{wsdsl}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Matt Aimonetti}]
|
12
|
-
s.date = %q{2011-09-
|
12
|
+
s.date = %q{2011-09-12}
|
13
13
|
s.description = %q{A Ruby DSL describing Web Services without implementation details.}
|
14
14
|
s.email = %q{mattaimonetti@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wsdsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-12 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby DSL describing Web Services without implementation details.
|
15
15
|
email: mattaimonetti@gmail.com
|