sportngin/active_zuora — pull request #11 by johndagostino (2013-07-15 23:00:57+00:00)
Title: Add ability to access session_id from ActiveZuora::Connection

This could go a step further and add file download as a customization on the Export object.

Example usage;

export = ActiveZuora::Export.new
export.name = "Test"
export.format = "csv"
export.zip = true
export.query = "SELECT * FROM subscription"

url = "https://www.zuora.com/apps/api/file/#{export.file_id}"

id = ActiveZuora::Export.connection.session_id

Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new(uri.request_uri)
request.add_field("Authorization", "ZSession #{id}")

http.request(request) do |response|
response.read_body do |chunk|
src.write(chunk)
end
end
end

http://knowledgecenter.zuora.com/D_Zuora_APIs/SOAP_API/C_SOAP_API_Reference/H_Export_ZOQL
http://knowledgecenter.zuora.com/D_Zuora_APIs/SOAP_API/C_SOAP_API_Reference/C_API_Use_Cases_and_Examples/I_Creating_an_Export