sumoheavy / jira-ruby

A Ruby gem for the JIRA REST API
MIT License
654 stars 412 forks source link

Attachment download contents #422

Closed marlinpierce closed 5 months ago

marlinpierce commented 8 months ago

Adds methods to attachments to download the attachment contents.

morphine00 commented 8 months ago

Neat, thanks! The only note I have is that it's probably preferable to return a Tempfile because the contents may be quite large and they'll otherwise be kept in memory.

marlinpierce commented 8 months ago

@morphine00 I provided the download_file method to return a file IO object. This should allow you to read in blocks, or read the beginning of the file, whatever you would do to avoid reading the whole contents into a string object in memory.. Assuming the URI.open streams the input, it should provided the IO without reading the string contents into memory and without saving to a file, reading as it is available from the network interface.

This way, there is one method for those who want to handle large files without reading into memory and another method for those who want an easy way to read the contents in a string object.

morphine00 commented 8 months ago

Ah, I missed that detail, my apologies.

bobbrodie commented 5 months ago

@marlinpierce I'm so sorry, I know it's been a while. When you have a moment, could you update your PR to resolve the conflicts? If you can't get to it now I completely understand, and in that case I'll make a new PR with your changes. I'd like to get this in for you. Thanks!

marlinpierce commented 5 months ago

@bobbrodie the merge conflict is resolved. I'm looking forward to the 0.2.4 release.

bobbrodie commented 5 months ago

Sounds great, thanks @marlinpierce. I've started a thread here about the next version. I think that being since it's been so long, and Ruby <= 3.0 are no longer supported, it probably makes sense to release a 3.0.0 version of the gem without those versions included.

If you're in a spot where that won't work, let's chat and we can sort out a 2.4.0 release that only has backward compatible changes.

If anyone else has feedback on that, I'd love to hear from others as well.

marlinpierce commented 5 months ago

I do like the charm of the version being 0.2.4. The extra zero is a hint that it is also the year.