Class: Raddocs::ResponseField

Inherits:
Object
  • Object
show all
Defined in:
lib/raddocs/models.rb

Overview

Fields of a response

Can have an unknown columns

Examples:

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ ResponseField

Returns a new instance of ResponseField.



183
184
185
186
187
188
189
# File 'lib/raddocs/models.rb', line 183

def initialize(attributes)
  @attrs = attributes

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



181
182
183
# File 'lib/raddocs/models.rb', line 181

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



181
182
183
# File 'lib/raddocs/models.rb', line 181

def name
  @name
end

#scopeObject (readonly)

Returns the value of attribute scope.



181
182
183
# File 'lib/raddocs/models.rb', line 181

def scope
  @scope
end

Instance Method Details

#[](key) ⇒ Object

Allows unknown keys to be accessed

Parameters:

  • key (String)

Returns:

  • (Object)


199
200
201
# File 'lib/raddocs/models.rb', line 199

def [](key)
  @attrs[key]
end

#scope?Boolean

Returns true if scope is present.

Returns:

  • (Boolean)

    true if scope is present



192
193
194
# File 'lib/raddocs/models.rb', line 192

def scope?
  !!@scope
end