Module: Core::Endpoint::BasicHandler::Json

Included in:
Core::Endpoint::BasicHandler
Defined in:
app/api/core/endpoint/basic_handler.rb

Instance Method Summary collapse

Instance Method Details


16
17
18
# File 'app/api/core/endpoint/basic_handler.rb', line 16

def related
  []
end

#root_jsonObject


12
13
14
# File 'app/api/core/endpoint/basic_handler.rb', line 12

def root_json
  'unknown'
end

#tree_for(_object, _options) ⇒ Object


20
21
22
23
24
25
26
27
# File 'app/api/core/endpoint/basic_handler.rb', line 20

def tree_for(_object, _options)
  associations, actions = {}, {}
  related.each { |r| r.separate(associations, actions) }
  Core::Io::Json::Grammar::Root.new(
    root_json,
    associations.merge('actions' => Core::Io::Json::Grammar::Actions.new(self, actions))
  )
end