Sha256: a9bfd3e4be7140f8a60af8d75b5bbb465444ff780ae06848b6a9eb1d992d51ec
Contents?: true
Size: 772 Bytes
Versions: 5
Compression:
Stored size: 772 Bytes
Contents
# Encoding: utf-8 module ChemistryKit module Config class BasicAuth attr_accessor :username, :password, :base_url, :http_path, :https_path def initialize(opts) opts.each do |key, value| begin send("#{key}=", value) rescue NoMethodError raise ArgumentError.new "The config key: \"#{key}\" is unknown!" end end end def http? !!http_path end def https? !!https_path end def http_url base_url.gsub(%r{http://}, "http:\/\/#{username}:#{password}@") + (http_path || '') end def https_url base_url.gsub(%r{http://}, "https:\/\/#{username}:#{password}@") + (https_path || '') end end end end
Version data entries
5 entries across 5 versions & 1 rubygems