playerconnect-wsdsl 0.3.4 → 0.3.5
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 +4 -10
- data/Gemfile +7 -0
- data/Gemfile.lock +36 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/params.rb +4 -0
- data/lib/params_verification.rb +75 -64
- data/playerconnect-wsdsl.gemspec +28 -11
- data/spec/params_verification_spec.rb +21 -3
- data/spec/test_services.rb +2 -1
- data/spec/wsdsl_spec.rb +4 -4
- metadata +61 -4
    
        data/.rvmrc_example
    CHANGED
    
    | @@ -1,15 +1,9 @@ | |
| 1 1 | 
             
            gemset_name=wsdsl
         | 
| 2 2 | 
             
            ruby_version=1.9.2-p290
         | 
| 3 | 
            -
            rubygems_version=1.8. | 
| 4 | 
            -
             | 
| 5 | 
            -
            gems=('jeweler 1.6.4' 'rspec 2.6.0' 'yard 0.7.2' 'rack-test 0.5.7' 'sinatra 1.2.0')
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            export GIT_SSL_NO_VERIFY=true
         | 
| 3 | 
            +
            rubygems_version=1.8.10
         | 
| 4 | 
            +
            bundler_version=1.0.21
         | 
| 8 5 |  | 
| 9 6 | 
             
            rvm use $ruby_version@$gemset_name --create --install
         | 
| 10 7 | 
             
            [ $(gem -v) = $rubygems_version ] || rvm rubygems $rubygems_version
         | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
              gem list ${n} -v${v} -i >> /dev/null
         | 
| 14 | 
            -
              [ $? -eq 0 ] || gem install ${n} -v${v} --no-ri --no-rdoc
         | 
| 15 | 
            -
            done
         | 
| 8 | 
            +
            gem list bundler -v${bundler_version} -i >/dev/null
         | 
| 9 | 
            +
            [ $? -eq 0 ] || gem install bundler -v${bundler_version} --no-ri --no-rdoc
         | 
    
        data/Gemfile
    ADDED
    
    
    
        data/Gemfile.lock
    ADDED
    
    | @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            GEM
         | 
| 2 | 
            +
              remote: http://rubygems.org/
         | 
| 3 | 
            +
              specs:
         | 
| 4 | 
            +
                diff-lcs (1.1.3)
         | 
| 5 | 
            +
                git (1.2.5)
         | 
| 6 | 
            +
                jeweler (1.6.4)
         | 
| 7 | 
            +
                  bundler (~> 1.0)
         | 
| 8 | 
            +
                  git (>= 1.2.5)
         | 
| 9 | 
            +
                  rake
         | 
| 10 | 
            +
                rack (1.3.5)
         | 
| 11 | 
            +
                rack-test (0.5.7)
         | 
| 12 | 
            +
                  rack (>= 1.0)
         | 
| 13 | 
            +
                rake (0.9.2.2)
         | 
| 14 | 
            +
                rspec (2.7.0)
         | 
| 15 | 
            +
                  rspec-core (~> 2.7.0)
         | 
| 16 | 
            +
                  rspec-expectations (~> 2.7.0)
         | 
| 17 | 
            +
                  rspec-mocks (~> 2.7.0)
         | 
| 18 | 
            +
                rspec-core (2.7.1)
         | 
| 19 | 
            +
                rspec-expectations (2.7.0)
         | 
| 20 | 
            +
                  diff-lcs (~> 1.1.2)
         | 
| 21 | 
            +
                rspec-mocks (2.7.0)
         | 
| 22 | 
            +
                sinatra (1.2.0)
         | 
| 23 | 
            +
                  rack (~> 1.1)
         | 
| 24 | 
            +
                  tilt (>= 1.2.2, < 2.0)
         | 
| 25 | 
            +
                tilt (1.3.3)
         | 
| 26 | 
            +
                yard (0.7.2)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            PLATFORMS
         | 
| 29 | 
            +
              ruby
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            DEPENDENCIES
         | 
| 32 | 
            +
              jeweler (= 1.6.4)
         | 
| 33 | 
            +
              rack-test (= 0.5.7)
         | 
| 34 | 
            +
              rspec (= 2.7.0)
         | 
| 35 | 
            +
              sinatra (= 1.2.0)
         | 
| 36 | 
            +
              yard (= 0.7.2)
         | 
    
        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 =  | 
| 14 | 
            +
              gem.version = File.read('VERSION').chomp
         | 
| 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.3. | 
| 1 | 
            +
            0.3.5
         | 
    
        data/lib/params.rb
    CHANGED
    
    | @@ -24,6 +24,8 @@ class WSDSL | |
| 24 24 | 
             
                  # @option options [Symbol] :default The default value of the param.
         | 
| 25 25 | 
             
                  # @option options [Symbol] :minvalue The minimum acceptable value.
         | 
| 26 26 | 
             
                  # @option options [Symbol] :maxvalue The maximim acceptable value.
         | 
| 27 | 
            +
                  # @option options [Symbol] :minlength The minimum acceptable string length.
         | 
| 28 | 
            +
                  # @option options [Symbol] :maxlength The maximum acceptable string length.
         | 
| 27 29 | 
             
                  # @api public
         | 
| 28 30 | 
             
                  attr_reader :options
         | 
| 29 31 |  | 
| @@ -36,6 +38,8 @@ class WSDSL | |
| 36 38 | 
             
                  # @option opts [Symbol] :default The default value of the param.
         | 
| 37 39 | 
             
                  # @option opts [Symbol] :minvalue The minimum acceptable value.
         | 
| 38 40 | 
             
                  # @option opts [Symbol] :maxvalue The maximim acceptable value.
         | 
| 41 | 
            +
                  # @option opts [Symbol] :minlength The minimum acceptable string length.
         | 
| 42 | 
            +
                  # @option opts [Symbol] :maxlength The maximum acceptable string length.
         | 
| 39 43 | 
             
                  # @api public
         | 
| 40 44 | 
             
                  def initialize(name, opts = {})
         | 
| 41 45 | 
             
                    @name    = name
         | 
    
        data/lib/params_verification.rb
    CHANGED
    
    | @@ -128,14 +128,7 @@ module ParamsVerification | |
| 128 128 | 
             
              def self.validate_required_rule(rule, params, namespace=nil)
         | 
| 129 129 | 
             
                param_name  = rule.name.to_sym
         | 
| 130 130 | 
             
                namespace = namespace.to_sym if namespace
         | 
| 131 | 
            -
             | 
| 132 131 | 
             
                param_value, namespaced_params = extract_param_values(params, param_name, namespace)
         | 
| 133 | 
            -
                # puts "verify #{param_name} params, current value: #{param_value}"
         | 
| 134 | 
            -
             | 
| 135 | 
            -
                #This is disabled since required params shouldn't have a default, otherwise, why are they required?
         | 
| 136 | 
            -
                #if param_value.nil? && rule.options && rule.options[:default]
         | 
| 137 | 
            -
                  #param_value = rule.options[:default]
         | 
| 138 | 
            -
                #end
         | 
| 139 132 |  | 
| 140 133 | 
             
                # Checks presence
         | 
| 141 134 | 
             
                if !(namespaced_params || params).keys.include?(param_name)
         | 
| @@ -147,44 +140,10 @@ module ParamsVerification | |
| 147 140 | 
             
                  raise  InvalidParamValue, "Value for parameter '#{param_name}' is missing - passed params: #{params.inspect}."
         | 
| 148 141 | 
             
                end
         | 
| 149 142 |  | 
| 150 | 
            -
                #  | 
| 151 | 
            -
                 | 
| 152 | 
            -
                  verify_cast(param_name, param_value, rule.options[:type])
         | 
| 153 | 
            -
                end
         | 
| 154 | 
            -
             | 
| 155 | 
            -
                if rule.options[:options] || rule.options[:in]
         | 
| 156 | 
            -
                  choices = rule.options[:options] || rule.options[:in]
         | 
| 143 | 
            +
                # run the common set of rules used for any non nil value
         | 
| 144 | 
            +
                params = self.run_when_not_nil(rule, params, namespace)
         | 
| 157 145 |  | 
| 158 | 
            -
                  if rule.options[:type]
         | 
| 159 | 
            -
                    # Force the cast so we can compare properly
         | 
| 160 | 
            -
                    param_value = type_cast_value(rule.options[:type], param_value)
         | 
| 161 | 
            -
                    if namespace
         | 
| 162 | 
            -
                      params[namespace][param_name] = param_value
         | 
| 163 | 
            -
                    else
         | 
| 164 | 
            -
                      params[param_name] = param_value
         | 
| 165 | 
            -
                    end
         | 
| 166 | 
            -
                  end
         | 
| 167 | 
            -
             | 
| 168 | 
            -
                  validate_inclusion_of(param_name, param_value, choices)
         | 
| 169 | 
            -
             | 
| 170 | 
            -
                end
         | 
| 171 | 
            -
             | 
| 172 | 
            -
                if rule.options[:minvalue]
         | 
| 173 | 
            -
                  min = rule.options[:minvalue]
         | 
| 174 | 
            -
                  raise InvalidParamValue, "Value for parameter '#{param_name}' is lower than the min accepted value (#{min})." if param_value.to_i < min
         | 
| 175 | 
            -
                end
         | 
| 176 146 | 
             
                # Returns the updated params
         | 
| 177 | 
            -
             | 
| 178 | 
            -
                # cast the type if a type is defined and if a range of options isn't defined since the casting should have been done already
         | 
| 179 | 
            -
                if rule.options[:type] && !(rule.options[:options] || rule.options[:in])
         | 
| 180 | 
            -
                  # puts "casting #{param_value} into type: #{rule.options[:type]}"
         | 
| 181 | 
            -
                  param_value = type_cast_value(rule.options[:type], param_value)
         | 
| 182 | 
            -
                  if namespace
         | 
| 183 | 
            -
                    params[namespace][param_name] = param_value
         | 
| 184 | 
            -
                  else
         | 
| 185 | 
            -
                    params[param_name] = param_value
         | 
| 186 | 
            -
                  end
         | 
| 187 | 
            -
                end
         | 
| 188 147 | 
             
                params
         | 
| 189 148 | 
             
              end
         | 
| 190 149 |  | 
| @@ -213,49 +172,101 @@ module ParamsVerification | |
| 213 172 | 
             
                end
         | 
| 214 173 | 
             
              end
         | 
| 215 174 |  | 
| 216 | 
            -
             | 
| 217 | 
            -
              #  | 
| 218 | 
            -
              #  | 
| 219 | 
            -
              # | 
| 175 | 
            +
             | 
| 176 | 
            +
              # Validate non nil values. They may have been optional if left blank, but
         | 
| 177 | 
            +
              # when they are nil they are validated.
         | 
| 178 | 
            +
              #
         | 
| 179 | 
            +
              #
         | 
| 180 | 
            +
              # @param [WSDSL::Params::Rule] rule The required rule to check against.
         | 
| 181 | 
            +
              # @param [Hash] params The request params.
         | 
| 182 | 
            +
              # @param [String] namespace Optional param namespace to check the rule against.
         | 
| 183 | 
            +
              #
         | 
| 184 | 
            +
              # @return [Hash]
         | 
| 185 | 
            +
              #   A hash representing the potentially modified params after going through the filter.
         | 
| 220 186 | 
             
              #
         | 
| 221 187 | 
             
              # @api private
         | 
| 222 | 
            -
              def self. | 
| 188 | 
            +
              def self.run_when_not_nil(rule, params, namespace=nil)
         | 
| 223 189 | 
             
                param_name  = rule.name.to_sym
         | 
| 224 190 | 
             
                namespace = namespace.to_sym if namespace
         | 
| 225 | 
            -
             | 
| 226 191 | 
             
                param_value, namespaced_params = extract_param_values(params, param_name, namespace)
         | 
| 227 192 |  | 
| 228 | 
            -
                 | 
| 193 | 
            +
                # checks type
         | 
| 194 | 
            +
                if rule.options[:type]
         | 
| 195 | 
            +
                  verify_cast(param_name, param_value, rule.options[:type])
         | 
| 196 | 
            +
                  param_value = type_cast_value(rule.options[:type], param_value)
         | 
| 197 | 
            +
                  # update the params hash with the type cast value
         | 
| 229 198 | 
             
                  if namespace
         | 
| 230 199 | 
             
                    params[namespace] ||= {}
         | 
| 231 | 
            -
                    params[namespace][param_name] = param_value | 
| 200 | 
            +
                    params[namespace][param_name] = param_value
         | 
| 232 201 | 
             
                  else
         | 
| 233 | 
            -
                    params[param_name] = param_value | 
| 202 | 
            +
                    params[param_name] = param_value
         | 
| 234 203 | 
             
                  end
         | 
| 235 204 | 
             
                end
         | 
| 236 205 |  | 
| 237 | 
            -
                #  | 
| 238 | 
            -
                if rule.options[: | 
| 206 | 
            +
                # checks the value against a whitelist style 'in'/'options' list
         | 
| 207 | 
            +
                if rule.options[:options] || rule.options[:in]
         | 
| 208 | 
            +
                  choices = rule.options[:options] || rule.options[:in]
         | 
| 209 | 
            +
                  validate_inclusion_of(param_name, param_value, choices)
         | 
| 210 | 
            +
                end
         | 
| 211 | 
            +
             | 
| 212 | 
            +
                # enforce a minimum numeric value
         | 
| 213 | 
            +
                if rule.options[:minvalue]
         | 
| 214 | 
            +
                  min = rule.options[:minvalue]
         | 
| 215 | 
            +
                  raise InvalidParamValue, "Value for parameter '#{param_name}' is lower than the min accepted value (#{min})." if param_value.to_i < min
         | 
| 216 | 
            +
                end
         | 
| 217 | 
            +
             | 
| 218 | 
            +
                # enforce a maximum numeric value
         | 
| 219 | 
            +
                if rule.options[:maxvalue]
         | 
| 220 | 
            +
                  max = rule.options[:maxvalue]
         | 
| 221 | 
            +
                  raise InvalidParamValue, "Value for parameter '#{param_name}' is higher than the max accepted value (#{max})." if param_value.to_i > max
         | 
| 222 | 
            +
                end
         | 
| 223 | 
            +
             | 
| 224 | 
            +
                # enforce a minimum string length
         | 
| 225 | 
            +
                if rule.options[:minlength]
         | 
| 226 | 
            +
                  min = rule.options[:minlength]
         | 
| 227 | 
            +
                  raise InvalidParamValue, "Length of parameter '#{param_name}' is shorter than the min accepted value (#{min})." if param_value.to_s.length < min
         | 
| 228 | 
            +
                end
         | 
| 229 | 
            +
                
         | 
| 230 | 
            +
                # enforce a maximum string length
         | 
| 231 | 
            +
                if rule.options[:maxlength]
         | 
| 232 | 
            +
                  max = rule.options[:maxlength]
         | 
| 233 | 
            +
                  raise InvalidParamValue, "Length of parameter '#{param_name}' is longer than the max accepted value (#{max})." if param_value.to_s.length > max
         | 
| 234 | 
            +
                end
         | 
| 235 | 
            +
             | 
| 236 | 
            +
                # Return the modified params
         | 
| 237 | 
            +
                params
         | 
| 238 | 
            +
              end
         | 
| 239 | 
            +
             | 
| 240 | 
            +
             | 
| 241 | 
            +
              # @param [#WSDSL::Params::Rule] rule The optional rule
         | 
| 242 | 
            +
              # @param [Hash] params The request params
         | 
| 243 | 
            +
              # @param [String] namespace An optional namespace
         | 
| 244 | 
            +
              # @return [Hash] The potentially modified params
         | 
| 245 | 
            +
              #
         | 
| 246 | 
            +
              # @api private
         | 
| 247 | 
            +
              def self.run_optional_rule(rule, params, namespace=nil)
         | 
| 248 | 
            +
                param_name  = rule.name.to_sym
         | 
| 249 | 
            +
                namespace = namespace.to_sym if namespace
         | 
| 250 | 
            +
                param_value, namespaced_params = extract_param_values(params, param_name, namespace)
         | 
| 251 | 
            +
             | 
| 252 | 
            +
                # Use a default value if one is available and the submitted param value is nil
         | 
| 253 | 
            +
                if param_value.nil? && rule.options[:default]
         | 
| 254 | 
            +
                  param_value = rule.options[:default]
         | 
| 239 255 | 
             
                  if namespace
         | 
| 240 256 | 
             
                    params[namespace] ||= {}
         | 
| 241 | 
            -
                    params[namespace][param_name] = param_value | 
| 257 | 
            +
                    params[namespace][param_name] = param_value
         | 
| 242 258 | 
             
                  else
         | 
| 243 | 
            -
                    params[param_name] = param_value | 
| 259 | 
            +
                    params[param_name] = param_value
         | 
| 244 260 | 
             
                  end
         | 
| 245 261 | 
             
                end
         | 
| 246 262 |  | 
| 247 | 
            -
                 | 
| 248 | 
            -
             | 
| 249 | 
            -
                validate_inclusion_of(param_name, param_value, choices)
         | 
| 250 | 
            -
             | 
| 251 | 
            -
                if rule.options[:minvalue] && param_value
         | 
| 252 | 
            -
                  min = rule.options[:minvalue]
         | 
| 253 | 
            -
                  raise InvalidParamValue, "Value for parameter '#{param_name}' is lower than the min accepted value (#{min})." if param_value.to_i < min
         | 
| 254 | 
            -
                end
         | 
| 263 | 
            +
                # run the common set of rules used for any non nil value
         | 
| 264 | 
            +
                params = self.run_when_not_nil(rule, params, namespace) if param_value
         | 
| 255 265 |  | 
| 256 266 | 
             
                params
         | 
| 257 267 | 
             
              end
         | 
| 258 268 |  | 
| 269 | 
            +
             | 
| 259 270 | 
             
              def self.unexpected_params?(params, param_names)
         | 
| 260 271 | 
             
                # Raise an exception unless no unexpected params were found
         | 
| 261 272 | 
             
                unexpected_keys = (params.keys - param_names)
         | 
    
        data/playerconnect-wsdsl.gemspec
    CHANGED
    
    | @@ -4,20 +4,22 @@ | |
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 | 
            -
              s.name =  | 
| 8 | 
            -
              s.version = "0.3. | 
| 7 | 
            +
              s.name = "playerconnect-wsdsl"
         | 
| 8 | 
            +
              s.version = "0.3.5"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            -
              s.authors = [ | 
| 12 | 
            -
              s.date =  | 
| 13 | 
            -
              s.description =  | 
| 14 | 
            -
              s.email =  | 
| 11 | 
            +
              s.authors = ["Team SDOD"]
         | 
| 12 | 
            +
              s.date = "2011-11-03"
         | 
| 13 | 
            +
              s.description = "A Ruby DSL describing Web Services without implementation details."
         | 
| 14 | 
            +
              s.email = "sdod"
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| 16 16 | 
             
                "LICENSE",
         | 
| 17 17 | 
             
                "README.md"
         | 
| 18 18 | 
             
              ]
         | 
| 19 19 | 
             
              s.files = [
         | 
| 20 20 | 
             
                ".rvmrc_example",
         | 
| 21 | 
            +
                "Gemfile",
         | 
| 22 | 
            +
                "Gemfile.lock",
         | 
| 21 23 | 
             
                "LICENSE",
         | 
| 22 24 | 
             
                "README.md",
         | 
| 23 25 | 
             
                "Rakefile",
         | 
| @@ -42,19 +44,34 @@ Gem::Specification.new do |s| | |
| 42 44 | 
             
                "spec/wsdsl_spec.rb",
         | 
| 43 45 | 
             
                "wsdsl.gemspec"
         | 
| 44 46 | 
             
              ]
         | 
| 45 | 
            -
              s.homepage =  | 
| 46 | 
            -
              s.licenses = [ | 
| 47 | 
            -
              s.require_paths = [ | 
| 48 | 
            -
              s.rubygems_version =  | 
| 49 | 
            -
              s.summary =  | 
| 47 | 
            +
              s.homepage = "http://github.com/playerconnect/wsdsl"
         | 
| 48 | 
            +
              s.licenses = ["MIT"]
         | 
| 49 | 
            +
              s.require_paths = ["lib"]
         | 
| 50 | 
            +
              s.rubygems_version = "1.8.10"
         | 
| 51 | 
            +
              s.summary = "Web Service DSL"
         | 
| 50 52 |  | 
| 51 53 | 
             
              if s.respond_to? :specification_version then
         | 
| 52 54 | 
             
                s.specification_version = 3
         | 
| 53 55 |  | 
| 54 56 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 57 | 
            +
                  s.add_runtime_dependency(%q<jeweler>, ["= 1.6.4"])
         | 
| 58 | 
            +
                  s.add_runtime_dependency(%q<rspec>, ["= 2.7.0"])
         | 
| 59 | 
            +
                  s.add_runtime_dependency(%q<yard>, ["= 0.7.2"])
         | 
| 60 | 
            +
                  s.add_runtime_dependency(%q<rack-test>, ["= 0.5.7"])
         | 
| 61 | 
            +
                  s.add_runtime_dependency(%q<sinatra>, ["= 1.2.0"])
         | 
| 55 62 | 
             
                else
         | 
| 63 | 
            +
                  s.add_dependency(%q<jeweler>, ["= 1.6.4"])
         | 
| 64 | 
            +
                  s.add_dependency(%q<rspec>, ["= 2.7.0"])
         | 
| 65 | 
            +
                  s.add_dependency(%q<yard>, ["= 0.7.2"])
         | 
| 66 | 
            +
                  s.add_dependency(%q<rack-test>, ["= 0.5.7"])
         | 
| 67 | 
            +
                  s.add_dependency(%q<sinatra>, ["= 1.2.0"])
         | 
| 56 68 | 
             
                end
         | 
| 57 69 | 
             
              else
         | 
| 70 | 
            +
                s.add_dependency(%q<jeweler>, ["= 1.6.4"])
         | 
| 71 | 
            +
                s.add_dependency(%q<rspec>, ["= 2.7.0"])
         | 
| 72 | 
            +
                s.add_dependency(%q<yard>, ["= 0.7.2"])
         | 
| 73 | 
            +
                s.add_dependency(%q<rack-test>, ["= 0.5.7"])
         | 
| 74 | 
            +
                s.add_dependency(%q<sinatra>, ["= 1.2.0"])
         | 
| 58 75 | 
             
              end
         | 
| 59 76 | 
             
            end
         | 
| 60 77 |  | 
| @@ -26,8 +26,8 @@ describe ParamsVerification do | |
| 26 26 | 
             
              it "should return array in the params" do
         | 
| 27 27 | 
             
                params = @valid_params
         | 
| 28 28 | 
             
                returned_params = ParamsVerification.validate!(params, @service.defined_params)
         | 
| 29 | 
            -
                returned_params[:user][:groups].should == @valid_params['user']['groups'].split(",")
         | 
| 30 | 
            -
                returned_params[:user][:skills].should == @valid_params['user']['skills'].split(",")
         | 
| 29 | 
            +
                returned_params[:user][:groups].should be == @valid_params['user']['groups'].split(",")
         | 
| 30 | 
            +
                returned_params[:user][:skills].should be == @valid_params['user']['skills'].split(",")
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| 33 33 | 
             
              it "should not duplicate params in the root level" do
         | 
| @@ -76,7 +76,7 @@ describe ParamsVerification do | |
| 76 76 | 
             
                service.should_not be_nil
         | 
| 77 77 | 
             
                params = {'seq' => "a,b,c,d,e,g"}
         | 
| 78 78 | 
             
                validated = ParamsVerification.validate!(params, service.defined_params)
         | 
| 79 | 
            -
                validated[:seq].should == %W{a b c d e g}
         | 
| 79 | 
            +
                validated[:seq].should be == %W{a b c d e g}
         | 
| 80 80 | 
             
              end
         | 
| 81 81 |  | 
| 82 82 | 
             
              it "should not raise an exception if a req array param doesn't contain a comma" do
         | 
| @@ -97,6 +97,24 @@ describe ParamsVerification do | |
| 97 97 | 
             
                lambda{ ParamsVerification.validate!(params, @service.defined_params) }.should raise_exception(ParamsVerification::InvalidParamValue)
         | 
| 98 98 | 
             
              end
         | 
| 99 99 |  | 
| 100 | 
            +
              it "should raise an exception when a param is over the maxvalue" do
         | 
| 101 | 
            +
                params = @valid_params.dup
         | 
| 102 | 
            +
                params['num'] = 10_000
         | 
| 103 | 
            +
                lambda{ ParamsVerification.validate!(params, @service.defined_params) }.should raise_exception(ParamsVerification::InvalidParamValue)
         | 
| 104 | 
            +
              end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
              it "should raise an exception when a param is under the minlength" do
         | 
| 107 | 
            +
                params = @valid_params.dup
         | 
| 108 | 
            +
                params['name'] ='bob'
         | 
| 109 | 
            +
                lambda{ ParamsVerification.validate!(params, @service.defined_params) }.should raise_exception(ParamsVerification::InvalidParamValue)
         | 
| 110 | 
            +
              end
         | 
| 111 | 
            +
             | 
| 112 | 
            +
              it "should raise an exception when a param is over the maxlength" do
         | 
| 113 | 
            +
                params = @valid_params.dup
         | 
| 114 | 
            +
                params['name'] ='AreTheseGardensMyMother?AmIPartOfYouBoth?'
         | 
| 115 | 
            +
                lambda{ ParamsVerification.validate!(params, @service.defined_params) }.should raise_exception(ParamsVerification::InvalidParamValue)
         | 
| 116 | 
            +
              end
         | 
| 117 | 
            +
             | 
| 100 118 | 
             
              it "should raise an exception when a param isn't in the param option list" do
         | 
| 101 119 | 
             
                params = @valid_params.dup
         | 
| 102 120 | 
             
                params['alpha'] = 'z'
         | 
    
        data/spec/test_services.rb
    CHANGED
    
    | @@ -10,7 +10,8 @@ describe_service "services/test.xml" do |service| | |
| 10 10 | 
             
                p.datetime :timestamp, :default => Time.now
         | 
| 11 11 | 
             
                p.string   :alpha,     :in      => ['a', 'b', 'c']
         | 
| 12 12 | 
             
                p.string   :version,   :null    => false
         | 
| 13 | 
            -
                p.integer  :num,      :minvalue => 42
         | 
| 13 | 
            +
                p.integer  :num,      :minvalue => 42, :maxvalue => 1000
         | 
| 14 | 
            +
                p.string   :name,  :minlength => 5, :maxlength => 25
         | 
| 14 15 |  | 
| 15 16 | 
             
              end
         | 
| 16 17 |  | 
    
        data/spec/wsdsl_spec.rb
    CHANGED
    
    | @@ -135,7 +135,7 @@ describe WSDSL do | |
| 135 135 | 
             
                  describe_service("projects.xml") { |s| }
         | 
| 136 136 | 
             
                  service = WSList.all.find{|s| s.url == "projects.xml"}
         | 
| 137 137 | 
             
                  service.controller_dispatch("application").
         | 
| 138 | 
            -
                    should == ["application", "projects"]
         | 
| 138 | 
            +
                    should be == ["application", "projects"]
         | 
| 139 139 | 
             
                end
         | 
| 140 140 |  | 
| 141 141 | 
             
                it "should be able to dispatch namespaced controller" do
         | 
| @@ -150,10 +150,10 @@ describe WSDSL do | |
| 150 150 | 
             
                  end
         | 
| 151 151 |  | 
| 152 152 | 
             
                  service = WSList.all.find{|s| s.url == "project/:project_id/tasks.xml"}
         | 
| 153 | 
            -
                  service.controller_dispatch("application").should == ["application", "project"]
         | 
| 153 | 
            +
                  service.controller_dispatch("application").should be == ["application", "project"]
         | 
| 154 154 |  | 
| 155 155 | 
             
                  service = WSList.all.find{|s| s.url == "project/:project_id/task/:task_id/items.xml"}
         | 
| 156 | 
            -
                  service.controller_dispatch("application").should == ["application", "project"]
         | 
| 156 | 
            +
                  service.controller_dispatch("application").should be == ["application", "project"]
         | 
| 157 157 | 
             
                end
         | 
| 158 158 |  | 
| 159 159 | 
             
                it "should raise exception when controller class is not found" do
         | 
| @@ -188,7 +188,7 @@ describe WSDSL do | |
| 188 188 |  | 
| 189 189 | 
             
                it "should have a list of optional param rules" do
         | 
| 190 190 | 
             
                  @sparams.list_optional.should be_an_instance_of(Array)
         | 
| 191 | 
            -
                  @sparams.list_optional.length.should be ==  | 
| 191 | 
            +
                  @sparams.list_optional.length.should be == 5
         | 
| 192 192 | 
             
                end
         | 
| 193 193 |  | 
| 194 194 | 
             
                it "should have a list of namespaced param rules" do
         | 
    
        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.3. | 
| 4 | 
            +
              version: 0.3.5
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,8 +9,63 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2011-11- | 
| 13 | 
            -
            dependencies: | 
| 12 | 
            +
            date: 2011-11-03 00:00:00.000000000Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: jeweler
         | 
| 16 | 
            +
              requirement: &2161773700 !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - =
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: 1.6.4
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: *2161773700
         | 
| 25 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 26 | 
            +
              name: rspec
         | 
| 27 | 
            +
              requirement: &2161773220 !ruby/object:Gem::Requirement
         | 
| 28 | 
            +
                none: false
         | 
| 29 | 
            +
                requirements:
         | 
| 30 | 
            +
                - - =
         | 
| 31 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 32 | 
            +
                    version: 2.7.0
         | 
| 33 | 
            +
              type: :runtime
         | 
| 34 | 
            +
              prerelease: false
         | 
| 35 | 
            +
              version_requirements: *2161773220
         | 
| 36 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 37 | 
            +
              name: yard
         | 
| 38 | 
            +
              requirement: &2161772740 !ruby/object:Gem::Requirement
         | 
| 39 | 
            +
                none: false
         | 
| 40 | 
            +
                requirements:
         | 
| 41 | 
            +
                - - =
         | 
| 42 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 43 | 
            +
                    version: 0.7.2
         | 
| 44 | 
            +
              type: :runtime
         | 
| 45 | 
            +
              prerelease: false
         | 
| 46 | 
            +
              version_requirements: *2161772740
         | 
| 47 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 48 | 
            +
              name: rack-test
         | 
| 49 | 
            +
              requirement: &2161772260 !ruby/object:Gem::Requirement
         | 
| 50 | 
            +
                none: false
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - =
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: 0.5.7
         | 
| 55 | 
            +
              type: :runtime
         | 
| 56 | 
            +
              prerelease: false
         | 
| 57 | 
            +
              version_requirements: *2161772260
         | 
| 58 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 59 | 
            +
              name: sinatra
         | 
| 60 | 
            +
              requirement: &2161771760 !ruby/object:Gem::Requirement
         | 
| 61 | 
            +
                none: false
         | 
| 62 | 
            +
                requirements:
         | 
| 63 | 
            +
                - - =
         | 
| 64 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 65 | 
            +
                    version: 1.2.0
         | 
| 66 | 
            +
              type: :runtime
         | 
| 67 | 
            +
              prerelease: false
         | 
| 68 | 
            +
              version_requirements: *2161771760
         | 
| 14 69 | 
             
            description: A Ruby DSL describing Web Services without implementation details.
         | 
| 15 70 | 
             
            email: sdod
         | 
| 16 71 | 
             
            executables: []
         | 
| @@ -20,6 +75,8 @@ extra_rdoc_files: | |
| 20 75 | 
             
            - README.md
         | 
| 21 76 | 
             
            files:
         | 
| 22 77 | 
             
            - .rvmrc_example
         | 
| 78 | 
            +
            - Gemfile
         | 
| 79 | 
            +
            - Gemfile.lock
         | 
| 23 80 | 
             
            - LICENSE
         | 
| 24 81 | 
             
            - README.md
         | 
| 25 82 | 
             
            - Rakefile
         | 
| @@ -64,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 64 121 | 
             
                  version: '0'
         | 
| 65 122 | 
             
            requirements: []
         | 
| 66 123 | 
             
            rubyforge_project: 
         | 
| 67 | 
            -
            rubygems_version: 1.8. | 
| 124 | 
            +
            rubygems_version: 1.8.10
         | 
| 68 125 | 
             
            signing_key: 
         | 
| 69 126 | 
             
            specification_version: 3
         | 
| 70 127 | 
             
            summary: Web Service DSL
         |