Scenario 6: Ruby

From Intrannuity

Jump to: navigation, search

Download Source File

require "lib/iBilling"
 
	#Set up clients' settings
	config = Map.new
	config.put(SessionConnection::PROCESSOR_HOST, "http://server.ibillingclient.org/ibilling/xmlhttps")
	config.put("debug", true)
	#Login
	session = Session::login(2000, "welcome", config)
	#Find payment plan
	paymentPlan = session.loadPaymentPlan("rb.pp-1")
	#Execute delete last 6 charges
	paymentPlan.removeRange(5, 6)
	#Mark object for persistence
	session.save(paymentPlan)
	#Synchronize changes with the server
	begin
		session.synchronize()
	rescue Exception => ex
		#Be sure to properly handle exception, this is just a sample solution
		puts(ex.message)
		return 
	end
	#Logout
	session.logout()


Download Source File

Personal tools