Class: Paperclip::Storage::Dropbox::PublicUrlGenerator

Inherits:
UrlGenerator
  • Object
show all
Defined in:
lib/paperclip/storage/dropbox/public_url_generator.rb

Instance Method Summary collapse

Methods inherited from UrlGenerator

#generate, #initialize

Constructor Details

This class inherits a constructor from Paperclip::Storage::Dropbox::UrlGenerator

Instance Method Details

#file_url(style) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/paperclip/storage/dropbox/public_url_generator.rb', line 6

def file_url(style)
  url = URI.parse("https://dl.dropboxusercontent.com/u/#{user_id}/")
  path = @attachment.path(style)
  path = path.match(/^Public\//).try(:post_match)
  url.merge!(URI.encode(path))
  url.to_s
end