Module: Roar::JSON::JSONAPI

Defined in:
lib/roar/json/json_api.rb

Defined Under Namespace

Modules: Document, ForCollection, LinkCollectionRepresenter, LinkRepresenter, Resource, Singular

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/roar/json/json_api.rb', line 7

def self.included(base)
  base.class_eval do
    include Representable::JSON
    include Roar::JSON::JSONAPI::Singular
    include Roar::JSON::JSONAPI::Resource
    include Roar::JSON::JSONAPI::Document

    extend ForCollection

    representable_attrs[:resource_representer] = Class.new(Resource::Representer)

    private
      def create_representation_with(doc, options, format)
        super(doc, options.merge(:only_body => true), format)
      end
  end
end