class Paperclip::Storage::Dropbox::UrlGenerator
Public Class Methods
new(attachment, attachment_options)
click to toggle source
# File lib/paperclip/storage/dropbox/url_generator.rb, line 8 def initialize(attachment, attachment_options) @attachment = attachment @attachment_options = attachment_options end
Public Instance Methods
generate(style, options)
click to toggle source
# File lib/paperclip/storage/dropbox/url_generator.rb, line 13 def generate(style, options) if @attachment.present? url = file_url(style) url = URI.parse(url) url.query = [url.query, "dl=1"].compact.join("&") if options[:download] url.to_s else @attachment_options[:interpolator].interpolate(@attachment_options[:default_url], @attachment, style) end end
Private Instance Methods
user_id()
click to toggle source
# File lib/paperclip/storage/dropbox/url_generator.rb, line 26 def user_id @attachment.dropbox_credentials[:user_id] end