app/utils/service_client/client.rb
def execute(method:, endpoint:, params:, body:, opts:)
      ctx = @_context_runner.execute(
        req: {
          path: nil,
          method: method,
          params: params,
          body: body,
          headers: {}
        },
        endpoint: endpoint,
        opts: opts
      )

      if ctx[:error] && @_raise_errors
        raise ctx[:error]
      end

      ctx
    end
##
# Create a new ServiceClient instance
#
# ## Params:
#
# - `host`: The host (e.g. "http://myservice.example.com")
# - `endpoint_map`: Maps endpoint names to endpoint URLs
# - `middleware`: Array of middleware
# - `opts`: Extra options
#
# ## Usage:
#
# ```
# car_service = ServiceClient::Client.new("http://carservice.example.com",
#                                         {
#                                           list: "/list_cars",
#                                           sell: "/sell_car"
#                                         },
#                                         [
#                                           ServiceClient::Middleware::RequestID.new,
#                                           ServiceClient::Middleware::Timeout.new,
#                                           ServiceClient::Middleware::Logger.new,
#                                           ServiceClient::Middleware::Timing.new,
#                                           ServiceClient::Middleware::BodyEncoder.new(:transit_msgpack)
#                                         ]
# ```
#
# The example above will create a new client that post request to
# car service URL. It has two known endpoints :buy and :sell, and it uses 5 middleware.
#
# ## Default middleware:
#
# In addition to the user-specified middleware, the Client will
# have 3 predefined middleware. Those are:
#
# * ResultMapper: Maps the HTTP result to Result object
# * EndpointMapper: Maps the endpoint name to endpoint URL
# * HTTPClient: Does the actual HTTP request
#
Create a new ServiceClient instance
Params.







The example above will create a new client that post request to
car service URL. It has two known endpoints :buy and :sell, and it uses 5 middleware.

Default middleware.

In addition to the user-specified middleware, the Client will
have 3 predefined middleware. Those are.

Maps the HTTP result to Result object
EndpointMapper: Maps the endpoint name to endpoint URL
HTTPClient: Does the actual HTTP request
Create a new ServiceClient instance Params . The example above will create a new client that post request to car service URL . It has two known endpoints : buy and : sell and it uses 5 middleware . Default middleware . In addition to the user - specified middleware the Client will have 3 predefined middleware . Those are . Maps the HTTP result to Result object EndpointMapper : Maps the endpoint name to endpoint URL HTTPClient : Does the actual HTTP request
def execute(method:, endpoint:, params:, body:, opts:)
      ctx = @_context_runner.execute(
        req: {
          path: nil,
          method: method,
          params: params,
          body: body,
          headers: {}
        },
        endpoint: endpoint,
        opts: opts
      )
      if ctx[:error] && @_raise_errors
        raise ctx[:error]
      end
      ctx
    end
def execute ( method : , endpoint : , params : , body : , opts : ) ctx = @_context_runner . execute ( req : { path : nil , method : method , params : params , body : body , headers : { } } , endpoint : endpoint , opts : opts ) if ctx [ :error ] && @_raise_errors raise ctx [ :error ] end ctx end
Create a new ServiceClient instance
 Params:
Create a new ServiceClient instance Params :
method
endpoint
params
body
opts