Class/Module Index [+]

Quicksearch

Fog::CDN::Rackspace::Base

Constants

URI_HEADERS

Public Instance Methods

apply_options(options) click to toggle source
# File lib/fog/rackspace/cdn.rb, line 24
def apply_options(options)
  # api_key and username missing from instance variable sets
  @rackspace_api_key = options[:rackspace_api_key]
  @rackspace_username = options[:rackspace_username]

  @connection_options = options[:connection_options] || {}
  @rackspace_auth_url = options[:rackspace_auth_url]
  @rackspace_cdn_url = options[:rackspace_cdn_url]
  @rackspace_region = options[:rackspace_region] || :dfw
end
enabled?() click to toggle source

Returns true if CDN service is enabled @return [Boolean]

# File lib/fog/rackspace/cdn.rb, line 49
def enabled?
  @enabled
end
endpoint_uri(service_endpoint_url=nil) click to toggle source
# File lib/fog/rackspace/cdn.rb, line 53
def endpoint_uri(service_endpoint_url=nil)
  @uri = super(@rackspace_cdn_url || service_endpoint_url, :rackspace_cdn_url)
end
publish_container(container, publish = true) click to toggle source

Publish container to CDN @param [Fog::Storage::Rackspace::Directory] container directory to publish @param [Boolean] publish If true directory is published. If false directory is unpublished. @return [Hash] hash containing urls for published container @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404 @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400 @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500 @raise [Fog::Storage::Rackspace::ServiceError]

# File lib/fog/rackspace/cdn.rb, line 65
def publish_container(container, publish = true)
  enabled = publish ? 'True' : 'False'
  response = put_container(container.key, 'X-Cdn-Enabled' => enabled)
  return {} unless publish
  urls_from_headers(response.headers)
end
region() click to toggle source
# File lib/fog/rackspace/cdn.rb, line 39
def region
  @rackspace_region
end
request_id_header() click to toggle source
# File lib/fog/rackspace/cdn.rb, line 43
def request_id_header
  "X-Trans-Id"
end
service_name() click to toggle source
# File lib/fog/rackspace/cdn.rb, line 35
def service_name
  :cloudFilesCDN
end
urls(container) click to toggle source

Returns hash of urls for container @param [Fog::Storage::Rackspace::Directory] container to retrieve urls for @return [Hash] hash containing urls for published container @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400 @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500 @raise [Fog::Storage::Rackspace::ServiceError] @note If unable to find container or container is not published this method will return an empty hash.

# File lib/fog/rackspace/cdn.rb, line 79
def urls(container)
  begin
    response = head_container(container.key)
    return {} unless response.headers['X-Cdn-Enabled'] == 'True'
    urls_from_headers response.headers
  rescue Fog::Service::NotFound
    {}
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.