billwise4r 0.1.1 → 0.2.2
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.
- data/.gitignore +42 -0
- data/Gemfile +2 -9
- data/Gemfile.lock +34 -24
- data/README.md +1 -1
- data/Rakefile +1 -51
- data/billwise4r.gemspec +23 -70
- data/lib/billwise4r/version.rb +3 -0
- data/lib/billwise4r.rb +120 -4
- data/spec/billwise4r_spec.rb +30 -11
- data/spec/config/config.yml +1 -1
- data/spec/connect_sm_service.wsdl +6137 -3573
- data/spec/spec_helper.rb +1 -1
- metadata +75 -166
- data/VERSION +0 -1
- data/lib/billwise4r/billwise4r.rb +0 -90
- data/spec/config/.gitignore +0 -1
data/.gitignore
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# rcov generated
|
|
2
|
+
coverage
|
|
3
|
+
|
|
4
|
+
# rdoc generated
|
|
5
|
+
rdoc
|
|
6
|
+
|
|
7
|
+
# yard generated
|
|
8
|
+
doc
|
|
9
|
+
.yardoc
|
|
10
|
+
|
|
11
|
+
# bundler
|
|
12
|
+
.bundle
|
|
13
|
+
|
|
14
|
+
# jeweler generated
|
|
15
|
+
pkg
|
|
16
|
+
|
|
17
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
|
18
|
+
#
|
|
19
|
+
# * Create a file at ~/.gitignore
|
|
20
|
+
# * Include files you want ignored
|
|
21
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
|
22
|
+
#
|
|
23
|
+
# After doing this, these files will be ignored in all your git projects,
|
|
24
|
+
# saving you from having to 'pollute' every project you touch with them
|
|
25
|
+
#
|
|
26
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
|
27
|
+
#
|
|
28
|
+
# For MacOS:
|
|
29
|
+
#
|
|
30
|
+
#.DS_Store
|
|
31
|
+
#
|
|
32
|
+
# For TextMate
|
|
33
|
+
#*.tmproj
|
|
34
|
+
#tmtags
|
|
35
|
+
#
|
|
36
|
+
# For emacs:
|
|
37
|
+
#*~
|
|
38
|
+
#\#*
|
|
39
|
+
#.\#*
|
|
40
|
+
#
|
|
41
|
+
# For vim:
|
|
42
|
+
#*.swp
|
data/Gemfile
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
source "http://rubygems.org"
|
|
2
|
-
gem "savon"
|
|
3
|
-
gem "multi_xml"
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
gem "bundler", "~> 1.0.0"
|
|
8
|
-
gem "jeweler", "~> 1.5.1"
|
|
9
|
-
gem "rcov", ">= 0"
|
|
10
|
-
gem "awesome_print"
|
|
11
|
-
end
|
|
3
|
+
# Specify your gem's dependencies in billwise4r.gemspec
|
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
|
@@ -1,41 +1,51 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
billwise4r (0.2.2)
|
|
5
|
+
multi_xml
|
|
6
|
+
savon
|
|
7
|
+
|
|
1
8
|
GEM
|
|
2
9
|
remote: http://rubygems.org/
|
|
3
10
|
specs:
|
|
11
|
+
akami (1.0.0)
|
|
12
|
+
gyoku (>= 0.4.0)
|
|
4
13
|
awesome_print (0.4.0)
|
|
5
14
|
builder (3.0.0)
|
|
6
|
-
|
|
15
|
+
diff-lcs (1.1.3)
|
|
16
|
+
fakeweb (1.3.0)
|
|
7
17
|
gyoku (0.4.4)
|
|
8
18
|
builder (>= 2.1.2)
|
|
9
|
-
httpi (0.9.
|
|
10
|
-
pyu-ntlm-http (>= 0.1.3.1)
|
|
19
|
+
httpi (0.9.5)
|
|
11
20
|
rack
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
multi_xml (0.4.1)
|
|
22
|
+
nokogiri (1.5.0)
|
|
23
|
+
nori (1.0.2)
|
|
24
|
+
rack (1.3.5)
|
|
25
|
+
rspec (2.7.0)
|
|
26
|
+
rspec-core (~> 2.7.0)
|
|
27
|
+
rspec-expectations (~> 2.7.0)
|
|
28
|
+
rspec-mocks (~> 2.7.0)
|
|
29
|
+
rspec-core (2.7.1)
|
|
30
|
+
rspec-expectations (2.7.0)
|
|
31
|
+
diff-lcs (~> 1.1.2)
|
|
32
|
+
rspec-mocks (2.7.0)
|
|
33
|
+
savon (0.9.7)
|
|
34
|
+
akami (~> 1.0)
|
|
24
35
|
builder (>= 2.1.2)
|
|
25
36
|
gyoku (>= 0.4.0)
|
|
26
|
-
httpi (
|
|
37
|
+
httpi (~> 0.9)
|
|
38
|
+
nokogiri (>= 1.4.0)
|
|
39
|
+
nori (~> 1.0)
|
|
40
|
+
wasabi (~> 2.0)
|
|
41
|
+
wasabi (2.0.0)
|
|
27
42
|
nokogiri (>= 1.4.0)
|
|
28
|
-
nori (>= 0.2.0)
|
|
29
|
-
shoulda (2.11.3)
|
|
30
43
|
|
|
31
44
|
PLATFORMS
|
|
32
45
|
ruby
|
|
33
46
|
|
|
34
47
|
DEPENDENCIES
|
|
35
48
|
awesome_print
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
rcov
|
|
40
|
-
savon
|
|
41
|
-
shoulda
|
|
49
|
+
billwise4r!
|
|
50
|
+
fakeweb
|
|
51
|
+
rspec
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
@@ -1,51 +1 @@
|
|
|
1
|
-
require
|
|
2
|
-
require 'bundler'
|
|
3
|
-
begin
|
|
4
|
-
Bundler.setup(:default, :development)
|
|
5
|
-
rescue Bundler::BundlerError => e
|
|
6
|
-
$stderr.puts e.message
|
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
|
8
|
-
exit e.status_code
|
|
9
|
-
end
|
|
10
|
-
require 'rake'
|
|
11
|
-
|
|
12
|
-
require 'jeweler'
|
|
13
|
-
Jeweler::Tasks.new do |gem|
|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
|
15
|
-
gem.name = "billwise4r"
|
|
16
|
-
gem.homepage = "http://github.com/tropo/billwise4r"
|
|
17
|
-
gem.license = "MIT"
|
|
18
|
-
gem.summary = "Ruby lib for consuming the Billwise SOAP/XML API"
|
|
19
|
-
gem.description = "Ruby lib for consuming the Billwise SOAP/XML API"
|
|
20
|
-
gem.email = "jason@goecke.net"
|
|
21
|
-
gem.authors = ["Jason Goecke"]
|
|
22
|
-
gem.add_runtime_dependency 'savon'
|
|
23
|
-
gem.add_development_dependency 'rspec'
|
|
24
|
-
end
|
|
25
|
-
Jeweler::RubygemsDotOrgTasks.new
|
|
26
|
-
|
|
27
|
-
require 'rake/testtask'
|
|
28
|
-
Rake::TestTask.new(:test) do |test|
|
|
29
|
-
test.libs << 'lib' << 'test'
|
|
30
|
-
test.pattern = 'test/**/test_*.rb'
|
|
31
|
-
test.verbose = true
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
require 'rcov/rcovtask'
|
|
35
|
-
Rcov::RcovTask.new do |test|
|
|
36
|
-
test.libs << 'test'
|
|
37
|
-
test.pattern = 'test/**/test_*.rb'
|
|
38
|
-
test.verbose = true
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
task :default => :test
|
|
42
|
-
|
|
43
|
-
require 'rake/rdoctask'
|
|
44
|
-
Rake::RDocTask.new do |rdoc|
|
|
45
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
46
|
-
|
|
47
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
48
|
-
rdoc.title = "billwise4r #{version}"
|
|
49
|
-
rdoc.rdoc_files.include('README*')
|
|
50
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
51
|
-
end
|
|
1
|
+
require "bundler/gem_tasks"
|
data/billwise4r.gemspec
CHANGED
|
@@ -1,82 +1,35 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "billwise4r/version"
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |s|
|
|
7
|
-
s.name
|
|
8
|
-
s.version
|
|
9
|
-
|
|
10
|
-
s.
|
|
11
|
-
s.
|
|
12
|
-
s.
|
|
6
|
+
s.name = "billwise4r"
|
|
7
|
+
s.version = Billwise4r::VERSION
|
|
8
|
+
s.authors = ["Jason Goecke","John Dyer"]
|
|
9
|
+
s.email = ["jason@goecke.net","john@krumpt.com"]
|
|
10
|
+
s.homepage = %q{http://github.com/jsgoecke/billwise4r}
|
|
11
|
+
s.summary = %q{Ruby lib for consuming the Billwise SOAP/XML API}
|
|
13
12
|
s.description = %q{Ruby lib for consuming the Billwise SOAP/XML API}
|
|
14
|
-
s.email = %q{jason@goecke.net}
|
|
15
|
-
s.extra_rdoc_files = [
|
|
16
|
-
"LICENSE.txt",
|
|
17
|
-
"README.md"
|
|
18
|
-
]
|
|
19
|
-
s.files = [
|
|
20
|
-
".document",
|
|
21
|
-
"Gemfile",
|
|
22
|
-
"Gemfile.lock",
|
|
23
|
-
"LICENSE.txt",
|
|
24
|
-
"README.md",
|
|
25
|
-
"Rakefile",
|
|
26
|
-
"VERSION",
|
|
27
|
-
"billwise4r.gemspec",
|
|
28
|
-
"lib/billwise4r.rb",
|
|
29
|
-
"lib/billwise4r/billwise4r.rb",
|
|
30
|
-
"spec/billwise4r_spec.rb",
|
|
31
|
-
"spec/config/.gitignore",
|
|
32
|
-
"spec/config/config.yml",
|
|
33
|
-
"spec/connect_sm_service.wsdl",
|
|
34
|
-
"spec/spec_helper.rb"
|
|
35
|
-
]
|
|
36
|
-
s.homepage = %q{http://github.com/tropo/billwise4r}
|
|
37
|
-
s.licenses = ["MIT"]
|
|
38
|
-
s.require_paths = ["lib"]
|
|
39
13
|
s.rubygems_version = %q{1.5.0}
|
|
14
|
+
s.required_ruby_version = '>= 1.9'
|
|
40
15
|
s.summary = %q{Ruby lib for consuming the Billwise SOAP/XML API}
|
|
41
16
|
s.test_files = [
|
|
42
17
|
"spec/billwise4r_spec.rb",
|
|
43
|
-
"spec/spec_helper.rb"
|
|
18
|
+
"spec/spec_helper.rb",
|
|
19
|
+
"spec/connect_sm_service.wsdl",
|
|
20
|
+
"spec/config/config.yml"
|
|
44
21
|
]
|
|
45
22
|
|
|
46
|
-
|
|
47
|
-
s.specification_version = 3
|
|
23
|
+
s.rubyforge_project = "billwise4r"
|
|
48
24
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
54
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
|
55
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
|
56
|
-
s.add_development_dependency(%q<awesome_print>, [">= 0"])
|
|
57
|
-
s.add_runtime_dependency(%q<savon>, [">= 0"])
|
|
58
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
|
59
|
-
else
|
|
60
|
-
s.add_dependency(%q<savon>, [">= 0"])
|
|
61
|
-
s.add_dependency(%q<multi_xml>, [">= 0"])
|
|
62
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
63
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
64
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
|
65
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
|
66
|
-
s.add_dependency(%q<awesome_print>, [">= 0"])
|
|
67
|
-
s.add_dependency(%q<savon>, [">= 0"])
|
|
68
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
|
69
|
-
end
|
|
70
|
-
else
|
|
71
|
-
s.add_dependency(%q<savon>, [">= 0"])
|
|
72
|
-
s.add_dependency(%q<multi_xml>, [">= 0"])
|
|
73
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
74
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
|
75
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
|
76
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
|
77
|
-
s.add_dependency(%q<awesome_print>, [">= 0"])
|
|
78
|
-
s.add_dependency(%q<savon>, [">= 0"])
|
|
79
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
|
80
|
-
end
|
|
81
|
-
end
|
|
25
|
+
s.files = `git ls-files`.split("\n")
|
|
26
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
27
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
28
|
+
s.require_paths = ["lib","spec"]
|
|
82
29
|
|
|
30
|
+
s.add_development_dependency "rspec"
|
|
31
|
+
s.add_development_dependency "fakeweb"
|
|
32
|
+
s.add_development_dependency "awesome_print"
|
|
33
|
+
s.add_runtime_dependency "savon"
|
|
34
|
+
s.add_runtime_dependency "multi_xml"
|
|
35
|
+
end
|
data/lib/billwise4r.rb
CHANGED
|
@@ -1,4 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
require
|
|
3
|
-
require '
|
|
4
|
-
require '
|
|
1
|
+
class Billwise
|
|
2
|
+
require "billwise4r/version"
|
|
3
|
+
require 'savon'
|
|
4
|
+
require 'multi_xml'
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
# Instantiates a new Billwise class
|
|
8
|
+
#
|
|
9
|
+
def initialize(params={})
|
|
10
|
+
# Make sure all params we need are here or raise an error
|
|
11
|
+
check_initialization_params(params)
|
|
12
|
+
|
|
13
|
+
@companyCd = params[:companyCd]
|
|
14
|
+
log = params[:log] || false
|
|
15
|
+
log_level = params[:log_level] || :info
|
|
16
|
+
@httpi_log = params[:httpi_log] || false
|
|
17
|
+
|
|
18
|
+
Savon.configure do |config|
|
|
19
|
+
config.log = log
|
|
20
|
+
config.log_level = log_level
|
|
21
|
+
config.env_namespace = :soap
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
@soap_endpoint = URI.parse params[:endpoint] || 'https://cwa021.connect4billing.com:8443/axis2/services/ConnectSmService.ConnectSmServiceHttpSoap12Endpoint/'
|
|
25
|
+
@soap_namespace = params[:namespace] || 'http://connectsm.ws.bwse.com/xsd'
|
|
26
|
+
|
|
27
|
+
@soap_version = 2
|
|
28
|
+
|
|
29
|
+
# Build our SOAP driver
|
|
30
|
+
@soap_driver = Savon::Client.new do
|
|
31
|
+
wsse.credentials '290connectsm','ZgntS40r'
|
|
32
|
+
wsdl.document = 'https://cwa021.connect4billing.com:8443/axis2/services/ConnectSmService?wsdl'
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
@soap_driver.http.read_timeout = 300
|
|
36
|
+
|
|
37
|
+
@tag_order = tag_order
|
|
38
|
+
|
|
39
|
+
MultiXml.parser = :nokogiri
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
# A catch all for the methods defined by the WSDL
|
|
44
|
+
# refer to the Billwise API documentation for details
|
|
45
|
+
#
|
|
46
|
+
# @return [Hash] the Billwise response
|
|
47
|
+
def method_missing(method, params)
|
|
48
|
+
begin
|
|
49
|
+
HTTPI.log = @httpi_log
|
|
50
|
+
response = @soap_driver.request :wsdl, method do |soap, wsse|
|
|
51
|
+
soap.version = @soap_version
|
|
52
|
+
soap.endpoint = @soap_endpoint
|
|
53
|
+
soap.namespaces = Hash.new
|
|
54
|
+
soap.namespaces["xmlns:soap"] = "http://www.w3.org/2003/05/soap-envelope"
|
|
55
|
+
soap.namespaces["xmlns:ins0"] = @soap_namespace
|
|
56
|
+
|
|
57
|
+
fields = { :companyCd => @companyCd }.merge!(params)
|
|
58
|
+
|
|
59
|
+
fields = order_hash(:method=>method, :fields=>fields)
|
|
60
|
+
|
|
61
|
+
soap.body = fields
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
response.to_hash["#{method}_response".to_sym][:return]
|
|
65
|
+
rescue Savon::SOAP::Fault => fault
|
|
66
|
+
response = {'error' => 'soapfault', 'message' => fault}
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
##
|
|
73
|
+
# Checks that the required params have been provided, or rasies an error
|
|
74
|
+
def check_initialization_params(params={})
|
|
75
|
+
raise ArgumentError, "You must provide Billwise connection parameters." if params.length == 0
|
|
76
|
+
%w(companyCd username password).each { |param| raise ArgumentError, "You must provide a valid #{param}." if params[param.to_sym].nil? }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
##
|
|
80
|
+
# Decamelizes a string
|
|
81
|
+
#
|
|
82
|
+
# @param [required, String] the string to be decamelized
|
|
83
|
+
# @return [String] the decamelized string
|
|
84
|
+
def decamelize(string)
|
|
85
|
+
string.gsub(/[A-Z]/) { |p| '_' + p.downcase }
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
##
|
|
89
|
+
# Order has correctly since billwise requires soap parameters be in correct order.
|
|
90
|
+
# Savon provides this functionality thru gyoku but it doesnt seem to be working in 1.9.
|
|
91
|
+
# This being the case I decided to roll my own
|
|
92
|
+
def order_hash(opts={})
|
|
93
|
+
ordered_hash={}
|
|
94
|
+
@tag_order[opts[:method].to_sym].each do |o|
|
|
95
|
+
ordered_hash.merge!(o.to_sym=>opts[:fields][o.to_sym])
|
|
96
|
+
end
|
|
97
|
+
ordered_hash
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
##
|
|
101
|
+
# Traverses the WSDL to create a hash of methods and their ordered parameters
|
|
102
|
+
# only necessary since the Billwise SOAP/XML API requires attributes in order
|
|
103
|
+
# and the Ruby MRI likes to alphabetize, so Savon allows us to set a specific
|
|
104
|
+
# order when building the XML
|
|
105
|
+
#
|
|
106
|
+
# @return [Hash] the methods and their ordered parameters
|
|
107
|
+
def tag_order
|
|
108
|
+
actions = {}
|
|
109
|
+
MultiXml.parse(@soap_driver.wsdl.xml)['definitions']['types']['schema'][3]['element'].each do |action|
|
|
110
|
+
attributes = []
|
|
111
|
+
if action['complexType']['sequence']['element'].instance_of?(Hash)
|
|
112
|
+
attributes << action['complexType']['sequence']['element']['name'].to_sym
|
|
113
|
+
else
|
|
114
|
+
action['complexType']['sequence']['element'].each { |item| attributes << item['name'].to_sym }
|
|
115
|
+
end
|
|
116
|
+
actions[decamelize(action['name']).to_sym] = attributes
|
|
117
|
+
end
|
|
118
|
+
actions
|
|
119
|
+
end
|
|
120
|
+
end
|
data/spec/billwise4r_spec.rb
CHANGED
|
@@ -4,43 +4,62 @@ describe "Billwise" do
|
|
|
4
4
|
before(:all) do
|
|
5
5
|
config = YAML.load(File.open('spec/config/config.yml'))
|
|
6
6
|
@options = config.merge!({ :log => false })
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
@billwise = Billwise.new @options
|
|
9
9
|
end
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
it "should create a Billwise object" do
|
|
12
12
|
@billwise = Billwise.new @options
|
|
13
13
|
@billwise.instance_of?(Billwise).should == true
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
it "should order the hash correctly" do
|
|
17
|
+
@billwise = Billwise.new @options
|
|
18
|
+
result = @billwise.find_invoices({:serviceId => 'A000000000046590',:customerCd => '000155', :status => 'A' })
|
|
19
|
+
result[0][:invoice_number].should == "STMNT-201005"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should find customer usage" do
|
|
23
|
+
result = @billwise.get_usage({:customerCd => '000404', :invoiceMonth => "20111101",:serviceId => 'A000000000051238'})
|
|
24
|
+
puts result
|
|
25
|
+
end
|
|
26
|
+
|
|
16
27
|
it "should raise errors if required params are not passed" do
|
|
17
28
|
begin
|
|
18
29
|
Billwise.new
|
|
19
30
|
rescue => e
|
|
20
31
|
e.to_s.should == "You must provide Billwise connection parameters."
|
|
21
32
|
end
|
|
22
|
-
|
|
33
|
+
|
|
23
34
|
begin
|
|
24
35
|
Billwise.new({ :companyCd => 100 })
|
|
25
36
|
rescue => e
|
|
26
37
|
e.to_s.should == "You must provide a valid username."
|
|
27
38
|
end
|
|
28
39
|
end
|
|
29
|
-
|
|
40
|
+
|
|
41
|
+
it "should honor timeout" do
|
|
42
|
+
begin
|
|
43
|
+
Billwise.new @options.merge!({ :timeout => 1 })
|
|
44
|
+
rescue => e
|
|
45
|
+
e.to_s.should == "Timeout was reached"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
30
49
|
it "should find a valid customer" do
|
|
31
|
-
result = @billwise.
|
|
50
|
+
result = @billwise.find_customer_entity({ :customerCd => '000155' })
|
|
32
51
|
result[:customer_cd].should == "000155"
|
|
33
52
|
end
|
|
34
|
-
|
|
53
|
+
|
|
35
54
|
it "should find that customers invoices" do
|
|
36
55
|
result = @billwise.find_invoices({ :customerCd => '000155' })
|
|
37
56
|
result[0][:invoice_number].should == "STMNT-201005"
|
|
38
57
|
end
|
|
39
|
-
|
|
58
|
+
|
|
40
59
|
it "should find services" do
|
|
41
60
|
result = @billwise.find_services({ :customerCd => '000155',
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
:serviceId => 'A000000000046590',
|
|
62
|
+
:status => 'A' })
|
|
44
63
|
result[:service_id].should == 'A000000000046590'
|
|
45
64
|
end
|
|
46
|
-
end
|
|
65
|
+
end
|
data/spec/config/config.yml
CHANGED