Sha256: 7fb5e4ee10ba164643e3943d1670b3ebdba20a66b9c214116b4d01770478fb3f

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

# frozen_string_literal: true

module Pcli
  module Services
    class Client
      include Depends.on('config.endpoint')

      def send(request)
        r = HTTP.send(
          request.method,
          URI.join(endpoint, request.path),
          body: request.params.to_json,
          headers: request.headers
        )
        ApiResponse.new(
          r.code,
          r.status.success?,
          r.status.reason,
          r.to_s
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcli-0.1.1 lib/pcli/services/client.rb
pcli-0.1.0 lib/pcli/services/client.rb