Class: RspecApiDocs::Resource::ResponseField

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_api_docs/formatter/resource/response_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, field) ⇒ ResponseField

Returns a new instance of ResponseField.



6
7
8
9
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 6

def initialize(name, field)
  @name = name
  @field = field
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



4
5
6
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 4

def field
  @field
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 4

def name
  @name
end

Instance Method Details

#==(other) ⇒ true, false

Returns:

  • (true, false)


38
39
40
41
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 38

def ==(other)
  name == other.name &&
    field == other.field
end

#descriptionString

The description of the response field

Returns:

  • (String)


28
29
30
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 28

def description
  field[:description]
end

#exampleObject

Example value



33
34
35
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 33

def example
  field[:example]
end

#scopeArray<String>

The scope of the response field

Returns:

  • (Array<String>)


14
15
16
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 14

def scope
  field[:scope]
end

#typeString

The type of the response field

Returns:

  • (String)


21
22
23
# File 'lib/rspec_api_docs/formatter/resource/response_field.rb', line 21

def type
  field[:type]
end