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.



198
199
200
201
202
203
204
# File 'lib/raddocs/models.rb', line 198

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.



196
197
198
# File 'lib/raddocs/models.rb', line 196

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



196
197
198
# File 'lib/raddocs/models.rb', line 196

def name
  @name
end

#scopeObject (readonly)

Returns the value of attribute scope.



196
197
198
# File 'lib/raddocs/models.rb', line 196

def scope
  @scope
end

Instance Method Details

#[](key) ⇒ Object

Allows unknown keys to be accessed

Parameters:

  • key (String)

Returns:

  • (Object)


214
215
216
# File 'lib/raddocs/models.rb', line 214

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

#scope?Boolean

Returns true if scope is present.

Returns:

  • (Boolean)

    true if scope is present



207
208
209
# File 'lib/raddocs/models.rb', line 207

def scope?
  !!@scope
end