Class: JSONAPI::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi/renderer.rb,
lib/jsonapi/renderer/document.rb,
lib/jsonapi/renderer/resources_processor.rb,
lib/jsonapi/renderer/cached_resources_processor.rb,
lib/jsonapi/renderer/simple_resources_processor.rb

Defined Under Namespace

Classes: CachedResourcesProcessor, Document, ResourcesProcessor, SimpleResourcesProcessor

Instance Method Summary collapse

Instance Method Details

#render(params) ⇒ Object

Render a JSON API document.

Parameters:

  • params (Hash)

    @option data [(#jsonapi_id, #jsonapi_type, #jsonapi_related, #as_jsonapi),

    Array<(#jsonapi_id, #jsonapi_type, #jsonapi_related,
    #as_jsonapi)>,
    nil] Primary resource(s) to be rendered.
    

    @option errors [Array<#jsonapi_id>] Errors to be rendered. @option include Relationships to be included. See

    JSONAPI::IncludeDirective.
    

    @option fields [HashArray<Symbol>, HashArray<String>]

    List of requested fields for some or all of the resource types.
    

    @option meta [Hash] Non-standard top-level meta information to be

    included.
    

    @option links [Hash] Top-level links to be included. @option jsonapi_object [Hash] JSON API object.



21
22
23
# File 'lib/jsonapi/renderer.rb', line 21

def render(params)
  Document.new(params).to_hash
end