class SimpleJsonapi::Node::Resource::Base
Represents a single resource object or resource linkage object.
Attributes
resource[R]
Public Class Methods
new(resource:, **options)
click to toggle source
Calls superclass method
SimpleJsonapi::Node::Base::new
# File lib/simple_jsonapi/node/resource/base.rb, line 6 def initialize(resource:, **options) super(options) @resource = resource @serializer = serializer_inferrer.infer(resource).new end
Public Instance Methods
resource_id()
click to toggle source
# File lib/simple_jsonapi/node/resource/base.rb, line 13 def resource_id @resource_id ||= evaluate(serializer.id_definition, resource).to_s end
resource_type()
click to toggle source
# File lib/simple_jsonapi/node/resource/base.rb, line 17 def resource_type @resource_type ||= evaluate(serializer.type_definition, resource).to_s end