Class: Swaggable::ParameterDefinition

Inherits:
Object
  • Object
show all
Includes:
ForwardingDsl::Getsetter
Defined in:
lib/swaggable/parameter_definition.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) {|_self| ... } ⇒ ParameterDefinition

Returns a new instance of ParameterDefinition.

Yields:

  • (_self)

Yield Parameters:



15
16
17
18
# File 'lib/swaggable/parameter_definition.rb', line 15

def initialize args = {}
  args.each {|k, v| self.send("#{k}=", v) }
  yield self if block_given?
end

Instance Method Details

#location=(location) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/swaggable/parameter_definition.rb', line 24

def location= location
  unless valid_locations.include? location
    raise ArgumentError.new("#{location} is not one of the valid locations: #{valid_locations.join(", ")}")
  end

  @location = location
end

#required?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/swaggable/parameter_definition.rb', line 20

def required?
  !!required
end

#type=(type) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/swaggable/parameter_definition.rb', line 32

def type= type
  unless valid_types.include? type
    raise ArgumentError.new("#{type} is not one of the valid types: #{valid_types.join(", ")}")
  end

  @type = type
end