Sha256: 48682ebe3ffba40570e5f701132091ca93c8394f88247b1684ca6863122cf5da

Contents?: true

Size: 555 Bytes

Versions: 8

Compression:

Stored size: 555 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

8 entries across 8 versions & 1 rubygems

Version Path
hexlet-0.3.4 lib/hexlet/base_client.rb
hexlet-0.3.3 lib/hexlet/base_client.rb
hexlet-0.3.2 lib/hexlet/base_client.rb
hexlet-0.3.1 lib/hexlet/base_client.rb
hexlet-0.3.0 lib/hexlet/base_client.rb
hexlet-0.2.2 lib/hexlet/base_client.rb
hexlet-0.2.1 lib/hexlet/base_client.rb
hexlet-0.2.0 lib/hexlet/base_client.rb