Sha256: 42c31b12eb3ef1d5adb68e43595971e7ecb09d2a405482f180339ea6f4cb7715
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) module PostalMethods class Client require 'rubygems' gem 'soap4r' require 'soap/rpc/driver' require 'soap/wsdlDriver' require 'postalmethods/exceptions.rb' require 'postalmethods/document_processor.rb' require 'postalmethods/send_letter.rb' require 'postalmethods/get_letter_status.rb' require 'postalmethods/utility.rb' # include modules include SendLetter include DocumentProcessor include GetLetterStatus include UtilityMethods attr_accessor :api_uri, :username, :password, :to_send, :rpc_driver, :prepared def initialize(opts = {}) if opts[:username].nil? || opts[:password].nil? raise PostalMethods::NoCredentialsException end ## declare here so we can override in tests, etc. self.api_uri = "http://api.postalmethods.com/PostalWS.asmx?WSDL" self.username = opts[:username] self.password = opts[:password] end def prepare! begin self.rpc_driver ||= SOAP::WSDLDriverFactory.new(self.api_uri).create_rpc_driver rescue SocketError, RuntimeError raise PostalMethods::NoConnectionError end self.prepared = true return self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
postalmethods-1.0.0 | lib/postalmethods.rb |