From de8547eeb93dfc0991d26302a232c5de01540c76 Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Tue, 6 Nov 2012 02:59:25 -0700 Subject: [PATCH] Updated to work with latest Savon and be more friendly --- edex.rb | 67 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/edex.rb b/edex.rb index a1828dd..a6a6855 100644 --- a/edex.rb +++ b/edex.rb @@ -5,19 +5,62 @@ # See README for usage info. -class UnitsController < ApplicationController -require 'savon' + +# Silence silly warnings and info. Make these true if you want to see HTTP/SOAP debug info. +HTTPI.log = false +Savon.configure do |config| + config.log = false +end + +debug = 2 # Change from 2, to 1, to 0 as you verify things appear sane. +user_id = "YOUR_EDEX_USERID_HERE" +password = "YOUR_EDEX_PASSWORD_HERE" +portfolio_name = "YOUR_COMPANY_NAME_HERE|YOUR_PORTAL_NAME_HERE" +property_id = "YOUR_PROPERTY_ID_HERE" + +require "savon" require 'nokogiri' - - # GET /units - def index - client = Savon::Client.new "http://amsi.saas.infor.com/AMSIWEBG003/edexweb/esite/leasing.asmx?wsdl" - response = client.get_property_units do |soap| - soap.xml = ' YOUR_EDEX_USERID_HERE YOUR_EDEX_PASSWORD_HERE YOUR_COMPANY_NAME_HERE|YOUR_PORTAL_NAME_HERE YOUR_PROPERTY_ID_HERE0]]> ' - end + + +client = Savon.client("http://amsi.saas.infor.com/AMSIWEBG003/edexweb/esite/leasing.asmx?wsdl") + +if debug == 2 then + puts client.wsdl.soap_actions + puts "If the above looks good, set debug=1" +end + +if debug < 2 then + response = client.request(:get_property_units) do +#WARNING: + + + + #{user_id} + #{password} + #{portfolio_name} + + + #{property_id} + 0 + ]]> + + + + +eos + end + + if debug > 0 then + puts response + puts "If the above looks good, set debug=0" + else property_data = response.to_hash[:get_property_units_response][:get_property_units_result] doc = Nokogiri::XML(property_data) - @view = doc.css('Unit')[0]['UnitId'] + view = doc.css('Unit')[0]['UnitId'] + + puts "Success! The first unit's ID is #{view}" end - -end \ No newline at end of file +end +