Method: Arx::Paper#save

Defined in:
lib/arx/entities/paper.rb

#save(path) ⇒ Object

Downloads the paper and saves it in PDF format at the specified path.

Parameters:

  • The file path to store the PDF at.



241
242
243
244
245
246
247
248
249
# File 'lib/arx/entities/paper.rb', line 241

def save(path)
  begin
    pdf_content = URI.open(pdf_url).read
    File.open(path, 'wb') {|f| f.write pdf_content}
  rescue
    File.delete(path) if File.file? path
    raise
  end
end