class ActiveModelSerializers::Adapter::JsonApi::Link
}.reject! {|_,v| v.nil? }
meta: meta,
href: ‘example.com/link-object’,
{
structure:
meta
href (required) : URI
properties:
JSON Object
definition:
linkObject
’example.com/link-string’
structure:
A string containing the link’s URL.
description:
URI
definition:
linkString
end
linkObject
else
linkString
if href?
structure:
object.“
A link MUST be represented as either: a string containing the link’s URL or a link
description:
linkObject
linkString
oneOf
definition:
link
def as_json
def as_json return @value if @value hash = {} hash[:href] = @href if defined?(@href) hash[:meta] = @meta if defined?(@meta) hash.any? ? hash : nil end
def href(value)
def href(value) @href = value nil end
def initialize(serializer, value)
def initialize(serializer, value) @_routes ||= nil # handles warning # actionpack-4.0.13/lib/action_dispatch/routing/route_set.rb:417: warning: instance variable @_routes not initialized @object = serializer.object @scope = serializer.scope # Use the return value of the block unless it is nil. if value.respond_to?(:call) @value = instance_eval(&value) else @value = value end end
def meta(value)
def meta(value) @meta = value nil end