Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
require 'soap/wsdlDriver' require 'cgi' class SpamCannon class << self attr_accessor :wsdl, :logging, :client def newsletters return @newsletters if @newsletters @newsletters = client.getNewsletters.inject({}) do |hash, letter| hash.merge(letter.list_id => letter) end end def create_user(email, vitals, subscriptions = []) client.createUser(email, vitals, subscriptions) end def update_user(email, vitals, subscriptions = [], unsubscriptions = []) client.updateUser(email, vitals, subscriptions, unsubscriptions) end def get_user(email) client.getUser(email) end def user_exists?(email) client.doesUserExist(email) end def client @logging ? client_with_logging : client_without_logging end private def client_without_logging @client ||= SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver end def client_with_logging returning(client_without_logging) { |c| c.wiredump_file_base = 'soap.txt' } end end end SpamCannon.wsdl = 'http://soap.newsletters.website.com:9631/services/SCC?wsdl'
This paste will be private.
From the Design Piracy series on my blog: