Class: Roar::JSON::JSONAPI::Resource

Inherits:
Module
  • Object
show all
Defined in:
lib/roar/json/json_api.rb

Overview

Include to define a JSON API Resource and make API methods available to your Roar::Decorator.

Instance Method Summary collapse

Constructor Details

#initialize(type, options = {}) ⇒ Resource

Returns a new instance of Resource.

Parameters:

  • type (Symbol, String)

    type name of this resource.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :id_key (Symbol)

    custom ID key for this resource.



27
28
29
30
# File 'lib/roar/json/json_api.rb', line 27

def initialize(type, options = {})
  @type   = type
  @id_key = options.fetch(:id_key, :id)
end