Sha256: 6f6fe05aed1f29816876c6e274ebd43e91c5fa340aa5d04e1cae5a2e0c26522b

Contents?: true

Size: 504 Bytes

Versions: 1

Compression:

Stored size: 504 Bytes

Contents

module Urkel
  class Configuration
    attr_accessor :api_host, :api_key

    def initialize(api_host = '', api_key = '')
      @api_host = api_host
      @api_key = api_key
    end

    def request(request)
      request['authorization'] = "Token token=#{api_key}"
      http_connection.request(request)
    end

    private

    def http_connection
      uri = URI.parse(api_host)
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = (uri.scheme == "https")
      http
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
urkel-0.0.2 lib/urkel/configuration.rb