Class: ForestLiana::ResourceGetter

Inherits:
BaseGetter show all
Defined in:
app/services/forest_liana/resource_getter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseGetter

#get_collection, #get_resource, #includes_for_serialization

Constructor Details

#initialize(resource, params) ⇒ ResourceGetter

Returns a new instance of ResourceGetter.



5
6
7
8
9
10
11
# File 'app/services/forest_liana/resource_getter.rb', line 5

def initialize(resource, params)
  @resource = resource
  @params = params
  @collection_name = ForestLiana.name_for(@resource)
  @collection = get_collection(@collection_name)
  compute_includes()
end

Instance Attribute Details

#recordObject

Returns the value of attribute record.



3
4
5
# File 'app/services/forest_liana/resource_getter.rb', line 3

def record
  @record
end

Instance Method Details

#performObject



13
14
15
# File 'app/services/forest_liana/resource_getter.rb', line 13

def perform
  @record = get_resource().eager_load(@includes).find(@params[:id])
end