Method: Toptranslation::Resource::Document#download

Defined in:
lib/toptranslation/resource/document.rb

#download(locale_code, options = {}, &block) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/toptranslation/resource/document.rb', line 27

def download(locale_code, options = {}, &block)
  download_path = if options[:path]
                    options[:path]
                  else
                    tempfile = Tempfile.new
                    temp_path = tempfile.path
                    tempfile.close
                    temp_path
                  end
  @connection.download(download_url(locale_code, options), download_path, &block)
end