[Fxruby-commits] CVS: FXRuby/examples RAA.rb,NONE,1.1.2.1 iRAA.rb,1.1,1.1.2.1
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <ly...@us...> - 2002-05-15 21:18:17
|
Update of /cvsroot/fxruby/FXRuby/examples In directory usw-pr-cvs1:/tmp/cvs-serv17838 Modified Files: Tag: release10 iRAA.rb Added Files: Tag: release10 RAA.rb Log Message: Latest versions of iRAA.rb and RAA.rb from the SOAP4R 1.4.4.1 distribution. --- NEW FILE: RAA.rb --- require 'soap/driver' require 'devel/logger' require 'iRAA' module RAA; extend SOAP class Driver attr_reader :endpointUrl attr_reader :proxy attr_reader :log AppName = 'RAAClient' def initialize( endpointUrl, proxy = nil ) @endpointUrl = endpointUrl @proxy = proxy @logDev = STDERR end def setWireDumpDev( dev ) @drv = createDriver unless @drv @drv.setWireDumpDev( dev ) end def setLogDev( logDev ) @logDev = logDev @log = nil end def setLogLevel( level ) createLog unless @log @log.level = level end private def createLog @log = Devel::Logger.new( @logDev ) if @logDev end def createDriver createLog unless @log drv = SOAP::Driver.new( @log, AppName, RAA::InterfaceNS, @endpointUrl, @proxy ) drv.mappingRegistry = RAA::MappingRegistry RAA::Methods.each do | methodName, *params | drv.addMethod( methodName, params ) end drv end def method_missing( msg_id, *a, &b ) @drv = createDriver unless @drv @drv.__send__( msg_id, *a, &b ) end end end Index: iRAA.rb =================================================================== RCS file: /cvsroot/fxruby/FXRuby/examples/iRAA.rb,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** iRAA.rb 21 Mar 2002 23:02:38 -0000 1.1 --- iRAA.rb 15 May 2002 21:18:13 -0000 1.1.2.1 *************** *** 1,84 **** ! module RAA - InterfaceNS = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.1" ! class Category ! include SOAP::Marshallable ! @@typeNamespace = InterfaceNS - attr_reader :major, :minor ! def initialize( major, minor = nil ) ! @major = major ! @minor = minor ! end ! def to_s ! "#{ @major }/#{ @minor }" ! end ! def ==( rhs ) ! if @major != rhs.major ! false ! elsif !@minor or !rhs.minor ! true ! else ! @minor == rhs.minor ! end end end ! class Product ! include SOAP::Marshallable ! @@typeNamespace = InterfaceNS ! attr_reader :name ! attr_accessor :version, :status, :homepage, :download, :license, :description ! def initialize( name, version = nil, status = nil, homepage = nil, download = nil, license = nil, description = nil ) ! @name = name ! @version = version ! @status = status ! @homepage = homepage ! @download = download ! @license = license ! @description = description ! end end ! class Owner ! include SOAP::Marshallable ! @@typeNamespace = InterfaceNS ! attr_reader :id ! attr_accessor :email, :name ! def initialize( email, name ) ! @email = email ! @name = name ! @id = "#{ @email }-#{ @name }" ! end end ! class Info ! include SOAP::Marshallable ! @@typeNamespace = InterfaceNS ! attr_accessor :category, :product, :owner, :update ! def initialize( category = nil, product = nil, owner = nil, update = nil ) ! @category = category ! @product = product ! @owner = owner ! @update = update ! end end ! Methods = { ! 'getAllListings' => [ 'Array' ], ! 'getProductTree' => [ 'Hash' ], ! 'getInfoFromCategory' => [ 'Array', 'category' ], ! 'getModifiedInfoSince' => [ 'Array', 'time' ], ! 'getInfoFromName' => [ 'Info', 'name' ], ! } end --- 1,139 ---- ! require 'soap/rpcUtils' ! module RAA; extend SOAP ! InterfaceNS = "http://www.ruby-lang.org/xmlns/soap/interface/RAA/0.0.1" ! MappingRegistry = SOAP::RPCUtils::MappingRegistry.new ! Methods = [ ! [ 'getAllListings', [ 'retval', 'return' ]], ! [ 'getProductTree', [ 'retval', 'return' ]], ! [ 'getInfoFromCategory', [ 'in', 'category' ], [ 'retval', 'return' ]], ! [ 'getModifiedInfoSince', [ 'in', 'time' ], [ 'retval', 'return' ]], ! [ 'getInfoFromName', [ 'in', 'name' ], [ 'retval', 'return' ]], ! ] ! class Category ! include SOAP::Marshallable ! ! attr_reader :major, :minor ! ! def initialize( major, minor = nil ) ! @major = major ! @minor = minor ! end ! ! def to_s ! "#{ @major }/#{ @minor }" ! end ! ! def ==( rhs ) ! if @major != rhs.major ! false ! elsif !@minor or !rhs.minor ! true ! else ! @minor == rhs.minor end end + end ! MappingRegistry.set( ! ::RAA::Category, ! ::SOAP::SOAPStruct, ! ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, ! [ InterfaceNS, "Category" ] ! ) ! class Product ! include SOAP::Marshallable ! attr_reader :name ! attr_accessor :version, :status, :homepage, :download, :license, :description ! ! def initialize( name, version = nil, status = nil, homepage = nil, download = nil, license = nil, description = nil ) ! @name = name ! @version = version ! @status = status ! @homepage = homepage ! @download = download ! @license = license ! @description = description end + end ! MappingRegistry.set( ! ::RAA::Product, ! ::SOAP::SOAPStruct, ! ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, ! [ InterfaceNS, "Product" ] ! ) ! class Owner ! include SOAP::Marshallable ! attr_reader :id ! attr_accessor :email, :name ! ! def initialize( email, name ) ! @email = email ! @name = name ! @id = "#{ @email }-#{ @name }" end + end ! MappingRegistry.set( ! ::RAA::Owner, ! ::SOAP::SOAPStruct, ! ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, ! [ InterfaceNS, "Owner" ] ! ) ! class Info ! include SOAP::Marshallable ! attr_accessor :category, :product, :owner, :update ! ! def initialize( category = nil, product = nil, owner = nil, update = nil ) ! @category = category ! @product = product ! @owner = owner ! @update = update end ! def <=>( rhs ) ! @update <=> rhs.update ! end ! ! def eql?( rhs ) ! @product.name == rhs.product.name ! end ! end ! ! MappingRegistry.set( ! ::RAA::Info, ! ::SOAP::SOAPStruct, ! ::SOAP::RPCUtils::MappingRegistry::TypedStructFactory, ! [ InterfaceNS, "Info" ] ! ) ! ! class StringArray < Array; end ! MappingRegistry.set( ! ::RAA::StringArray, ! ::SOAP::SOAPArray, ! ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, ! [ XSD::Namespace, XSD::StringLiteral ] ! ) ! ! class InfoArray < Array; end ! MappingRegistry.set( ! ::RAA::InfoArray, ! ::SOAP::SOAPArray, ! ::SOAP::RPCUtils::MappingRegistry::TypedArrayFactory, ! [ InterfaceNS, 'Info' ] ! ) ! ! end |