Sha256: 7f7e032441e835f2d86b4a8fd346022ffc9bc97a3dd53fdaf8fc3c88ed9aedf9

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

require 'cassette-rack'
require 'smartdc/auth'
require 'smartdc/api/datacenters'
require 'smartdc/api/images'
require 'smartdc/api/packages'
require 'smartdc/api/keys'
require 'smartdc/api/machines'
require 'smartdc/api/machines/tags'
require 'smartdc/api/machines/metadata'
require 'smartdc/api/machines/snapshots'
require 'smartdc/api/analytics'
require 'smartdc/api/analytics/heatmap'

module Smartdc
  class Client
    include CassetteRack::Request
    include Smartdc::Api::Datacenters
    include Smartdc::Api::Images
    include Smartdc::Api::Packages
    include Smartdc::Api::Keys
    include Smartdc::Api::Machines
    include Smartdc::Api::Machines::Tags
    include Smartdc::Api::Machines::Metadata
    include Smartdc::Api::Machines::Snapshots
    include Smartdc::Api::Analytics
    include Smartdc::Api::Analytics::Heatmap

    def initialize(options={})
      options = Smartdc.config.options.merge(options)
      auth = Smartdc::Auth.new(options)
      date = Time.now.gmtime.to_s

      @request_options = {
        builder: options[:middleware],
        url: options[:url],
        ssl: { verify: options[:ssl_verify] },
        headers: {
          date: date, authorization: auth.signature(date),
          'content-type' => 'application/json', accept: 'application/json',
          'x-api-version' => options[:version]
        }
      }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smartdc-2.0.2 lib/smartdc/client.rb
smartdc-2.0.1 lib/smartdc/client.rb
smartdc-2.0.0 lib/smartdc/client.rb