Sha256: 53c85a4d80c6a669f7eda8c51145b6b33d997577a17bcf3fbdd7989264a03b83

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'smartsheet/version'
require 'smartsheet/error'

module Smartsheet
  module API
    # Composes {EndpointSpec endpoint specifications} and {RequestSpec request specifications} to
    # form a single {Request} that it submits to the provided client
    class RequestClient
      def initialize(
          token,
          client,
          base_url,
          app_user_agent: nil,
          assume_user: nil,
          logger: MuteRequestLogger.new
      )
        @token = token
        @client = client
        @app_user_agent = app_user_agent
        @assume_user = assume_user
        @logger = logger
        @base_url = base_url
      end

      def make_request(endpoint_spec, request_spec)
        request = Request.new(
          token,
          endpoint_spec,
          request_spec,
          base_url,
          app_user_agent: app_user_agent,
          assume_user: assume_user
        )

        logger.log_request(request)
        client.make_request(request)
      end

      private

      attr_reader :token, :client, :app_user_agent, :assume_user, :logger, :base_url
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
smartsheet-2.101.1 lib/smartsheet/api/request_client.rb
smartsheet-2.101.0 lib/smartsheet/api/request_client.rb
smartsheet-2.86.1 lib/smartsheet/api/request_client.rb
smartsheet-2.86.0 lib/smartsheet/api/request_client.rb
smartsheet-2.77.2 lib/smartsheet/api/request_client.rb