Receiving faxes and interacting with them in ruby?

I wasn't sure if anyone here knew how to interact with a fax service via ruby, but if you have any insight on this I would greatly appreciate it.

Basically what I'm looking to do is....when a fax is sent to a fax number, take that fax and save it as 2045467788.pdf or any file type. The file type is irrelevant, but as long as the fax is stored as the phone number it was sent from I can do things with it. I can associate that phone number with an account in the database and then link it to that account.

Does anyone know how to do this or can anyone point me in the right direction?

Thanks a lot for your help.

Thank You,
Ben Johnson