playerconnect-wsdsl 0.2.5 → 0.2.6
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/.rvmrc_example +1 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/params_verification.rb +38 -5
- data/playerconnect-wsdsl.gemspec +2 -2
- metadata +2 -2
data/.rvmrc_example
CHANGED
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ Jeweler::Tasks.new do |gem|
|
|
11
11
|
gem.description = %Q{A Ruby DSL describing Web Services without implementation details.}
|
12
12
|
gem.email = "sdod"
|
13
13
|
gem.authors = ["Team SDOD"]
|
14
|
-
gem.version = "0.2.
|
14
|
+
gem.version = "0.2.6"
|
15
15
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
16
16
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
17
17
|
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/lib/params_verification.rb
CHANGED
@@ -75,7 +75,10 @@ module ParamsVerification
|
|
75
75
|
|
76
76
|
# verify nested params, only 1 level deep tho
|
77
77
|
params.each_pair do |key, value|
|
78
|
-
|
78
|
+
# We are now assuming a file param is a hash due to Rack::Mulitpart.parse_multipart
|
79
|
+
# turns this data into a hash, but param verification/DSL dont expect this or define this behavior and it shouldn't.
|
80
|
+
# so special case it if its a file type and the value is a hash.
|
81
|
+
if value.is_a?(Hash) && type_for_param(service_params, key) != :file
|
79
82
|
namespaced = service_params.namespaced_params.find{|np| np.space_name.to_s == key.to_s}
|
80
83
|
raise UnexpectedParam, "Request included unexpected parameter: #{key}" if namespaced.nil?
|
81
84
|
unexpected_params?(params[key], namespaced.param_names)
|
@@ -237,16 +240,38 @@ module ParamsVerification
|
|
237
240
|
end
|
238
241
|
# An array type is a comma delimited string, we need to cast the passed strings.
|
239
242
|
when :array
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
+
if value.respond_to?(:split)
|
244
|
+
# For compatibility with testing frameworks that pass in arrays using
|
245
|
+
# Ruby notation, strip away unwanted square brackets ([]), double quotes ("),
|
246
|
+
# and whitespace from the notation.
|
247
|
+
#
|
248
|
+
# only after the non-escaped (backslash preceded) double quote (") characters
|
249
|
+
# have been removed, remove any backslash characters from the string that
|
250
|
+
# appear immediately before a double quote (") character (thereby un-escaping
|
251
|
+
# the double quote character).
|
252
|
+
#
|
253
|
+
# Pattern = Description
|
254
|
+
# (?:) = non-capturing regex group (used for ORing)
|
255
|
+
# ^\[ = opening square bracket ([) at the start of the string
|
256
|
+
# \]$ = closing square bracket (]) at the end of the string
|
257
|
+
# (?<!\\") = a non-escaped double-quote (escaped ones need to be preserved)
|
258
|
+
#
|
259
|
+
# \\" = a single backslash followed by a double quotes character
|
260
|
+
if value.size > 1 && value[0] == '[' && value[-1] == ']'
|
261
|
+
value.gsub!(/(?:^\[|\]$|(?<!\\)")/, '').gsub!('\\"','"')
|
262
|
+
end
|
263
|
+
# the resulting string can now be split using an optionally whitespace padded
|
264
|
+
# comma (,) delimiter.
|
265
|
+
value = value.split(/\s*,\s*/)
|
266
|
+
end
|
267
|
+
value
|
243
268
|
when :binary, :array, :file
|
244
269
|
value
|
245
270
|
else
|
246
271
|
value
|
247
272
|
end
|
248
273
|
end
|
249
|
-
|
274
|
+
|
250
275
|
# Checks that the value's type matches the expected type for a given param
|
251
276
|
#
|
252
277
|
# @param [Symbol, String] Param name used if the verification fails and that an error is raised.
|
@@ -266,4 +291,12 @@ module ParamsVerification
|
|
266
291
|
end
|
267
292
|
end
|
268
293
|
|
294
|
+
def self.type_for_param(service_params, name)
|
295
|
+
(service_params.list_required + service_params.list_optional).each do |rule|
|
296
|
+
if rule.name.to_s == name.to_s
|
297
|
+
return rule.options[:type]
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
269
302
|
end
|
data/playerconnect-wsdsl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{playerconnect-wsdsl}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Team SDOD}]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-19}
|
13
13
|
s.description = %q{A Ruby DSL describing Web Services without implementation details.}
|
14
14
|
s.email = %q{sdod}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playerconnect-wsdsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
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-07-
|
12
|
+
date: 2011-07-19 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby DSL describing Web Services without implementation details.
|
15
15
|
email: sdod
|