Class: SimpleJsonapi::Node::Resource::Linkage
- Defined in:
- lib/simple_jsonapi/node/resource/linkage.rb
Overview
Represents a single resource linkage object.
Instance Attribute Summary collapse
- #meta ⇒ Hash{Symbol => Object} readonly
Attributes inherited from Base
Attributes inherited from Base
#extras, #fields_spec, #include_spec, #root_node, #serializer, #serializer_inferrer, #sort_spec
Instance Method Summary collapse
- #as_jsonapi ⇒ Hash{Symbol => Hash}
-
#initialize(meta: nil, **options) ⇒ Linkage
constructor
A new instance of Linkage.
Methods inherited from Base
Constructor Details
#initialize(meta: nil, **options) ⇒ Linkage
Returns a new instance of Linkage.
11 12 13 14 |
# File 'lib/simple_jsonapi/node/resource/linkage.rb', line 11 def initialize(meta: nil, **) super() = end |
Instance Attribute Details
#meta ⇒ Hash{Symbol => Object} (readonly)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/simple_jsonapi/node/resource/linkage.rb', line 6 class Linkage < Base attr_reader :meta # @param meta [Hash{Symbol => Object}] # @param options see {Node::Resource::Base#initialize} for additional parameters def initialize(meta: nil, **) super() = end # @return [Hash{Symbol => Hash}] def as_jsonapi json = {} json[:id] = resource_id json[:type] = resource_type json[:meta] = if .present? json end end |
Instance Method Details
#as_jsonapi ⇒ Hash{Symbol => Hash}
17 18 19 20 21 22 23 |
# File 'lib/simple_jsonapi/node/resource/linkage.rb', line 17 def as_jsonapi json = {} json[:id] = resource_id json[:type] = resource_type json[:meta] = if .present? json end |