Module: Fog::AWS::Storage::Utils
Instance Attribute Summary collapse
-
#region ⇒ Object
Returns the value of attribute region.
Instance Method Summary collapse
- #cdn ⇒ Object
- #http_url(params, expires) ⇒ Object
- #https_url(params, expires) ⇒ Object
- #request_url(params) ⇒ Object
- #require_mime_types ⇒ Object
- #signed_url(params, expires) ⇒ Object
- #url(params, expires) ⇒ Object
Instance Attribute Details
#region ⇒ Object
Returns the value of attribute region.
115 116 117 |
# File 'lib/fog/aws/storage.rb', line 115 def region @region end |
Instance Method Details
#cdn ⇒ Object
117 118 119 120 121 122 123 |
# File 'lib/fog/aws/storage.rb', line 117 def cdn @cdn ||= Fog::AWS::CDN.new( :aws_access_key_id => @aws_access_key_id, :aws_secret_access_key => @aws_secret_access_key, :use_iam_profile => @use_iam_profile ) end |
#http_url(params, expires) ⇒ Object
125 126 127 |
# File 'lib/fog/aws/storage.rb', line 125 def http_url(params, expires) signed_url(params.merge(:scheme => 'http'), expires) end |
#https_url(params, expires) ⇒ Object
129 130 131 |
# File 'lib/fog/aws/storage.rb', line 129 def https_url(params, expires) signed_url(params.merge(:scheme => 'https'), expires) end |
#request_url(params) ⇒ Object
152 153 154 155 |
# File 'lib/fog/aws/storage.rb', line 152 def request_url(params) params = request_params(params) params_to_url(params) end |
#require_mime_types ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/fog/aws/storage.rb', line 138 def require_mime_types begin # Use mime/types/columnar if available, for reduced memory usage require 'mime/types/columnar' rescue LoadError begin require 'mime/types' rescue LoadError Fog::Logger.warning("'mime-types' missing, please install and try again.") exit(1) end end end |
#signed_url(params, expires) ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/fog/aws/storage.rb', line 157 def signed_url(params, expires) refresh_credentials_if_expired #convert expires from a point in time to a delta to now expires = expires.to_i if @signature_version == 4 params = v4_signed_params_for_url(params, expires) else params = v2_signed_params_for_url(params, expires) end params_to_url(params) end |
#url(params, expires) ⇒ Object
133 134 135 136 |
# File 'lib/fog/aws/storage.rb', line 133 def url(params, expires) Fog::Logger.deprecation("Fog::AWS::Storage => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]") https_url(params, expires) end |