Module: Trailblazer::Endpoint::Controller::InstanceMethods::API

Defined in:
lib/trailblazer/endpoint/controller.rb

Instance Method Summary collapse

Instance Method Details

#endpoint(name, config_source: self.class, **action_options) ⇒ Object



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/trailblazer/endpoint/controller.rb', line 165

def endpoint(name, config_source: self.class, **action_options)
  endpoint = endpoint_for(name, config_source: config_source)

  action_options = {controller: self}.merge(action_options) # FIXME: redundant with {InstanceMethods#endpoint}

  block_options = config_source.options_for(:options_for_block_options, **action_options)
  block_options = Trailblazer::Endpoint::Options.merge_with(action_options, block_options)

  signal, (ctx, _) = Trailblazer::Endpoint::Controller.advance_endpoint_for_controller(
    endpoint:       endpoint,
    block_options:  block_options,
    config_source:  config_source,
    **action_options
  )

  ctx
end