class Shamu::JsonApi::RelationshipBuilder

Build a relationship from one resource to another.

Public Instance Methods

identifier( type, id = nil ) click to toggle source

Write a resource linkage info.

@param [String] type of the resource. @param [Object] id of the resource. @return [void]

# File lib/shamu/json_api/relationship_builder.rb, line 22
def identifier( type, id = nil )
  output[:data] ||= {}
  output[:data][:type] = @type = type.to_s
  output[:data][:id]   = id.to_s
  self
end
include_resource( resource, presenter = nil, &block ) click to toggle source

(see Context#include_resource)

# File lib/shamu/json_api/relationship_builder.rb, line 11
def include_resource( resource, presenter = nil, &block )
  context.include_resource resource, presenter, &block
end