Module: SimpleEndpoint::Controller

Defined in:
lib/simple_endpoint/controller.rb,
lib/simple_endpoint/controller/builder.rb,
lib/simple_endpoint/controller/class_methods.rb

Defined Under Namespace

Modules: ClassMethods Classes: Builder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#__before_responseObject

Returns the value of attribute __before_response.



5
6
7
# File 'lib/simple_endpoint/controller.rb', line 5

def __before_response
  @__before_response
end

#__different_casesObject

Returns the value of attribute __different_cases.



5
6
7
# File 'lib/simple_endpoint/controller.rb', line 5

def __different_cases
  @__different_cases
end

#__different_handlerObject

Returns the value of attribute __different_handler.



5
6
7
# File 'lib/simple_endpoint/controller.rb', line 5

def __different_handler
  @__different_handler
end

Class Method Details

.included(object) ⇒ Object



7
8
9
10
# File 'lib/simple_endpoint/controller.rb', line 7

def self.included(object)
  super
  object.extend(ClassMethods)
end

Instance Method Details

#endpoint(operation:, options: {}, **kwargs) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/simple_endpoint/controller.rb', line 12

def endpoint(operation:, options: {}, **kwargs)
  result = operation.call(**endpoint_options, **options)
  options = Endpoint::EndpointOptions.new(
    result: result, default_handler: default_handler, default_cases: default_cases, invoker: self, **kwargs
  )
  Endpoint.call(options)
end