soaspec 0.0.84 → 0.0.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +15 -15
- data/.gitlab-ci.yml +31 -31
- data/.rspec +3 -3
- data/.rubocop.yml +2 -2
- data/.travis.yml +5 -5
- data/CODE_OF_CONDUCT.md +74 -74
- data/ChangeLog +358 -354
- data/Gemfile +6 -6
- data/LICENSE.txt +21 -21
- data/README.md +85 -85
- data/Rakefile +24 -24
- data/Todo.md +6 -6
- data/exe/soaspec +123 -123
- data/exe/soaspec-virtual-server +98 -98
- data/exe/xml_to_yaml_file +60 -60
- data/lib/soaspec.rb +73 -73
- data/lib/soaspec/core_ext/hash.rb +83 -83
- data/lib/soaspec/exchange.rb +234 -234
- data/lib/soaspec/exchange_handlers/exchange_handler.rb +103 -103
- data/lib/soaspec/exchange_handlers/handler_accessors.rb +106 -106
- data/lib/soaspec/exchange_handlers/rest_accessors.rb +83 -83
- data/lib/soaspec/exchange_handlers/rest_handler.rb +296 -296
- data/lib/soaspec/exchange_handlers/rest_methods.rb +44 -44
- data/lib/soaspec/exchange_handlers/soap_handler.rb +236 -236
- data/lib/soaspec/exe_helpers.rb +56 -56
- data/lib/soaspec/generator/.rspec.erb +5 -5
- data/lib/soaspec/generator/.travis.yml.erb +5 -5
- data/lib/soaspec/generator/Gemfile.erb +8 -8
- data/lib/soaspec/generator/README.md.erb +29 -29
- data/lib/soaspec/generator/Rakefile.erb +19 -19
- data/lib/soaspec/generator/config/data/default.yml.erb +1 -1
- data/lib/soaspec/generator/lib/blz_service.rb.erb +26 -26
- data/lib/soaspec/generator/lib/dynamic_class_content.rb.erb +12 -12
- data/lib/soaspec/generator/lib/shared_example.rb.erb +8 -8
- data/lib/soaspec/generator/spec/dynamic_soap_spec.rb.erb +12 -12
- data/lib/soaspec/generator/spec/soap_spec.rb.erb +51 -51
- data/lib/soaspec/generator/spec/spec_helper.rb.erb +20 -20
- data/lib/soaspec/generator/template/soap_template.xml +6 -6
- data/lib/soaspec/interpreter.rb +40 -35
- data/lib/soaspec/matchers.rb +65 -65
- data/lib/soaspec/not_found_errors.rb +13 -13
- data/lib/soaspec/soaspec_shared_examples.rb +24 -24
- data/lib/soaspec/spec_logger.rb +27 -27
- data/lib/soaspec/test_server/bank.wsdl +90 -90
- data/lib/soaspec/test_server/get_bank.rb +160 -160
- data/lib/soaspec/test_server/invoices.rb +27 -27
- data/lib/soaspec/test_server/namespace.xml +14 -14
- data/lib/soaspec/test_server/note.xml +5 -5
- data/lib/soaspec/test_server/puppy_service.rb +20 -20
- data/lib/soaspec/test_server/test_attribute.rb +13 -13
- data/lib/soaspec/version.rb +2 -2
- data/lib/soaspec/wsdl_generator.rb +93 -93
- data/soaspec.gemspec +45 -45
- data/test.wsdl +116 -116
- data/test.xml +10 -10
- data/test_rest.rb +97 -97
- data/test_wsdl.rb +43 -43
- metadata +2 -2
data/test.xml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
|
3
|
-
<note
|
4
|
-
xmlns="https://www.w3schools.com"
|
5
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
6
|
-
xsi:schemaLocation="https://www.w3schools.com/xml/note.xsd">
|
7
|
-
<to>Tove</to>
|
8
|
-
<from>123.2</from>
|
9
|
-
<heading>Reminder</heading>
|
10
|
-
<body>Don't forget me this weekend!</body>
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<note
|
4
|
+
xmlns="https://www.w3schools.com"
|
5
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
6
|
+
xsi:schemaLocation="https://www.w3schools.com/xml/note.xsd">
|
7
|
+
<to>Tove</to>
|
8
|
+
<from>123.2</from>
|
9
|
+
<heading>Reminder</heading>
|
10
|
+
<body>Don't forget me this weekend!</body>
|
11
11
|
</note>
|
data/test_rest.rb
CHANGED
@@ -1,98 +1,98 @@
|
|
1
|
-
|
2
|
-
require 'rest-client'
|
3
|
-
require 'json'
|
4
|
-
require 'data_magic'
|
5
|
-
|
6
|
-
options = {
|
7
|
-
headers: {
|
8
|
-
# accept: "application/xml",
|
9
|
-
accept: "application/json",
|
10
|
-
content_type: "application/json"
|
11
|
-
# log: Logger.new('logs/traffic.log')
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
RestClient.log = Logger.new('logs/traffic.log')
|
16
|
-
|
17
|
-
data_string = <<-EOF
|
18
|
-
{
|
19
|
-
"id": 1,
|
20
|
-
"category": {
|
21
|
-
"id": 1,
|
22
|
-
"name": "string"
|
23
|
-
},
|
24
|
-
"name": "test_rest",
|
25
|
-
"photoUrls": [
|
26
|
-
"string"
|
27
|
-
],
|
28
|
-
"tags": [
|
29
|
-
{
|
30
|
-
"id": 1,
|
31
|
-
"name": "string"
|
32
|
-
}
|
33
|
-
],
|
34
|
-
"status": "sold"
|
35
|
-
}
|
36
|
-
EOF
|
37
|
-
|
38
|
-
|
39
|
-
data = {
|
40
|
-
'id' => '1',
|
41
|
-
'category' => {
|
42
|
-
'id' => '1',
|
43
|
-
'name' => "string"
|
44
|
-
},
|
45
|
-
'name' => "test_rest",
|
46
|
-
'photoUrls' => [
|
47
|
-
"string"
|
48
|
-
],
|
49
|
-
'tags' => [
|
50
|
-
{
|
51
|
-
'id' => '1',
|
52
|
-
'name' => "string"
|
53
|
-
}
|
54
|
-
],
|
55
|
-
'status' => "sold"
|
56
|
-
}
|
57
|
-
|
58
|
-
# puts data.to_s
|
59
|
-
#
|
60
|
-
|
61
|
-
include DataMagic
|
62
|
-
|
63
|
-
id = '1'
|
64
|
-
default = data_for 'default/pet'
|
65
|
-
merged_result = default.merge({ 'id' => id })
|
66
|
-
|
67
|
-
#converted_data = JSON.generate(data).to_s
|
68
|
-
converted_data = JSON.generate(merged_result).to_s
|
69
|
-
|
70
|
-
puts converted_data
|
71
|
-
# puts 'data'
|
72
|
-
# puts data_string
|
73
|
-
|
74
|
-
resource = RestClient::Resource.new('http://petstore.swagger.io/v2', options)
|
75
|
-
# begin
|
76
|
-
# response = resource['pet'].post(data)
|
77
|
-
# rescue RestClient::ExceptionWithResponse => e
|
78
|
-
# puts e.response
|
79
|
-
# end
|
80
|
-
|
81
|
-
begin
|
82
|
-
#response = resource['store/order/1'].get
|
83
|
-
#response = resource['store/inventory'].get
|
84
|
-
#
|
85
|
-
#response = resource['pet/findByStatus?status=sold'].get(accept: 'application/xml')
|
86
|
-
|
87
|
-
|
88
|
-
#response = resource['pet'].post(data_string)
|
89
|
-
#response = resource['pet'].post(converted_data)
|
90
|
-
response = resource['pet/' + id].get
|
91
|
-
#response = resource['pet/' + id].delete
|
92
|
-
rescue RestClient::ExceptionWithResponse => e
|
93
|
-
puts e.response
|
94
|
-
end
|
95
|
-
|
96
|
-
puts response.body
|
97
|
-
puts response.code
|
1
|
+
|
2
|
+
require 'rest-client'
|
3
|
+
require 'json'
|
4
|
+
require 'data_magic'
|
5
|
+
|
6
|
+
options = {
|
7
|
+
headers: {
|
8
|
+
# accept: "application/xml",
|
9
|
+
accept: "application/json",
|
10
|
+
content_type: "application/json"
|
11
|
+
# log: Logger.new('logs/traffic.log')
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
RestClient.log = Logger.new('logs/traffic.log')
|
16
|
+
|
17
|
+
data_string = <<-EOF
|
18
|
+
{
|
19
|
+
"id": 1,
|
20
|
+
"category": {
|
21
|
+
"id": 1,
|
22
|
+
"name": "string"
|
23
|
+
},
|
24
|
+
"name": "test_rest",
|
25
|
+
"photoUrls": [
|
26
|
+
"string"
|
27
|
+
],
|
28
|
+
"tags": [
|
29
|
+
{
|
30
|
+
"id": 1,
|
31
|
+
"name": "string"
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"status": "sold"
|
35
|
+
}
|
36
|
+
EOF
|
37
|
+
|
38
|
+
|
39
|
+
data = {
|
40
|
+
'id' => '1',
|
41
|
+
'category' => {
|
42
|
+
'id' => '1',
|
43
|
+
'name' => "string"
|
44
|
+
},
|
45
|
+
'name' => "test_rest",
|
46
|
+
'photoUrls' => [
|
47
|
+
"string"
|
48
|
+
],
|
49
|
+
'tags' => [
|
50
|
+
{
|
51
|
+
'id' => '1',
|
52
|
+
'name' => "string"
|
53
|
+
}
|
54
|
+
],
|
55
|
+
'status' => "sold"
|
56
|
+
}
|
57
|
+
|
58
|
+
# puts data.to_s
|
59
|
+
#
|
60
|
+
|
61
|
+
include DataMagic
|
62
|
+
|
63
|
+
id = '1'
|
64
|
+
default = data_for 'default/pet'
|
65
|
+
merged_result = default.merge({ 'id' => id })
|
66
|
+
|
67
|
+
#converted_data = JSON.generate(data).to_s
|
68
|
+
converted_data = JSON.generate(merged_result).to_s
|
69
|
+
|
70
|
+
puts converted_data
|
71
|
+
# puts 'data'
|
72
|
+
# puts data_string
|
73
|
+
|
74
|
+
resource = RestClient::Resource.new('http://petstore.swagger.io/v2', options)
|
75
|
+
# begin
|
76
|
+
# response = resource['pet'].post(data)
|
77
|
+
# rescue RestClient::ExceptionWithResponse => e
|
78
|
+
# puts e.response
|
79
|
+
# end
|
80
|
+
|
81
|
+
begin
|
82
|
+
#response = resource['store/order/1'].get
|
83
|
+
#response = resource['store/inventory'].get
|
84
|
+
#
|
85
|
+
#response = resource['pet/findByStatus?status=sold'].get(accept: 'application/xml')
|
86
|
+
|
87
|
+
|
88
|
+
#response = resource['pet'].post(data_string)
|
89
|
+
#response = resource['pet'].post(converted_data)
|
90
|
+
response = resource['pet/' + id].get
|
91
|
+
#response = resource['pet/' + id].delete
|
92
|
+
rescue RestClient::ExceptionWithResponse => e
|
93
|
+
puts e.response
|
94
|
+
end
|
95
|
+
|
96
|
+
puts response.body
|
97
|
+
puts response.code
|
98
98
|
puts response.request
|
data/test_wsdl.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
|
2
|
-
require 'wasabi'
|
3
|
-
require 'savon'
|
4
|
-
|
5
|
-
|
6
|
-
#document = Savon.client(wsdl: 'test.wsdl').wsdl
|
7
|
-
#document = Savon.client(wsdl: 'http://www.webservicex.com/globalweather.asmx?wsdl').wsdl
|
8
|
-
#document = Wasabi.document File.read('test.wsdl')
|
9
|
-
document = Wasabi.document 'http://www.webservicex.net/ConvertTemperature.asmx?WSDL'
|
10
|
-
parser = document.parser
|
11
|
-
|
12
|
-
|
13
|
-
# TEST SCHEMA
|
14
|
-
#
|
15
|
-
# parser.schemas.each do |schema|
|
16
|
-
# puts 'SCHEMA * '
|
17
|
-
# puts schema
|
18
|
-
#
|
19
|
-
# xsd = Nokogiri::XML::Schema(schema.to_s)
|
20
|
-
#
|
21
|
-
# doc = Nokogiri::XML(File.read('test.xml'))
|
22
|
-
#
|
23
|
-
# xsd.validate(doc).each do |error|
|
24
|
-
# puts error.message
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
#
|
28
|
-
|
29
|
-
schemes = parser.schemas
|
30
|
-
puts schemes
|
31
|
-
custom_type = schemes.xpath("//*[@name='TemperatureUnit']")
|
32
|
-
if custom_type.first
|
33
|
-
puts 'CUST' + custom_type.to_s
|
34
|
-
prefix = custom_type.first.namespace.prefix
|
35
|
-
puts prefix
|
36
|
-
|
37
|
-
enumerations = custom_type.xpath("//#{prefix}:enumeration")
|
38
|
-
|
39
|
-
puts 'ENUM' + enumerations.to_s
|
40
|
-
|
41
|
-
enumerations.each do |enum_value|
|
42
|
-
puts enum_value['value']
|
43
|
-
end
|
1
|
+
|
2
|
+
require 'wasabi'
|
3
|
+
require 'savon'
|
4
|
+
|
5
|
+
|
6
|
+
#document = Savon.client(wsdl: 'test.wsdl').wsdl
|
7
|
+
#document = Savon.client(wsdl: 'http://www.webservicex.com/globalweather.asmx?wsdl').wsdl
|
8
|
+
#document = Wasabi.document File.read('test.wsdl')
|
9
|
+
document = Wasabi.document 'http://www.webservicex.net/ConvertTemperature.asmx?WSDL'
|
10
|
+
parser = document.parser
|
11
|
+
|
12
|
+
|
13
|
+
# TEST SCHEMA
|
14
|
+
#
|
15
|
+
# parser.schemas.each do |schema|
|
16
|
+
# puts 'SCHEMA * '
|
17
|
+
# puts schema
|
18
|
+
#
|
19
|
+
# xsd = Nokogiri::XML::Schema(schema.to_s)
|
20
|
+
#
|
21
|
+
# doc = Nokogiri::XML(File.read('test.xml'))
|
22
|
+
#
|
23
|
+
# xsd.validate(doc).each do |error|
|
24
|
+
# puts error.message
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
|
29
|
+
schemes = parser.schemas
|
30
|
+
puts schemes
|
31
|
+
custom_type = schemes.xpath("//*[@name='TemperatureUnit']")
|
32
|
+
if custom_type.first
|
33
|
+
puts 'CUST' + custom_type.to_s
|
34
|
+
prefix = custom_type.first.namespace.prefix
|
35
|
+
puts prefix
|
36
|
+
|
37
|
+
enumerations = custom_type.xpath("//#{prefix}:enumeration")
|
38
|
+
|
39
|
+
puts 'ENUM' + enumerations.to_s
|
40
|
+
|
41
|
+
enumerations.each do |enum_value|
|
42
|
+
puts enum_value['value']
|
43
|
+
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
@@ -365,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
365
365
|
version: '0'
|
366
366
|
requirements: []
|
367
367
|
rubyforge_project:
|
368
|
-
rubygems_version: 2.6
|
368
|
+
rubygems_version: 2.7.6
|
369
369
|
signing_key:
|
370
370
|
specification_version: 4
|
371
371
|
summary: Helps to create RSpec specs for 'SOAP' or 'REST' apis
|