Created
April 4, 2011 18:28
-
-
Save rubiii/902133 to your computer and use it in GitHub Desktop.
Savon InterFAX example: Information about the last 10 outbound faxes
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
# more examples at: | |
# https://gist.github.com/903337 | |
require "rubygems" | |
# $ gem install savon (works with v0.9.1 and higher) | |
require "savon" | |
# convert hash key symbols to camelcase | |
Gyoku.convert_symbols_to(:camelcase) | |
# create a client using the InterFAX WSDL | |
client = Savon::Client.new("http://ws.interfax.net/dfs.asmx?wsdl") | |
# execute a request to the :fax_status action | |
response = client.request(:int, :fax_status) do | |
soap.body = { | |
:username => "your username", | |
:password => "your password", | |
:last_transaction_ID => 999999999, # this value returns every fax | |
:max_items => 10 # and this limits the response to 10 items | |
} | |
end | |
# translate the response to an Array and get the fax items | |
items = response.to_array(:fax_status_response, :fax_status_result, :fax_item) | |
# print the Transaction ID of every item | |
items.each { |item| p item[:transaction_id] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment