Class: Riddl::Parameter::Simple

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/riddl/parameter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, type = :body) ⇒ Simple

Returns a new instance of Simple.



20
21
22
23
24
# File 'lib/ruby/riddl/parameter.rb', line 20

def initialize(name,value,type=:body)
  @name = name
  @value = value
  @type = (type == :query ? :query : :body)
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/ruby/riddl/parameter.rb', line 16

def name
  @name
end

#typeObject

Returns the value of attribute type.



16
17
18
# File 'lib/ruby/riddl/parameter.rb', line 16

def type
  @type
end

#valueObject

Returns the value of attribute value.



16
17
18
# File 'lib/ruby/riddl/parameter.rb', line 16

def value
  @value
end

Instance Method Details

#to_jsonObject



17
18
19
# File 'lib/ruby/riddl/parameter.rb', line 17

def to_json(*)
  "{\"name\": \"#{@name}\", \"value\": \"#{@value}\"}"
end