Module: Core::Endpoint::BasicHandler::Actions::InnerAction

Included in:
Bound::Handler
Defined in:
app/api/core/endpoint/basic_handler/actions/inner_action.rb

Instance Method Summary collapse

Instance Method Details

#for_jsonObject


18
19
20
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 18

def for_json
  nil
end

#generate_json_actions(object, options) ⇒ Object


29
30
31
32
33
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 29

def generate_json_actions(object, options)
  rooted_json(options) do |stream|
    super(object, options.merge(stream: stream))
  end
end

#initialize(name, options, &block) ⇒ Object

Raises:

  • (StandardError)

2
3
4
5
6
7
8
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 2

def initialize(name, options, &block)
  raise StandardError, "Cannot declare inner action #{name.inspect} without a block" unless block_given?

  super() {}
  @options, @handler = options, block
  action(name, options)
end

#separate(_, actions) ⇒ Object


10
11
12
13
14
15
16
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 10

def separate(_, actions)
  actions[@options[:to].to_s] = lambda do |object, options, stream|
    actions(object, options.merge(target: object)).map do |action, url|
      stream.attribute(action, url)
    end
  end
end