lib/apia/endpoint.rb
# Run this request by providing a request to execute it with.
#
# @param request [Apia::Request]
# @return [Apia::Response]
Run this request by providing a request to execute it with.
Run this request by providing a request to execute it with .
def execute(request)
        response = Response.new(request, self)
        environment = RequestEnvironment.new(request, response)
        catch_errors(response) do
          request.authenticator = definition.authenticator || request.controller&.definition&.authenticator || request.api&.definition&.authenticator
          request.authenticator&.execute(environment)
          if request.authenticator && !request.authenticator.authorized_scope?(environment, definition.scopes)
            environment.raise_error Apia::ScopeNotGrantedError, scopes: definition.scopes
          end
          request.arguments = definition.argument_set.create_from_request(request)
          endpoint_instance = new(environment)
          endpoint_instance.call_with_error_handling
          response.hash
        end
        response
      end
def execute ( request ) response = Response . new ( request , self ) environment = RequestEnvironment . new ( request , response ) catch_errors ( response ) do request . authenticator = definition . authenticator || request . controller &. definition &. authenticator || request . api &. definition &. authenticator request . authenticator &. execute ( environment ) if request . authenticator && ! request . authenticator . authorized_scope? ( environment , definition . scopes ) environment . raise_error Apia :: ScopeNotGrantedError , scopes : definition . scopes end request . arguments = definition . argument_set . create_from_request ( request ) endpoint_instance = new ( environment ) endpoint_instance . call_with_error_handling response . hash end response end
Run this request by providing a request to execute it with.
Run this request by providing a request to execute it with .
# Determine an authenticator and execute it before the request happens # Determine if we're permitted to run the action based on the endpoint's scopes # Process arguments into the request. This happens after the authentication # stage because a) authenticators shouldn't be using endpoint specific args # and b) the argument conditions may need to know the identity. # Call the action for the endpoint # We're going to call this here because we want to cache the actual values of # the output within the catch_errors block.
None
Apia::Response
request
<not_specific>
<not_specific>
None