Class: JSONAPI::Realizer::Action::Show

Inherits:
JSONAPI::Realizer::Action show all
Defined in:
lib/jsonapi/realizer/action/show.rb

Instance Attribute Summary collapse

Attributes inherited from JSONAPI::Realizer::Action

#headers, #payload

Instance Method Summary collapse

Methods inherited from JSONAPI::Realizer::Action

#call, #fields, #includes

Constructor Details

#initialize(payload:, headers:, scope: nil, type:) ⇒ Show

Returns a new instance of Show.



7
8
9
10
11
12
13
# File 'lib/jsonapi/realizer/action/show.rb', line 7

def initialize(payload:, headers:, scope: nil, type:)
  @type = type

  super(payload: payload, headers: headers, scope: scope)

  @resource = resource_class.new(adapter.find_via_call(relation, id))
end

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



5
6
7
# File 'lib/jsonapi/realizer/action/show.rb', line 5

def resource
  @resource
end

Instance Method Details

#modelObject



15
16
17
# File 'lib/jsonapi/realizer/action/show.rb', line 15

def model
  resource.model
end