Sha256: 1304dcd1e923ff4be38db0812ee940c4c16c68a345d2975c0f5308b414df04c1

Contents?: true

Size: 1.67 KB

Versions: 73

Compression:

Stored size: 1.67 KB

Contents

require 'fog/ibm'
require 'fog/storage'

module Fog
  module Storage
    class IBM < Fog::Service

      requires :ibm_username, :ibm_password
      recognizes :location

      model_path 'fog/ibm/models/storage'

      model :offering
      collection :offerings
      model :volume
      collection :volumes

      request_path 'fog/ibm/requests/storage'

      request :list_offerings

      request :list_volumes
      request :create_volume
      request :delete_volume
      request :get_volume

      class Real
        def initialize(options={})
          @connection = Fog::IBM::Connection.new(options[:ibm_username], options[:ibm_password])
        end

        private

        def request(options)
          begin
            @connection.request(options)
          rescue Excon::Errors::HTTPStatusError => error
            raise case error
            when Excon::Errors::NotFound
              Fog::Storage::IBM::NotFound.slurp(error)
            else
              error
            end
          end
        end

      end

      class Mock

        def self.data
          @data ||= Hash.new do |hash, key|
            hash[key] = {
              :volumes      => {},
            }
          end
        end

        def self.reset
          @data = nil
        end

        def data
          self.class.data[@ibm_username]
        end

        def reset_data
          self.class.data.delete(@ibm_username)
          @data = self.class.data[@ibm_username]
        end

        def initialize(options={})
          @ibm_username = options[:ibm_username]
          @ibm_password = options[:ibm_password]
          @data = self.class.data[@ibm_username]
        end

      end

    end
  end
end

Version data entries

73 entries across 73 versions & 11 rubygems

Version Path
fog-1.14.0 lib/fog/ibm/storage.rb
fog-1.13.0 lib/fog/ibm/storage.rb
gapinc-fog-1.12.1.2 lib/fog/ibm/storage.rb
gapinc-fog-1.12.1.1 lib/fog/ibm/storage.rb
gapinc-fog-1.12.1a lib/fog/ibm/storage.rb
gapinc-fog-1.12.1 lib/fog/ibm/storage.rb
fog-1.12.1 lib/fog/ibm/storage.rb
fog-1.12.0 lib/fog/ibm/storage.rb
hpfog-0.0.20 lib/fog/ibm/storage.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/ibm/storage.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/ibm/storage.rb
fog-nirvanix-1.8.2 lib/fog/ibm/storage.rb
fog-1.11.1 lib/fog/ibm/storage.rb
fog-1.11.0 lib/fog/ibm/storage.rb
fog-nirvanix-1.8.1 lib/fog/ibm/storage.rb
fog-1.10.1 lib/fog/ibm/storage.rb
fog-parser-fix-1.6.1 lib/fog/ibm/storage.rb
fog-test-again-1.6.0 lib/fog/ibm/storage.rb
fog-test-me-1.10.0 lib/fog/ibm/storage.rb
fog-parser-fix-1.6.0 lib/fog/ibm/storage.rb