Method: WSDSL::Params#param

Defined in:
lib/params.rb

#param(type, name, options = {}) ⇒ Array

Defines a new param and add it to the optional or required list based the passed options.

Examples:

Declaring an integer service param called id

service.param(:id, :integer, :default => 9999, :in => [0, 9999])

Parameters:

  • type (Symbol)

    The type of param

  • name (Symbol, String)

    The name of the param

  • options (Hash) (defaults to: {})

    A hash representing the param settings

Returns:

  • (Array)

    the typed list of params (required or optional)

Since:

  • 0.0.3



91
92
93
94
95
96
97
98
99
# File 'lib/params.rb', line 91

def param(type, name, options={})
  options[:type] = type
  options[:space_name] = options[:space_name] || space_name
  if options.delete(:required)
    list_required << Rule.new(name, options)
  else
    list_optional << Rule.new(name, options)
  end
end