Sha256: 014e8c05321cbacd9b7e11a3075d6dff9ee904ee37545037688ee81a3183aea9

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

require "hugs"
require "digest/sha1"

module Occi
  class Client
    ##
    # Include endpoints.

    %w(pool entity).each do |mixin|
      require "occi/#{mixin}"
      include eval "Occi::#{mixin.capitalize}"
    end

    ##
    # Required:
    # +user+: A String containing the username for use in HTTP Basic auth.
    # +password+: A String containing the password for use in HTTP Basic auth.
    # +host+: A String with the host to connect.

    def initialize options
      @connection = Hugs::Client.new(
        :user     => options[:user],
        :password => Digest::SHA1.hexdigest(options[:password]),
        :host     => options[:host],
        :scheme   => options[:scheme] || "http",
        :port     => options[:port] || 4567,
        :type     => options[:type] || :xml,
      )
    end

    def request
      @connection
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
occi-1.1.0 lib/occi/client.rb