Class: RspecApiDocs::Renderer::RaddocsRenderer::ResourceSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_api_docs/formatter/renderer/raddocs_renderer/resource_serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, example) ⇒ ResourceSerializer


7
8
9
10
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/resource_serializer.rb', line 7

def initialize(resource, example)
  @resource = resource
  @example = example
end

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example


5
6
7
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/resource_serializer.rb', line 5

def example
  @example
end

#resourceObject (readonly)

Returns the value of attribute resource


5
6
7
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/resource_serializer.rb', line 5

def resource
  @resource
end

Instance Method Details

#to_hObject

rubocop:disable Metrics/AbcSize


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rspec_api_docs/formatter/renderer/raddocs_renderer/resource_serializer.rb', line 12

def to_h # rubocop:disable Metrics/AbcSize
  {
    resource: resource.name,
    resource_explanation: nil,
    http_method: example.http_method,
    route: example.path,
    description: example.name,
    explanation: example.description,
    parameters: parameters(example.parameters),
    response_fields: response_fields(example.response_fields),
    requests: requests,
  }
end