Project

efax

0.04
No commit activity in last 3 years
No release in over 3 years
Ruby library for accessing the eFax Developer service
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9.12
~> 2.3.2

Runtime

~> 3.0.0
~> 0.8.1
 Project Readme

efax Build Status

Ruby library for accessing eFax Developer service.

You can find eFax Developer API guides at efaxdeveloper.com or on Scribd.

Usage

Outbound Faxes

First you need to provide your account id and credentials:

EFax::Request.account_id = <your account id>
EFax::Request.user       = <your login>
EFax::Request.password   = <your password>

Sending an HTML page using eFax service is pretty simple:

response = EFax::OutboundRequest.post(recipient_name, company_name, fax_number, subject, content)

See EFax::RequestStatus class for details on status codes.

Having ID of your request, you can get its current status:

response = EFax::OutboundStatus.post(doc_id)

The status response has the following attributes:

response.status_code
response.message          # "user friendly" status message

See EFax::QueryStatus class for details on status codes.

Inbound Faxes

Inbound faxes work by exposing a URL that EFax can post to when it receives a fax on your account. An example end-point in rails might look like this:

class InboundFaxesController < AdminController
  def create
    efax = EFax::InboundPostRequest.receive_by_params(params)
    Fax.create(:file => efax.file, :name => efax.name) # etc
    render :text => efax.post_successful_message # This is important to let EFax know you successfully processed the incoming request.
  end
end

Test helpers

You can generate a EFax::InboundPostRequest based on optional explicit fields by using a helper method efax_inbound_post:

In your tests:

require "efax/helpers/inbound_helpers"

describe InboundFax do
  include EFax::Helpers::InboundHelpers

  it "should create a fax from efax data" do
    person = Person.make
    person.save
    efax = efax_inbound_post(:barcode => person.barcode_number)
    fax = InboundFax.create_from_efax!(efax)
    fax.person.should == person
  end
end