Class: S3Relay::PrivateUrl
Instance Attribute Summary collapse
-
#expires ⇒ Object
readonly
Returns the value of attribute expires.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(uuid, file, options = {}) ⇒ PrivateUrl
constructor
A new instance of PrivateUrl.
Constructor Details
#initialize(uuid, file, options = {}) ⇒ PrivateUrl
Returns a new instance of PrivateUrl.
6 7 8 9 10 |
# File 'lib/s3_relay/private_url.rb', line 6 def initialize(uuid, file, ={}) filename = URI.encode(file).gsub("+", "%2B") @path = [uuid, filename].join("/") @expires = ([:expires] || 10.minutes.from_now).to_i end |
Instance Attribute Details
#expires ⇒ Object (readonly)
Returns the value of attribute expires.
4 5 6 |
# File 'lib/s3_relay/private_url.rb', line 4 def expires @expires end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/s3_relay/private_url.rb', line 4 def path @path end |
Instance Method Details
#generate ⇒ Object
12 13 14 |
# File 'lib/s3_relay/private_url.rb', line 12 def generate "#{endpoint}/#{path}?#{params}" end |