sendwithus/sendwithus_ruby — pull request #35 by Senjai (2014-12-18 22:05:47+00:00)
Title: Add a SendWithUs Attachment class.

We should have a class responsible for the handling of attachment data
in our application.

This fixes several problems:

Problem #1: For users who use rails, uploaded files are stored without
their extension and have a basename that looks like this: RackMultipart20141217-17487-bhp429.

Currently there is no way to override the filename we want users to see,
despite it being provided by ActionDispatch::Http::UploadedFile.

Problem #2: Some users want to be able to just pass in raw data as an
attachment and not actually persist the data to the filesystem. This
can't occur with the code that predates this as it is coupled to the
assumption all attachments will be persisted on disk before being
attachments.

This fixes that issue by allowing the user to pass in an IO object
instead of a path. Anything that responds to #read would work in this
scenario.

Problem #3: SendWithUs is too coupled to the filesystem. This alleviates
some of this coupling by encapsulating all behavior having to do with
attachments into a single class.

This is a backwards compatible change. Thanks to @adammathys for additional input.