lib/d2d/client/session.rb
# makes the request to the Relais endpoint and retrieves the response
# if the endpoint responds with a non-200 status code, raises
# an exception.
# @param [Request] request to be executed.
makes the request to the Relais endpoint and retrieves the response
if the endpoint responds with a non-200 status code, raises
an exception.
makes the request to the Relais endpoint and retrieves the response if the endpoint responds with a non - 200 status code raises an exception .
def make_request(request)
        body = request.body
        resp = if body.empty?
                 client.get do |req|
                   req.url request.path
                   req.headers['Content-Type'] = 'application/json'
                 end
               else
                 client.post do |req|
                   req.url request.path
                   req.headers['Content-Type'] = 'application/json'
                   req.body = body.respond_to?(:each) ? body.to_json : body
                 end
               end
        @logger.debug(resp.body)
        request.response.new(JSON.parse(resp.body))
      end
def make_request ( request ) body = request . body resp = if body . empty? client . get do | req | req . url request . path req . headers [ 'Content-Type' ] = 'application/json' end else client . post do | req | req . url request . path req . headers [ 'Content-Type' ] = 'application/json' req . body = body . respond_to? ( :each ) ? body . to_json : body end end @logger . debug ( resp . body ) request . response . new ( JSON . parse ( resp . body ) ) end
makes the request to the Relais endpoint and retrieves the response
if the endpoint responds with a non-200 status code, raises
an exception.
makes the request to the Relais endpoint and retrieves the response if the endpoint responds with a non - 200 status code raises an exception .
request
request to be executed.
request to be executed .