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
- #for_json ⇒ Object
- #generate_json_actions(object, options) ⇒ Object
- #initialize(name, options, &block) ⇒ Object
- #separate(_, actions) ⇒ Object
Instance Method Details
#for_json ⇒ Object
19 20 21 |
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 19 def for_json nil end |
#generate_json_actions(object, options) ⇒ Object
30 31 32 |
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 30 def generate_json_actions(object, ) rooted_json() { |stream| super(object, .merge(stream:)) } end |
#initialize(name, options, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 3 def initialize(name, , &block) raise StandardError, "Cannot declare inner action #{name.inspect} without a block" unless block super() do # prettier-ignore end @options, @handler = , block action(name, ) end |
#separate(_, actions) ⇒ Object
13 14 15 16 17 |
# File 'app/api/core/endpoint/basic_handler/actions/inner_action.rb', line 13 def separate(_, actions) actions[@options[:to].to_s] = lambda do |object, , stream| actions(object, .merge(target: object)).map { |action, url| stream.attribute(action, url) } end end |