Add ReportRun#contents to get the actual report data#1157
Add ReportRun#contents to get the actual report data#1157willbryant wants to merge 1 commit intostripe:masterfrom
Conversation
|
Hi @willbryant, Thank you for the submission. I think this is valuable. Instead of this interface: report_run = Stripe::Reporting::ReportRun.retrieve("...")
report_run.contents do |bytes|
file.write(bytes)
endWhat do you think of a method on the report_run = Stripe::Reporting::ReportRun.retrieve("...")
if report_run.result
report_run.result.download do |bytes|
file.write(bytes)
end
endI think it's less discoverable on the (Please just discuss for now, don't change your implementation) |
|
That would be fine too, but it's not the approach taken for the existing Quote API. It seems File is only used for file resources, not for all file-like downloadables? So at the moment there is no way to construct a File object for anything other than an actual file resource, which is not exposed for report runs by the API. |
|
Try with manually downloading the report content using the provided metadata. Check if the report run has a PDF file associated with it and try accessing the PDF file directly through its URL. If this approach doesn't work, consider contacting the Stripe support team for further assistance. |
As far as I can see the Ruby client currently only has methods to create a report run and retrieve it (ie. its metadata), not the actual report content.
This PR adds an action to download the content, based on Quote#pdf.
I tried to add a test to cover it, but found that stripe-mock doesn't have mocked reponses for the binary
contentsendpoint on files (only the file metadata endpoint), so I can't add a working test at this time.