Sha256: a4ad7b4eff19f19919daf06e1debb449bace2e28ac58b6964cbd685c9bc480d4
Contents?: true
Size: 746 Bytes
Versions: 14
Compression:
Stored size: 746 Bytes
Contents
require "shamu/json_api/base_builder" module Shamu module JsonApi # Build a relationship from one resource to another. class RelationshipBuilder < BaseBuilder # (see Context#include_resource) def include_resource( resource, presenter = nil, &block ) context.include_resource resource, presenter, &block end include BuilderMethods::Identifier # Write a resource linkage info. # # @param [String] type of the resource. # @param [Object] id of the resource. # @return [void] def identifier( type, id = nil ) output[:data] ||= {} output[:data][:type] = @type = type.to_s output[:data][:id] = id.to_s self end end end end
Version data entries
14 entries across 14 versions & 1 rubygems