class Raddocs::Parameter

Parameter of a request

Can have an unknown columns

@example

Parameter.new({
  "name" => "page",
  "description" => "Page number",
  "Type" => "Integer"
})

Attributes

description[R]
name[R]
required[R]
scope[R]

Public Class Methods

new(attributes) click to toggle source

@param attributes [Hash] @option attributes [String] “name” Required @option attributes [String] “description” Required @option attributes [boolean] “required” defaults to false @option attributes [String] “scope” Scope of the parameter, eg 'order[]', defaults to nil

# File lib/raddocs/models.rb, line 137
def initialize(attributes)
  @attrs = attributes

  @name = attributes.fetch("name")
  @description = attributes.fetch("description")
  @required = attributes.fetch("required", false)
  @scope = attributes.fetch("scope", nil)
end

Public Instance Methods

[](key) click to toggle source

Allows unknown keys to be accessed @param key [String] @return [Object]

# File lib/raddocs/models.rb, line 169
def [](key)
  @attrs[key]
end
required?() click to toggle source

@return [Boolean] true if required is true

# File lib/raddocs/models.rb, line 147
def required?
  !!@required
end
scope?() click to toggle source

@return [Boolean] true if scope is present

# File lib/raddocs/models.rb, line 152
def scope?
  !!@scope
end