I have a Rails application which uses another Rails application's API trough a WSDL file. I'd like to somehow cache or define as a constant the "handle" to the API which I create like this:
serv = SOAP::WSDLDriverFactory.new(APP_CONFIG['api_url']).create_rpc_driver
Reloading this for all methods which use the API is both slow and not very DRY. The API does not change very often so I would like to just create the "handle" when launching the application and always use the same "handle" for all connections.
How and where do I define this kind of global variable? I know constants can be set in environment.rb but it doesn't seem to work if I try to define this line there, get some kind of timeout error.