Skip to content

Instantly share code, notes, and snippets.

@allspiritseve
Created July 29, 2021 15:23
Show Gist options
  • Save allspiritseve/61ad5e488d12ee007270652ac230f812 to your computer and use it in GitHub Desktop.
Save allspiritseve/61ad5e488d12ee007270652ac230f812 to your computer and use it in GitHub Desktop.
require 'phaxio'
Phaxio.api_key = 'xxx'
Phaxio.api_secret = 'xxx'
class Fax
def send_fax
file = File.open("/path/to/document.pdf")
to = 'tel:123-456-7890'
fax = Phaxio::Fax.create(to: to, file: file)
response = fax.get
data = response.instance_variable_get(:@raw_data)
File.write("fax_#{Time.now.to_i}_response.txt", data)
end
def fax_status(fax_id)
fax = Phaxio::Fax.get(fax_id)
puts fax.inspect
end
end
Fax.new.send_fax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment