Sha256: c7841d0f4f5f3484c3c792192d8b374fd0809160daf02e1f6bdcae01139764b3

Contents?: true

Size: 760 Bytes

Versions: 4

Compression:

Stored size: 760 Bytes

Contents

module Fog
  module Storage
    class HuaweiCloud
      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::HuaweiCloud.escape(container)}"
          u << "/#{Fog::HuaweiCloud.escape(object)}" unless object.nil?
          u
        end

        private

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

      class Real
        include PublicUrl
      end

      class Mock
        include PublicUrl
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/storage/huaweicloud/requests/public_url.rb
fog-huaweicloud-0.0.2 lib/fog/storage/huaweicloud/requests/public_url.rb
fog-huaweicloud-0.1.3 lib/fog/storage/huaweicloud/requests/public_url.rb
fog-huaweicloud-0.1.2 lib/fog/storage/huaweicloud/requests/public_url.rb