soaspec 0.0.81 → 0.0.82

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +15 -15
  3. data/.gitlab-ci.yml +31 -31
  4. data/.rspec +3 -3
  5. data/.rubocop.yml +2 -2
  6. data/.travis.yml +5 -5
  7. data/CODE_OF_CONDUCT.md +74 -74
  8. data/ChangeLog +345 -341
  9. data/Gemfile +6 -6
  10. data/LICENSE.txt +21 -21
  11. data/README.md +85 -85
  12. data/Rakefile +24 -24
  13. data/Todo.md +6 -6
  14. data/exe/soaspec +123 -123
  15. data/exe/soaspec-virtual-server +98 -92
  16. data/exe/xml_to_yaml_file +60 -60
  17. data/lib/soaspec.rb +86 -85
  18. data/lib/soaspec/core_ext/hash.rb +83 -83
  19. data/lib/soaspec/exchange.rb +230 -230
  20. data/lib/soaspec/exchange_handlers/exchange_handler.rb +98 -98
  21. data/lib/soaspec/exchange_handlers/handler_accessors.rb +95 -95
  22. data/lib/soaspec/exchange_handlers/rest_handler.rb +367 -367
  23. data/lib/soaspec/exchange_handlers/rest_methods.rb +44 -44
  24. data/lib/soaspec/exchange_handlers/soap_handler.rb +231 -231
  25. data/lib/soaspec/exe_helpers.rb +56 -56
  26. data/lib/soaspec/generator/.rspec.erb +5 -5
  27. data/lib/soaspec/generator/.travis.yml.erb +5 -5
  28. data/lib/soaspec/generator/Gemfile.erb +8 -8
  29. data/lib/soaspec/generator/README.md.erb +29 -29
  30. data/lib/soaspec/generator/Rakefile.erb +19 -19
  31. data/lib/soaspec/generator/config/data/default.yml.erb +1 -1
  32. data/lib/soaspec/generator/lib/blz_service.rb.erb +24 -24
  33. data/lib/soaspec/generator/lib/dynamic_class_content.rb.erb +12 -12
  34. data/lib/soaspec/generator/lib/shared_example.rb.erb +8 -8
  35. data/lib/soaspec/generator/spec/dynamic_soap_spec.rb.erb +14 -14
  36. data/lib/soaspec/generator/spec/soap_spec.rb.erb +53 -53
  37. data/lib/soaspec/generator/spec/spec_helper.rb.erb +20 -20
  38. data/lib/soaspec/generator/template/soap_template.xml +6 -6
  39. data/lib/soaspec/interpreter.rb +25 -25
  40. data/lib/soaspec/matchers.rb +65 -65
  41. data/lib/soaspec/not_found_errors.rb +13 -13
  42. data/lib/soaspec/soaspec_shared_examples.rb +24 -24
  43. data/lib/soaspec/spec_logger.rb +27 -27
  44. data/lib/soaspec/test_server/bank.wsdl +90 -90
  45. data/lib/soaspec/test_server/get_bank.rb +160 -160
  46. data/lib/soaspec/test_server/invoices.rb +27 -27
  47. data/lib/soaspec/test_server/namespace.xml +15 -0
  48. data/lib/soaspec/test_server/note.xml +5 -5
  49. data/lib/soaspec/test_server/puppy_service.rb +20 -20
  50. data/lib/soaspec/test_server/test_attribute.rb +13 -13
  51. data/lib/soaspec/test_server/test_namespace.rb +13 -0
  52. data/lib/soaspec/version.rb +2 -2
  53. data/lib/soaspec/wsdl_generator.rb +93 -93
  54. data/soaspec.gemspec +45 -45
  55. data/test.wsdl +116 -116
  56. data/test.xml +10 -10
  57. data/test_rest.rb +97 -97
  58. data/test_wsdl.rb +43 -43
  59. metadata +5 -3
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.81
4
+ version: 0.0.82
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-01 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -332,9 +332,11 @@ files:
332
332
  - lib/soaspec/test_server/bank.wsdl
333
333
  - lib/soaspec/test_server/get_bank.rb
334
334
  - lib/soaspec/test_server/invoices.rb
335
+ - lib/soaspec/test_server/namespace.xml
335
336
  - lib/soaspec/test_server/note.xml
336
337
  - lib/soaspec/test_server/puppy_service.rb
337
338
  - lib/soaspec/test_server/test_attribute.rb
339
+ - lib/soaspec/test_server/test_namespace.rb
338
340
  - lib/soaspec/version.rb
339
341
  - lib/soaspec/wsdl_generator.rb
340
342
  - soaspec.gemspec
@@ -362,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
364
  version: '0'
363
365
  requirements: []
364
366
  rubyforge_project:
365
- rubygems_version: 2.6.14
367
+ rubygems_version: 2.7.6
366
368
  signing_key:
367
369
  specification_version: 4
368
370
  summary: Helps to create RSpec specs for 'SOAP' or 'REST' apis