Created
July 29, 2021 15:23
-
-
Save allspiritseve/61ad5e488d12ee007270652ac230f812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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