Sha256: 6716d9d3c57c341020ff53af7c2cfe9804e61c60596c03764b3dcffa4b08854c

Contents?: true

Size: 551 Bytes

Versions: 3

Compression:

Stored size: 551 Bytes

Contents

module Hexlet
  class BaseClient
    def initialize(key, options={})
      @key = key
      @host = options[:host] || "http://hexlet.io"
      @logger = options[:logger]
      @router = Router.new @host
    end

    def login
      url = @router.api_member_user_check_url
      @logger.debug url

      RestClient.get url, headers do |response, request, result, &block|
      @logger.debug response
      200 == response.code
      end
    end

    private

    def headers(other = {})
      {"X-Hexlet-Api-Key" => @key}.merge other
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hexlet-0.1.1 lib/hexlet/base_client.rb
hexlet-0.1.0 lib/hexlet/base_client.rb
hexlet-0.0.1 lib/hexlet/base_client.rb