Class: S3Relay::PrivateUrl

Inherits:
Base
  • Object
show all
Defined in:
lib/s3_relay/private_url.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options={})
  filename = Addressable::URI.escape(file).gsub("+", "%2B")
  @path    = [uuid, filename].join("/")
  @expires = (options[:expires] || 10.minutes.from_now).to_i
end

Instance Attribute Details

#expiresObject (readonly)

Returns the value of attribute expires.



4
5
6
# File 'lib/s3_relay/private_url.rb', line 4

def expires
  @expires
end

#pathObject (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

#generateObject



12
13
14
# File 'lib/s3_relay/private_url.rb', line 12

def generate
  "#{endpoint}/#{path}?#{params}"
end