Sha256: d55327daa4f87810baffd1d0da82194d1e86773965b79b226dc73cc333b3b7de

Contents?: true

Size: 843 Bytes

Versions: 13

Compression:

Stored size: 843 Bytes

Contents

module Fog
  module Storage
    class OpenStack
      module PublicUrl
        # Get public_url for an object
        #
        # ==== Parameters
        # * container<~String> - Name of container to look in
        # * object<~String> - Name of object to look for
        #
        def public_url(container = nil, object = nil)
          return nil if container.nil?
          u = "#{url}/#{Fog::OpenStack.escape(container)}"
          u << "/#{Fog::OpenStack.escape(object)}" unless object.nil?
          u
        end

        private

        def url
          "#{@openstack_management_uri.scheme}://#{@openstack_management_uri.host}:"\
          "#{@openstack_management_uri.port}#{@path}"
        end
      end

      class Real
        include PublicUrl
      end

      class Mock
        include PublicUrl
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fog-openstack-0.3.10 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.9 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.8 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.7 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.6 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.5 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.4 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.3 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.2 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.3.0 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.2.4 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.2.3 lib/fog/storage/openstack/requests/public_url.rb
fog-openstack-0.2.2 lib/fog/storage/openstack/requests/public_url.rb