lolsoap 0.1.0

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.
Files changed (47) hide show
  1. data/.document +5 -0
  2. data/.travis.yml +7 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +22 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +124 -0
  8. data/Rakefile +29 -0
  9. data/VERSION +1 -0
  10. data/lib/lolsoap.rb +11 -0
  11. data/lib/lolsoap/builder.rb +93 -0
  12. data/lib/lolsoap/client.rb +25 -0
  13. data/lib/lolsoap/envelope.rb +94 -0
  14. data/lib/lolsoap/errors.rb +15 -0
  15. data/lib/lolsoap/fault.rb +26 -0
  16. data/lib/lolsoap/hash_builder.rb +48 -0
  17. data/lib/lolsoap/request.rb +54 -0
  18. data/lib/lolsoap/response.rb +50 -0
  19. data/lib/lolsoap/wsdl.rb +98 -0
  20. data/lib/lolsoap/wsdl/element.rb +28 -0
  21. data/lib/lolsoap/wsdl/null_element.rb +15 -0
  22. data/lib/lolsoap/wsdl/null_type.rb +19 -0
  23. data/lib/lolsoap/wsdl/operation.rb +18 -0
  24. data/lib/lolsoap/wsdl/type.rb +38 -0
  25. data/lib/lolsoap/wsdl_parser.rb +121 -0
  26. data/lolsoap.gemspec +97 -0
  27. data/test/fixtures/stock_quote.wsdl +74 -0
  28. data/test/fixtures/stock_quote_fault.xml +16 -0
  29. data/test/fixtures/stock_quote_response.xml +8 -0
  30. data/test/helper.rb +14 -0
  31. data/test/integration/test_client.rb +20 -0
  32. data/test/integration/test_envelope.rb +45 -0
  33. data/test/integration/test_request.rb +19 -0
  34. data/test/integration/test_response.rb +15 -0
  35. data/test/integration/test_wsdl.rb +28 -0
  36. data/test/unit/test_builder.rb +95 -0
  37. data/test/unit/test_client.rb +12 -0
  38. data/test/unit/test_envelope.rb +112 -0
  39. data/test/unit/test_fault.rb +33 -0
  40. data/test/unit/test_hash_builder.rb +127 -0
  41. data/test/unit/test_request.rb +48 -0
  42. data/test/unit/test_response.rb +39 -0
  43. data/test/unit/test_wsdl.rb +143 -0
  44. data/test/unit/test_wsdl_parser.rb +105 -0
  45. data/test/unit/wsdl/test_element.rb +31 -0
  46. data/test/unit/wsdl/test_type.rb +44 -0
  47. metadata +152 -0
@@ -0,0 +1,105 @@
1
+ require 'helper'
2
+ require 'lolsoap/wsdl_parser'
3
+
4
+ module LolSoap
5
+ describe WSDLParser do
6
+ let(:doc) { Nokogiri::XML(File.read(TEST_ROOT + '/fixtures/stock_quote.wsdl')) }
7
+ subject { WSDLParser.new(doc) }
8
+
9
+ describe '#namespaces' do
10
+ it 'returns the namespaces used' do
11
+ subject.namespaces.must_equal({
12
+ 'tns' => 'http://example.com/stockquote.wsdl',
13
+ 'xsd1' => 'http://example.com/stockquote.xsd',
14
+ 'xsd2' => 'http://example.com/stockquote2.xsd',
15
+ 'soap' => 'http://schemas.xmlsoap.org/wsdl/soap12/'
16
+ })
17
+ end
18
+ end
19
+
20
+ describe '#endpoint' do
21
+ it 'returns the SOAP 1.2 service endpoint' do
22
+ subject.endpoint.must_equal 'http://example.com/stockquote'
23
+ end
24
+ end
25
+
26
+ describe '#types' do
27
+ it 'returns the types, with attributes and namespace' do
28
+ subject.types.must_equal({
29
+ 'TradePriceRequest' => {
30
+ :name => 'TradePriceRequest',
31
+ :namespace => 'http://example.com/stockquote.xsd',
32
+ :elements => {
33
+ 'tickerSymbol' => {
34
+ :name => 'tickerSymbol',
35
+ :type => 'string',
36
+ :singular => false
37
+ },
38
+ 'specialTickerSymbol' => {
39
+ :name => 'specialTickerSymbol',
40
+ :type => 'xsd2:TickerSymbol',
41
+ :singular => false
42
+ }
43
+ }
44
+ },
45
+ 'TradePrice' => {
46
+ :name => 'TradePrice',
47
+ :namespace => 'http://example.com/stockquote.xsd',
48
+ :elements => {
49
+ 'price' => {
50
+ :name => 'price',
51
+ :type => 'float',
52
+ :singular => true
53
+ }
54
+ }
55
+ },
56
+ 'TickerSymbol' => {
57
+ :name => 'TickerSymbol',
58
+ :namespace => 'http://example.com/stockquote2.xsd',
59
+ :elements => {
60
+ 'name' => {
61
+ :name => 'name',
62
+ :type => 'string',
63
+ :singular => true
64
+ }
65
+ }
66
+ }
67
+ })
68
+ end
69
+ end
70
+
71
+ describe '#messages' do
72
+ it 'maps message names to types' do
73
+ subject.messages.must_equal({
74
+ 'GetLastTradePriceInput' => subject.types['TradePriceRequest'],
75
+ 'GetLastTradePriceOutput' => subject.types['TradePrice']
76
+ })
77
+ end
78
+ end
79
+
80
+ describe '#port_type_operations' do
81
+ it 'is a hash containing input and output types' do
82
+ subject.port_type_operations.must_equal({
83
+ 'GetLastTradePrice' => {
84
+ :name => 'GetLastTradePrice',
85
+ :input => subject.types['TradePriceRequest'],
86
+ :output => subject.types['TradePrice']
87
+ }
88
+ })
89
+ end
90
+ end
91
+
92
+ describe '#operations' do
93
+ it 'is a hash of operations with their action and input type' do
94
+ subject.operations.must_equal({
95
+ 'GetLastTradePrice' => {
96
+ :name => 'GetLastTradePrice',
97
+ :action => 'http://example.com/GetLastTradePrice',
98
+ :input => subject.types['TradePriceRequest'],
99
+ :output => subject.types['TradePrice']
100
+ }
101
+ })
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,31 @@
1
+ require 'helper'
2
+ require 'lolsoap/wsdl'
3
+
4
+ class LolSoap::WSDL
5
+ describe Element do
6
+ let(:wsdl) { OpenStruct.new }
7
+ subject { Element.new(wsdl, 'foo', 'a:WashHandsRequest', true) }
8
+
9
+ describe '#type' do
10
+ let(:wsdl) { MiniTest::Mock.new }
11
+
12
+ it 'ignores the namespace and gets the type from the wsdl' do
13
+ type = Object.new
14
+ wsdl.expect(:type, type, ['WashHandsRequest'])
15
+ subject.type.must_equal type
16
+ end
17
+ end
18
+
19
+ describe '#singular?' do
20
+ it 'returns the singular value' do
21
+ subject.singular?.must_equal true
22
+ end
23
+ end
24
+
25
+ describe '#inspect' do
26
+ it 'works' do
27
+ subject.inspect
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,44 @@
1
+ require 'helper'
2
+ require 'lolsoap/wsdl'
3
+
4
+ class LolSoap::WSDL
5
+ describe Type do
6
+ let(:wsdl) { OpenStruct.new(:prefixes => { 'http://example.com/foo' => 'foo' }) }
7
+ let(:elements) { { 'soapColor' => OpenStruct.new(:type => Object.new) } }
8
+ subject { Type.new(wsdl, 'WashHandsRequest', 'http://example.com/foo', elements) }
9
+
10
+ describe '#prefix' do
11
+ it 'returns the prefix from the WSDL doc' do
12
+ subject.prefix.must_equal 'foo'
13
+ end
14
+ end
15
+
16
+ describe '#elements' do
17
+ it 'returns a hash of all elements' do
18
+ subject.elements.must_equal(elements)
19
+ end
20
+ end
21
+
22
+ describe '#element' do
23
+ it 'returns a specific element' do
24
+ subject.element('soapColor').must_equal elements['soapColor']
25
+ end
26
+
27
+ it 'returns a null object when there is no element' do
28
+ subject.element('lol').must_equal NullElement.new
29
+ end
30
+ end
31
+
32
+ describe '#sub_type' do
33
+ it 'returns the type of a specific element' do
34
+ subject.sub_type('soapColor').must_equal elements['soapColor'].type
35
+ end
36
+ end
37
+
38
+ describe '#inspect' do
39
+ it 'works' do
40
+ subject.inspect
41
+ end
42
+ end
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lolsoap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jon Leighton
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: &11271100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *11271100
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &11269900 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *11269900
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &11284860 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.6.4
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *11284860
47
+ - !ruby/object:Gem::Dependency
48
+ name: minitest
49
+ requirement: &11283960 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *11283960
58
+ - !ruby/object:Gem::Dependency
59
+ name: yard
60
+ requirement: &11283320 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *11283320
69
+ description: A library for dealing with SOAP requests and responses. We tear our hair
70
+ out so you don't have to.
71
+ email: j@jonathanleighton.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - LICENSE.txt
76
+ - README.md
77
+ files:
78
+ - .document
79
+ - .travis.yml
80
+ - .yardopts
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - VERSION
87
+ - lib/lolsoap.rb
88
+ - lib/lolsoap/builder.rb
89
+ - lib/lolsoap/client.rb
90
+ - lib/lolsoap/envelope.rb
91
+ - lib/lolsoap/errors.rb
92
+ - lib/lolsoap/fault.rb
93
+ - lib/lolsoap/hash_builder.rb
94
+ - lib/lolsoap/request.rb
95
+ - lib/lolsoap/response.rb
96
+ - lib/lolsoap/wsdl.rb
97
+ - lib/lolsoap/wsdl/element.rb
98
+ - lib/lolsoap/wsdl/null_element.rb
99
+ - lib/lolsoap/wsdl/null_type.rb
100
+ - lib/lolsoap/wsdl/operation.rb
101
+ - lib/lolsoap/wsdl/type.rb
102
+ - lib/lolsoap/wsdl_parser.rb
103
+ - lolsoap.gemspec
104
+ - test/fixtures/stock_quote.wsdl
105
+ - test/fixtures/stock_quote_fault.xml
106
+ - test/fixtures/stock_quote_response.xml
107
+ - test/helper.rb
108
+ - test/integration/test_client.rb
109
+ - test/integration/test_envelope.rb
110
+ - test/integration/test_request.rb
111
+ - test/integration/test_response.rb
112
+ - test/integration/test_wsdl.rb
113
+ - test/unit/test_builder.rb
114
+ - test/unit/test_client.rb
115
+ - test/unit/test_envelope.rb
116
+ - test/unit/test_fault.rb
117
+ - test/unit/test_hash_builder.rb
118
+ - test/unit/test_request.rb
119
+ - test/unit/test_response.rb
120
+ - test/unit/test_wsdl.rb
121
+ - test/unit/test_wsdl_parser.rb
122
+ - test/unit/wsdl/test_element.rb
123
+ - test/unit/wsdl/test_type.rb
124
+ homepage: http://github.com/jonleighton/lolsoap
125
+ licenses:
126
+ - MIT
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ segments:
138
+ - 0
139
+ hash: -2848881825351063602
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 1.8.10
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: A library for dealing with SOAP requests and responses.
152
+ test_files: []