Skip to content

Commit

Permalink
Adds download report method
Browse files Browse the repository at this point in the history
  • Loading branch information
erlinis committed Aug 13, 2017
1 parent 371ab2a commit 404ded8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/jasperserver-rails/jasperserver-dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def generate_report(&block)
)
end

def download_report(filename, &block)
temp_file = Tempfile.new([filename, '.pdf'])
temp_file.binmode
temp_file.write(generate_report(&block).body)
temp_file.close
temp_file
end

def run_report(filename, &block)
FileUtils.mkdir_p(File.expand_path(filename).split('/')[0..-2].join('/'))
f = File.new(filename, 'wb')
Expand Down

0 comments on commit 404ded8

Please sign in to comment.