Sha256: 1547cea8d8949361e86d779aed6fa2648b683b4da96588078877766db62ed779

Contents?: true

Size: 708 Bytes

Versions: 8

Compression:

Stored size: 708 Bytes

Contents

# Copyright (c) 2009-2012 VMware, Inc.

module Bosh
  module Blobstore
    class Client
      PROVIDER_NAMES = %w[dav simple s3 swift atmos local]

      def self.create(blobstore_provider, options = {})
        unless PROVIDER_NAMES.include? blobstore_provider
          raise BlobstoreError, "Invalid client provider, available providers are: #{PROVIDER_NAMES}"
        end

        blobstore_client_constantize(blobstore_provider).new(options)
      end

      private

      def self.blobstore_client_constantize(base_string)
        class_string = base_string.capitalize + (base_string == 'local' ? '' : 'Blobstore') + 'Client'
        Bosh::Blobstore.const_get class_string
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
blobstore_client-1.5.0.pre.1141 lib/blobstore_client/client.rb
blobstore_client-1.5.0.pre.1139 lib/blobstore_client/client.rb
blobstore_client-1.5.0.pre.1138 lib/blobstore_client/client.rb
blobstore_client-1.5.0.pre.1134 lib/blobstore_client/client.rb
blobstore_client-1.5.0.pre.1117 lib/blobstore_client/client.rb
blobstore_client-1.5.0.pre.1116 lib/blobstore_client/client.rb
blobstore_client-1.5.0.pre.1114 lib/blobstore_client/client.rb
blobstore_client-1.5.0.pre.1113 lib/blobstore_client/client.rb