weasel_diesel 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/params_verification.rb +1 -1
- data/lib/weasel_diesel/version.rb +1 -1
- data/lib/weasel_diesel.rb +5 -1
- data/spec/params_verification_spec.rb +6 -0
- data/spec/test_services.rb +1 -2
- metadata +120 -84
data/README.md
CHANGED
@@ -158,7 +158,7 @@ Options can be combined.
|
|
158
158
|
* `in` or `options` limits the range of the possible values being
|
159
159
|
passed. Example: `service.param.string :skills, :options %w{ruby scala clojure}`
|
160
160
|
* `default` sets a value for your in case you don't pass one. Example:
|
161
|
-
`service.param.datetime :timestamp, :default => Time.now`
|
161
|
+
`service.param.datetime :timestamp, :default => Time.now.iso8601`
|
162
162
|
* `min_value` forces the param value to be equal or greater than the
|
163
163
|
option's value. Example: `service.param.integer :age, :min_value => 21
|
164
164
|
* `max_value` forces the param value to be equal or less than the
|
data/lib/params_verification.rb
CHANGED
@@ -174,7 +174,7 @@ module ParamsVerification
|
|
174
174
|
#
|
175
175
|
def self.validate_and_cast_type(param_value, param_name, rule_type, params, namespace=nil)
|
176
176
|
# checks type & modifies params if needed
|
177
|
-
if rule_type
|
177
|
+
if rule_type && param_value
|
178
178
|
verify_cast(param_name, param_value, rule_type)
|
179
179
|
param_value = type_cast_value(rule_type, param_value)
|
180
180
|
# update the params hash with the type cast value
|
data/lib/weasel_diesel.rb
CHANGED
@@ -326,7 +326,11 @@ class WeaselDiesel
|
|
326
326
|
# @return [WeaselDiesel::Documentation] The service documentation object
|
327
327
|
# @api public
|
328
328
|
def documentation
|
329
|
-
|
329
|
+
if block_given?
|
330
|
+
yield(doc)
|
331
|
+
else
|
332
|
+
doc
|
333
|
+
end
|
330
334
|
end
|
331
335
|
|
332
336
|
# Assign a route loading point to compare two routes.
|
@@ -23,6 +23,12 @@ describe ParamsVerification do
|
|
23
23
|
returned_params.should be_an_instance_of(Hash)
|
24
24
|
returned_params.keys.size.should >= 3
|
25
25
|
end
|
26
|
+
|
27
|
+
it "shouldn't set empty nil values for optional params that aren't passed" do
|
28
|
+
params = copy(@valid_params)
|
29
|
+
returned_params = ParamsVerification.validate!(params, @service.defined_params)
|
30
|
+
returned_params.has_key?('name').should be_false
|
31
|
+
end
|
26
32
|
|
27
33
|
it "should return array in the params" do
|
28
34
|
params = copy(@valid_params)
|
data/spec/test_services.rb
CHANGED
@@ -9,11 +9,10 @@ describe_service "services/test.xml" do |service|
|
|
9
9
|
service.params do |p|
|
10
10
|
p.string :framework,
|
11
11
|
:in => WeaselDieselSpecOptions,
|
12
|
-
:null => false,
|
13
12
|
:required => true,
|
14
13
|
:doc => "The test framework used, could be one of the two following: #{WeaselDieselSpecOptions.join(", ")}."
|
15
14
|
|
16
|
-
p.datetime :timestamp, :default => Time.now
|
15
|
+
p.datetime :timestamp, :default => Time.now.iso8601
|
17
16
|
p.string :alpha, :in => ['a', 'b', 'c']
|
18
17
|
p.string :version, :null => false, :doc => "The version of the framework to use."
|
19
18
|
p.integer :num, :min_value => 42, :max_value => 1000, :doc => "The number to test"
|
metadata
CHANGED
@@ -1,103 +1,130 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: weasel_diesel
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Matt Aimonetti
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-07-18 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rspec
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rack-test
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
33
24
|
none: false
|
34
|
-
requirements:
|
35
|
-
- -
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
38
32
|
type: :development
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rack-test
|
39
36
|
prerelease: false
|
40
|
-
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: yard
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
49
38
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
version: "0"
|
54
46
|
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: yard
|
55
50
|
prerelease: false
|
56
|
-
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
52
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
70
60
|
type: :development
|
61
|
+
version_requirements: *id003
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sinatra
|
71
64
|
prerelease: false
|
72
|
-
|
65
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
66
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
79
77
|
name: rake
|
80
|
-
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
80
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
version: "0"
|
86
88
|
type: :development
|
89
|
+
version_requirements: *id005
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: backports
|
92
|
+
prerelease: false
|
93
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
type: :runtime
|
103
|
+
version_requirements: *id006
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: json
|
87
106
|
prerelease: false
|
88
|
-
|
107
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
89
108
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
type: :runtime
|
117
|
+
version_requirements: *id007
|
94
118
|
description: Ruby DSL describing Web Services without implementation details.
|
95
|
-
email:
|
119
|
+
email:
|
96
120
|
- mattaimonetti@gmail.com
|
97
121
|
executables: []
|
122
|
+
|
98
123
|
extensions: []
|
124
|
+
|
99
125
|
extra_rdoc_files: []
|
100
|
-
|
126
|
+
|
127
|
+
files:
|
101
128
|
- .gitignore
|
102
129
|
- .travis.yml
|
103
130
|
- Gemfile
|
@@ -132,29 +159,38 @@ files:
|
|
132
159
|
- weasel_diesel.gemspec
|
133
160
|
homepage: https://github.com/mattetti/Weasel-Diesel
|
134
161
|
licenses: []
|
162
|
+
|
135
163
|
post_install_message:
|
136
164
|
rdoc_options: []
|
137
|
-
|
165
|
+
|
166
|
+
require_paths:
|
138
167
|
- lib
|
139
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
169
|
none: false
|
141
|
-
requirements:
|
142
|
-
- -
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
|
145
|
-
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
hash: 3
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
version: "0"
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
178
|
none: false
|
147
|
-
requirements:
|
148
|
-
- -
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
hash: 3
|
183
|
+
segments:
|
184
|
+
- 0
|
185
|
+
version: "0"
|
151
186
|
requirements: []
|
187
|
+
|
152
188
|
rubyforge_project: wsdsl
|
153
|
-
rubygems_version: 1.8.
|
189
|
+
rubygems_version: 1.8.16
|
154
190
|
signing_key:
|
155
191
|
specification_version: 3
|
156
192
|
summary: Web Service DSL
|
157
|
-
test_files:
|
193
|
+
test_files:
|
158
194
|
- spec/hello_world_controller.rb
|
159
195
|
- spec/hello_world_service.rb
|
160
196
|
- spec/json_response_description_spec.rb
|