postalmethods 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,25 +7,12 @@ README.txt
7
7
  Rakefile
8
8
  config/hoe.rb
9
9
  config/requirements.rb
10
- coverage/index.html
11
- coverage/lib-postalmethods-document_processor_rb.html
12
- coverage/lib-postalmethods-exceptions_rb.html
13
- coverage/lib-postalmethods-get_letter_status_rb.html
14
- coverage/lib-postalmethods-send_letter_rb.html
15
- coverage/lib-postalmethods-utility_rb.html
16
- coverage/lib-postalmethods_rb.html
17
10
  lib/postalmethods.rb
18
11
  lib/postalmethods/document_processor.rb
19
12
  lib/postalmethods/exceptions.rb
20
13
  lib/postalmethods/get_letter_status.rb
21
14
  lib/postalmethods/send_letter.rb
22
15
  lib/postalmethods/utility.rb
23
- lib/postalmethods/version.rb
24
- postalmethods.gemspec
25
- script/console
26
- script/destroy
27
- script/generate
28
- setup.rb
29
16
  spec/doc/WSDL-Output
30
17
  spec/doc/default.rb
31
18
  spec/doc/defaultMappingRegistry.rb
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/lib/postalmethods'
3
3
 
4
4
  # Generate all the Rake tasks
5
5
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
- $hoe = Hoe.new('postalmethods', PostalMethods::VERSION::STRING) do |p|
6
+ $hoe = Hoe.new('postalmethods', PostalMethods::VERSION) do |p|
7
7
  p.developer('James Cox', 'james@imaj.es')
8
8
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
9
  p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
@@ -25,4 +25,4 @@ require 'newgem/tasks' # load /tasks/*.rake
25
25
  Dir['tasks/**/*.rake'].each { |t| load t }
26
26
 
27
27
  # TODO - want other tests/tasks run by default? Add them to the list
28
- # task :default => [:spec, :features]
28
+ task :default => [:spec]
@@ -2,6 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module PostalMethods
5
+ VERSION = '1.1.1'
5
6
 
6
7
  class Client
7
8
 
@@ -9,7 +10,7 @@ module PostalMethods
9
10
  gem 'soap4r'
10
11
  require 'soap/rpc/driver'
11
12
  require 'soap/wsdlDriver'
12
- require 'ruby-debug'
13
+ #require 'ruby-debug'
13
14
 
14
15
  VERBOSE=nil # soap4r is a noisy bugger
15
16
 
@@ -18,10 +19,8 @@ module PostalMethods
18
19
  require 'postalmethods/send_letter.rb'
19
20
  require 'postalmethods/get_letter_status.rb'
20
21
  require 'postalmethods/utility.rb'
21
- require 'postalmethods/version.rb'
22
22
 
23
23
  # include modules
24
- include VERSION
25
24
  include SendLetter
26
25
  include DocumentProcessor
27
26
  include GetLetterStatus
@@ -5,9 +5,7 @@ module PostalMethods
5
5
  def send_letter(doc, description, work_mode = "")
6
6
  raise PostalMethods::NoPreparationException unless self.prepared
7
7
  ## push a letter over the api
8
-
9
-
10
-
8
+
11
9
  self.document = doc
12
10
  rv = @rpc_driver.sendLetterV2(:Username => self.username, :Password => self.password, :FileExtension => self.document[:extension],
13
11
  :FileBinaryData => self.document[:bytes], :MyDescription => description, :WorkMode => self.work_mode)
@@ -1,16 +1,16 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{postalmethods}
3
- s.version = "1.1.0"
3
+ s.version = "1.1.1"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["James Cox"]
7
- s.date = %q{2008-12-22}
7
+ s.date = %q{2008-12-28}
8
8
  s.description = %q{API wrapper library for the postal methods api.}
9
9
  s.email = ["james@imaj.es"]
10
10
  s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "README.txt"]
11
- s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "coverage/index.html", "coverage/lib-postalmethods-document_processor_rb.html", "coverage/lib-postalmethods-exceptions_rb.html", "coverage/lib-postalmethods-get_letter_status_rb.html", "coverage/lib-postalmethods-send_letter_rb.html", "coverage/lib-postalmethods-utility_rb.html", "coverage/lib-postalmethods_rb.html", "lib/postalmethods.rb", "lib/postalmethods/document_processor.rb", "lib/postalmethods/exceptions.rb", "lib/postalmethods/get_letter_status.rb", "lib/postalmethods/send_letter.rb", "lib/postalmethods/utility.rb", "lib/postalmethods/version.rb", "postalmethods.gemspec", "script/console", "script/destroy", "script/generate", "setup.rb", "spec/doc/WSDL-Output", "spec/doc/default.rb", "spec/doc/defaultMappingRegistry.rb", "spec/doc/sample.pdf", "spec/document_processor_spec.rb", "spec/get_letter_status_spec.rb", "spec/postalmethods_spec.rb", "spec/rcov.opts", "spec/send_letter_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/utility_spec.rb", "tasks/rspec.rake"]
11
+ s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "coverage/index.html", "coverage/lib-postalmethods-document_processor_rb.html", "coverage/lib-postalmethods-exceptions_rb.html", "coverage/lib-postalmethods-get_letter_status_rb.html", "coverage/lib-postalmethods-send_letter_rb.html", "coverage/lib-postalmethods-utility_rb.html", "coverage/lib-postalmethods_rb.html", "lib/postalmethods.rb", "lib/postalmethods/document_processor.rb", "lib/postalmethods/exceptions.rb", "lib/postalmethods/get_letter_status.rb", "lib/postalmethods/send_letter.rb", "lib/postalmethods/utility.rb", "postalmethods.gemspec", "script/console", "script/destroy", "script/generate", "setup.rb", "spec/doc/WSDL-Output", "spec/doc/default.rb", "spec/doc/defaultMappingRegistry.rb", "spec/doc/sample.pdf", "spec/document_processor_spec.rb", "spec/get_letter_status_spec.rb", "spec/postalmethods_spec.rb", "spec/rcov.opts", "spec/send_letter_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/utility_spec.rb", "tasks/rspec.rake"]
12
12
  s.has_rdoc = true
13
- s.homepage = %q{Info: http://www.postalmethods.com/resources/quickstart}
13
+ s.homepage = %q{http://www.postalmethods.com/resources/quickstart}
14
14
  s.post_install_message = %q{PostInstall.txt}
15
15
  s.rdoc_options = ["--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
@@ -1,11 +1,33 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
- # Time to add your specs!
4
- # http://rspec.info/
5
- describe "Place your specs here" do
3
+ describe "Client" do
6
4
 
7
- it "find this spec in spec directory" do
8
- violated "Be sure to write your specs"
5
+ it "should instantiate a client with a username and password" do
6
+ c = PostalMethods::Client.new(PM_OPTS)
7
+ c.class.should == PostalMethods::Client
9
8
  end
10
9
 
10
+ it "should fail without a user/pass on instantiation" do
11
+ lambda {PostalMethods::Client.new()}.should raise_error(PostalMethods::NoCredentialsException)
12
+ end
13
+
14
+ it "should create a driver client thru the factory" do
15
+ c = PostalMethods::Client.new(PM_OPTS)
16
+ c.prepare!
17
+ c.rpc_driver.class.should == SOAP::RPC::Driver
18
+ end
19
+
20
+ it "should raise a connection error exception when the api is unreachable" do
21
+ c = PostalMethods::Client.new(PM_OPTS)
22
+ c.stubs(:api_uri).returns("http://invaliduri.tld/api_endpoint.wtf?")
23
+ lambda {c.prepare!}.should raise_error(PostalMethods::NoConnectionError)
24
+ end
25
+
26
+ it "should be able to set a work mode" do
27
+ c = PostalMethods::Client.new(PM_OPTS)
28
+ c.work_mode.should == "Default"
29
+ c.work_mode = "ProdUCTion"
30
+ c.work_mode.should == "Production"
31
+ c.work_mode.should be_a_kind_of(String)
32
+ end
11
33
  end
@@ -1 +1,7 @@
1
- --colour
1
+ --colour
2
+ --format
3
+ specdoc
4
+ --loadby
5
+ mtime
6
+ --reverse
7
+ --backtrace
@@ -1,10 +1,30 @@
1
1
  begin
2
2
  require 'spec'
3
+ require 'mocha'
3
4
  rescue LoadError
4
5
  require 'rubygems'
5
- gem 'rspec'
6
6
  require 'spec'
7
+ require 'mocha'
7
8
  end
8
9
 
9
10
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
11
  require 'postalmethods'
12
+
13
+ $VERBOSE = nil ##silence annoying warnings from soap4r
14
+
15
+ PM_OPTS = {:username => 'imajes', :password => 'rubyr00ls'}
16
+
17
+ # hash hacks to make hacking in specs easier
18
+ class Hash
19
+ # for excluding keys
20
+ def except(*exclusions)
21
+ self.reject { |key, value| exclusions.include? key.to_sym }
22
+ end
23
+
24
+ # for overriding keys
25
+ def with(overrides = {})
26
+ self.merge overrides
27
+ end
28
+ end
29
+
30
+ require "ruby-debug"
@@ -19,3 +19,15 @@ Spec::Rake::SpecTask.new do |t|
19
19
  t.spec_opts = ['--options', "spec/spec.opts"]
20
20
  t.spec_files = FileList['spec/**/*_spec.rb']
21
21
  end
22
+
23
+ namespace :spec do
24
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
25
+ Spec::Rake::SpecTask.new(:rcov) do |t|
26
+ t.spec_opts = ['--options', "\"spec/spec.opts\""]
27
+ t.spec_files = FileList['spec/**/*_spec.rb']
28
+ t.rcov = true
29
+ t.rcov_opts = lambda do
30
+ IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postalmethods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Cox
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-22 00:00:00 +00:00
12
+ date: 2008-12-28 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -69,7 +69,6 @@ files:
69
69
  - lib/postalmethods/get_letter_status.rb
70
70
  - lib/postalmethods/send_letter.rb
71
71
  - lib/postalmethods/utility.rb
72
- - lib/postalmethods/version.rb
73
72
  - postalmethods.gemspec
74
73
  - script/console
75
74
  - script/destroy
@@ -89,7 +88,9 @@ files:
89
88
  - spec/utility_spec.rb
90
89
  - tasks/rspec.rake
91
90
  has_rdoc: true
92
- homepage: "Info: http://www.postalmethods.com/resources/quickstart"
91
+ homepage: http://www.postalmethods.com/resources/quickstart
92
+ licenses: []
93
+
93
94
  post_install_message: PostInstall.txt
94
95
  rdoc_options:
95
96
  - --main
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
112
  requirements: []
112
113
 
113
114
  rubyforge_project: postalmethods
114
- rubygems_version: 1.2.0
115
+ rubygems_version: 1.3.5
115
116
  signing_key:
116
117
  specification_version: 2
117
118
  summary: API wrapper library for the postal methods api.
@@ -1,9 +0,0 @@
1
- module PostalMethods
2
- module VERSION #:nodoc:
3
- MAJOR = 1
4
- MINOR = 1
5
- TINY = 0
6
-
7
- STRING = [MAJOR, MINOR, TINY].join('.')
8
- end
9
- end