billwise4r 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -2
- data/billwise4r.gemspec +16 -16
- data/lib/billwise4r.rb +43 -37
- data/lib/billwise4r/version.rb +1 -1
- metadata +40 -14
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
billwise4r
|
2
2
|
==========
|
3
3
|
|
4
|
-
Gem for working with the Billwise SOAP/XML API. Ruby 1.9.x +
|
4
|
+
Gem for working with the Billwise SOAP/XML API. Ruby 1.9.x +
|
5
5
|
|
6
6
|
Examples
|
7
7
|
--------
|
@@ -20,8 +20,18 @@ Examples
|
|
20
20
|
:serviceId => 'A000000000000456',
|
21
21
|
:status => 'A' })
|
22
22
|
|
23
|
+
|
24
|
+
Optional Configution Parameters
|
25
|
+
---------
|
26
|
+
|
27
|
+
SSL verify_mode - [:peer, :fail_if_no_peer_cert, :client_once]
|
28
|
+
cert_key_file - the private key file to use
|
29
|
+
cert_key_password - the key file's password
|
30
|
+
cert_file - the certificate file to use
|
31
|
+
ca_cert_file - the ca certificate file to use
|
32
|
+
|
23
33
|
Copyright
|
24
34
|
---------
|
25
35
|
|
26
|
-
Copyright (c) 2010, 2011 Jason Goecke. See LICENSE.txt for further details.
|
36
|
+
Copyright (c) 2010, 2011 Jason Goecke & John Dyer. See LICENSE.txt for further details.
|
27
37
|
|
data/billwise4r.gemspec
CHANGED
@@ -3,29 +3,29 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
require "billwise4r/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name
|
7
|
-
s.version
|
8
|
-
s.authors
|
9
|
-
s.email
|
10
|
-
s.homepage
|
11
|
-
s.summary
|
12
|
-
s.description
|
13
|
-
s.rubygems_version
|
14
|
-
s.required_ruby_version
|
15
|
-
s.summary
|
16
|
-
s.test_files
|
6
|
+
s.name = "billwise4r"
|
7
|
+
s.version = Billwise4r::VERSION
|
8
|
+
s.authors = ["Jason Goecke","John Dyer"]
|
9
|
+
s.email = ["jason@goecke.net","johntdyer@gmail.com"]
|
10
|
+
s.homepage = %q{http://github.com/jsgoecke/billwise4r}
|
11
|
+
s.summary = %q{Ruby lib for consuming the Billwise SOAP/XML API}
|
12
|
+
s.description = %q{Ruby lib for consuming the Billwise SOAP/XML API}
|
13
|
+
s.rubygems_version = %q{1.5.0}
|
14
|
+
s.required_ruby_version = '>= 1.9'
|
15
|
+
s.summary = %q{Ruby lib for consuming the Billwise SOAP/XML API}
|
16
|
+
s.test_files = [
|
17
17
|
"spec/billwise4r_spec.rb",
|
18
18
|
"spec/spec_helper.rb",
|
19
19
|
"spec/connect_sm_service.wsdl",
|
20
20
|
"spec/config/config.yml"
|
21
21
|
]
|
22
22
|
|
23
|
-
s.rubyforge_project
|
23
|
+
s.rubyforge_project = "billwise4r"
|
24
24
|
|
25
|
-
s.files
|
26
|
-
s.test_files
|
27
|
-
s.executables
|
28
|
-
s.require_paths
|
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"]
|
29
29
|
|
30
30
|
s.add_development_dependency "rspec"
|
31
31
|
s.add_development_dependency "fakeweb"
|
data/lib/billwise4r.rb
CHANGED
@@ -10,33 +10,39 @@ class Billwise
|
|
10
10
|
# Make sure all params we need are here or raise an error
|
11
11
|
check_initialization_params(params)
|
12
12
|
|
13
|
-
@companyCd
|
14
|
-
log
|
15
|
-
log_level
|
16
|
-
@httpi_log
|
13
|
+
@companyCd = params[:companyCd]
|
14
|
+
log = params[:log] || false
|
15
|
+
log_level = params[:log_level] || :info
|
16
|
+
@httpi_log = params[:httpi_log] || false
|
17
|
+
@ssl_verify_mode = params[:verify_mode] || "peer".to_sym
|
18
|
+
@read_timeout = params[:read_timeout] || 300
|
17
19
|
|
18
20
|
Savon.configure do |config|
|
19
|
-
config.log
|
20
|
-
config.log_level
|
21
|
-
config.env_namespace
|
21
|
+
config.log = log
|
22
|
+
config.log_level = log_level
|
23
|
+
config.env_namespace = :soap
|
22
24
|
end
|
23
25
|
|
24
|
-
@soap_endpoint
|
25
|
-
@soap_namespace
|
26
|
-
|
27
|
-
@soap_version = 2
|
26
|
+
@soap_endpoint = URI.parse params[:endpoint] || 'https://cwa021.connect4billing.com:8443/axis2/services/ConnectSmService.ConnectSmServiceHttpSoap12Endpoint/'
|
27
|
+
@soap_namespace = params[:namespace] || 'http://connectsm.ws.bwse.com/xsd'
|
28
|
+
@soap_version = 2
|
28
29
|
|
29
30
|
# Build our SOAP driver
|
30
31
|
@soap_driver = Savon::Client.new do
|
31
|
-
wsse.credentials
|
32
|
+
wsse.credentials params[:username] , params[:password]
|
32
33
|
wsdl.document = 'https://cwa021.connect4billing.com:8443/axis2/services/ConnectSmService?wsdl'
|
33
|
-
|
34
34
|
end
|
35
|
-
@soap_driver.http.read_timeout = 300
|
36
35
|
|
37
|
-
@
|
36
|
+
@soap_driver.http.read_timeout = @read_timeout
|
37
|
+
@soap_driver.http.auth.ssl.verify_mode = @ssl_verify_mode # or one of [:peer, :fail_if_no_peer_cert, :client_once]
|
38
|
+
@soap_driver.http.auth.ssl.cert_key_file = params[:cert_key_file] if params[:cert_key_file] # the private key file to use
|
39
|
+
@soap_driver.http.auth.ssl.cert_key_password = params[:cert_key_password] if params[:cert_key_password] # the key file's password
|
40
|
+
@soap_driver.http.auth.ssl.cert_file = params[:cert_file] if params[:cert_file] # the certificate file to use
|
41
|
+
@soap_driver.http.auth.ssl.ca_cert_file = params[:ca_cert_file] if params[:ca_cert_file] # the ca certificate file to use
|
42
|
+
|
43
|
+
@tag_order = tag_order
|
38
44
|
|
39
|
-
MultiXml.parser
|
45
|
+
MultiXml.parser = :nokogiri
|
40
46
|
end
|
41
47
|
|
42
48
|
##
|
@@ -48,11 +54,11 @@ class Billwise
|
|
48
54
|
begin
|
49
55
|
HTTPI.log = @httpi_log
|
50
56
|
response = @soap_driver.request :wsdl, method do |soap, wsse|
|
51
|
-
soap.version
|
52
|
-
soap.endpoint
|
53
|
-
soap.namespaces
|
54
|
-
soap.namespaces["xmlns:soap"]
|
55
|
-
soap.namespaces["xmlns:ins0"]
|
57
|
+
soap.version = @soap_version
|
58
|
+
soap.endpoint = @soap_endpoint
|
59
|
+
soap.namespaces = Hash.new
|
60
|
+
soap.namespaces["xmlns:soap"] = "http://www.w3.org/2003/05/soap-envelope"
|
61
|
+
soap.namespaces["xmlns:ins0"] = @soap_namespace
|
56
62
|
|
57
63
|
fields = { :companyCd => @companyCd }.merge!(params)
|
58
64
|
|
@@ -69,22 +75,6 @@ class Billwise
|
|
69
75
|
|
70
76
|
private
|
71
77
|
|
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
78
|
##
|
89
79
|
# Order has correctly since billwise requires soap parameters be in correct order.
|
90
80
|
# Savon provides this functionality thru gyoku but it doesnt seem to be working in 1.9.
|
@@ -117,4 +107,20 @@ class Billwise
|
|
117
107
|
end
|
118
108
|
actions
|
119
109
|
end
|
110
|
+
##
|
111
|
+
# Checks that the required params have been provided, or rasies an error
|
112
|
+
def check_initialization_params(params={})
|
113
|
+
raise ArgumentError, "You must provide Billwise connection parameters." if params.length == 0
|
114
|
+
%w(companyCd username password).each { |param| raise ArgumentError, "You must provide a valid #{param}." if params[param.to_sym].nil? }
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Decamelizes a string
|
119
|
+
#
|
120
|
+
# @param [required, String] the string to be decamelized
|
121
|
+
# @return [String] the decamelized string
|
122
|
+
def decamelize(string)
|
123
|
+
string.gsub(/[A-Z]/) { |p| '_' + p.downcase }
|
124
|
+
end
|
125
|
+
|
120
126
|
end
|
data/lib/billwise4r/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: billwise4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: fakeweb
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: '0'
|
34
39
|
type: :development
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: awesome_print
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: '0'
|
45
55
|
type: :development
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: savon
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,10 +70,15 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :runtime
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: multi_xml
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
@@ -66,11 +86,16 @@ dependencies:
|
|
66
86
|
version: '0'
|
67
87
|
type: :runtime
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
70
95
|
description: Ruby lib for consuming the Billwise SOAP/XML API
|
71
96
|
email:
|
72
97
|
- jason@goecke.net
|
73
|
-
-
|
98
|
+
- johntdyer@gmail.com
|
74
99
|
executables: []
|
75
100
|
extensions: []
|
76
101
|
extra_rdoc_files: []
|
@@ -110,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
135
|
version: '0'
|
111
136
|
requirements: []
|
112
137
|
rubyforge_project: billwise4r
|
113
|
-
rubygems_version: 1.8.
|
138
|
+
rubygems_version: 1.8.24
|
114
139
|
signing_key:
|
115
140
|
specification_version: 3
|
116
141
|
summary: Ruby lib for consuming the Billwise SOAP/XML API
|
@@ -119,3 +144,4 @@ test_files:
|
|
119
144
|
- spec/config/config.yml
|
120
145
|
- spec/connect_sm_service.wsdl
|
121
146
|
- spec/spec_helper.rb
|
147
|
+
has_rdoc:
|