Sha256: 382527810446821f79112af4016155cd5407829ee5fdc02de87b04bb233e8754

Contents?: true

Size: 609 Bytes

Versions: 9

Compression:

Stored size: 609 Bytes

Contents

module Fogged
  def self.directory_public_url(directory_name)
    case Fogged.provider
    when :aws
      Fogged.storage.request_url(:bucket_name => directory_name)
    else
      fail(ArgumentError, "Provider #{Fogged.provider} is not available!")
    end
  end

  def self.resources_public_url
    directory_public_url(Fogged.resources.key)
  end

  def self.file_public_url(key, directory = Fogged.resources.key)
    Fogged.storage.try(
      :request_url,
      :bucket_name => directory,
      :object_name => key
    )
  end

  def self.file_exists?(key)
    Fogged.resources.files.head(key)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fogged-0.0.13 lib/fogged/utils.rb
fogged-0.0.12 lib/fogged/utils.rb
fogged-0.0.11 lib/fogged/utils.rb
fogged-0.0.10 lib/fogged/utils.rb
fogged-0.0.9 lib/fogged/utils.rb
fogged-0.0.8 lib/fogged/utils.rb
fogged-0.0.7 lib/fogged/utils.rb
fogged-0.0.6 lib/fogged/utils.rb
fogged-0.0.5 lib/fogged/utils.rb