Class: SimpleEndpoint::Endpoint
- Inherits:
-
Object
- Object
- SimpleEndpoint::Endpoint
- Extended by:
- Forwardable
- Defined in:
- lib/simple_endpoint/endpoint.rb,
lib/simple_endpoint/endpoint/endpoint_options.rb
Defined Under Namespace
Classes: EndpointOptions
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #matched_case ⇒ Object
- #procees_handler(handler, strict: false) ⇒ Object
Constructor Details
#initialize(options) ⇒ Endpoint
Returns a new instance of Endpoint.
15 16 17 |
# File 'lib/simple_endpoint/endpoint.rb', line 15 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/simple_endpoint/endpoint.rb', line 7 def @options end |
Class Method Details
.call(options) ⇒ Object
11 12 13 |
# File 'lib/simple_endpoint/endpoint.rb', line 11 def self.call() new().call end |
Instance Method Details
#call ⇒ Object
19 20 21 22 |
# File 'lib/simple_endpoint/endpoint.rb', line 19 def call procees_handler(before_response) procees_handler(handler, strict: true) end |
#matched_case ⇒ Object
24 25 26 27 |
# File 'lib/simple_endpoint/endpoint.rb', line 24 def matched_case @matched_case ||= cases.detect { |_kase, condition| invoker.instance_exec(result, &condition) }&.first @matched_case || raise(OperationIsNotHandled) end |
#procees_handler(handler, strict: false) ⇒ Object
29 30 31 32 |
# File 'lib/simple_endpoint/endpoint.rb', line 29 def procees_handler(handler, strict: false) return invoker.instance_exec(result, **, &handler[matched_case]) if handler.key?(matched_case) raise UnhandledResultError.new(matched_case, handler) if strict end |