Module: Fog::Storage::AWS::Utils

Included in:
Mock, Real
Defined in:
lib/fog/storage/aws.rb

Instance Method Summary collapse

Instance Method Details

#cdnObject



56
57
58
59
60
61
# File 'lib/fog/storage/aws.rb', line 56

def cdn
  @cdn ||= Fog::AWS::CDN.new(
    :aws_access_key_id => @aws_access_key_id,
    :aws_secret_access_key => @aws_secret_access_key
  )
end

#url(params, expires) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fog/storage/aws.rb', line 63

def url(params, expires)
  params[:headers] ||= {}
  params[:headers]['Date'] = expires.to_i
  params[:path] = Fog::AWS.escape(params[:path]).gsub('%2F', '/')
  query = []
  if params[:query]
    for key, value in params[:query]
      query << "#{key}=#{Fog::AWS.escape(value)}"
    end
  end
  query << "AWSAccessKeyId=#{@aws_access_key_id}"
  query << "Signature=#{Fog::AWS.escape(signature(params))}"
  query << "Expires=#{params[:headers]['Date']}"
  "https://#{@host}/#{params[:path]}?#{query.join('&')}"
end