soaspec 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -1
- data/exe/soaspec-init +3 -3
- data/exe/xml_to_yaml_file +56 -0
- data/lib/soaspec/version.rb +1 -1
- data/soaspec.gemspec +1 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeb96e8acb8549f09c9b3b11592a6d1642c0ce16
|
4
|
+
data.tar.gz: caee64c3c1c13dc5853c909aae35f4916ebe99ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a110b3ac2c135c9d8d72fe11feffe991394242c95de3f32f59396d1bb8b50789e6c8d52fb158b3142d1a91c5320705c494a81a80b82da11383abd99b0d252465
|
7
|
+
data.tar.gz: 7a411ac7056a140ed6287184a07d4c43851256cfe71039ce08c65517b2bdfeb3b03b156c302dc29b4c56986fd5e3f2783f4e1cfbf7bb00ac9ec59b13125be7f3
|
data/ChangeLog
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
soaspec (0.0.
|
4
|
+
soaspec (0.0.12)
|
5
5
|
rest-client (>= 2.0)
|
6
6
|
rspec (~> 3.0)
|
7
7
|
rspec-its (>= 1.2.0)
|
8
8
|
savon (>= 2)
|
9
|
+
xml-simple (>= 1.1.5)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
@@ -81,6 +82,7 @@ GEM
|
|
81
82
|
wasabi (3.5.0)
|
82
83
|
httpi (~> 2.0)
|
83
84
|
nokogiri (>= 1.4.2)
|
85
|
+
xml-simple (1.1.5)
|
84
86
|
|
85
87
|
PLATFORMS
|
86
88
|
ruby
|
@@ -97,6 +99,7 @@ DEPENDENCIES
|
|
97
99
|
rspec_junit_formatter
|
98
100
|
savon
|
99
101
|
soaspec!
|
102
|
+
xml-simple
|
100
103
|
|
101
104
|
BUNDLED WITH
|
102
105
|
1.16.0
|
data/exe/soaspec-init
CHANGED
@@ -5,13 +5,13 @@ require 'fileutils'
|
|
5
5
|
|
6
6
|
def create_file(options)
|
7
7
|
filename = options[:filename]
|
8
|
-
|
8
|
+
raise 'Need to pass filename' unless filename
|
9
9
|
content = options[:content]
|
10
|
-
|
10
|
+
raise 'Need to pass contents to insert into file' unless content
|
11
11
|
if File.exist? filename
|
12
12
|
old_content = File.read(filename)
|
13
13
|
if old_content != content
|
14
|
-
|
14
|
+
warn "!! #{filename} already exists and differs from template"
|
15
15
|
end
|
16
16
|
else
|
17
17
|
File.open(filename, 'w') do |f|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
require 'xmlsimple'
|
3
|
+
require 'yaml'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
default_output_file = 'output.yml'
|
7
|
+
|
8
|
+
# Create file if not present. If present but different give warning
|
9
|
+
def create_file(options)
|
10
|
+
filename = options[:filename]
|
11
|
+
raise 'Need to pass filename' unless filename
|
12
|
+
content = options[:content]
|
13
|
+
raise 'Need to pass contents to insert into file' unless content
|
14
|
+
if File.exist? filename
|
15
|
+
old_content = File.read(filename)
|
16
|
+
if old_content != content
|
17
|
+
warn "!! #{filename} already exists and differs from template"
|
18
|
+
end
|
19
|
+
else
|
20
|
+
File.open(filename, 'w') do |f|
|
21
|
+
f.puts content
|
22
|
+
end
|
23
|
+
puts 'Created: ' + filename
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Convert key in camelcase to underscore separated (snakecase)
|
28
|
+
def underscore_key(key)
|
29
|
+
key.to_s.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
30
|
+
.gsub(/([a-z\d])([A-Z])/,'\1_\2')
|
31
|
+
.tr('-', '_')
|
32
|
+
.gsub(/\s/, '_')
|
33
|
+
.gsub(/__+/, '_')
|
34
|
+
.downcase
|
35
|
+
end
|
36
|
+
|
37
|
+
# For all keys in a Hash, convert Camelcase to underscore separated
|
38
|
+
def convert_hash_keys(value)
|
39
|
+
case value
|
40
|
+
when Array
|
41
|
+
value.map { |v| convert_hash_keys(v) }
|
42
|
+
when Hash
|
43
|
+
Hash[value.map { |k, v| [underscore_key(k), convert_hash_keys(v)] }]
|
44
|
+
else
|
45
|
+
value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
if ARGV[0]
|
50
|
+
warn "Using '#{default_output_file}' as default output file since no 2nd argument passed" unless ARGV[1]
|
51
|
+
hash = XmlSimple.xml_in(ARGV[0])
|
52
|
+
converted = convert_hash_keys hash
|
53
|
+
create_file(filename: ARGV[1] || default_output_file, content: converted.to_yaml)
|
54
|
+
else
|
55
|
+
puts 'usage: xml_to_yaml_file [input.xml] [output.yml] '
|
56
|
+
end
|
data/lib/soaspec/version.rb
CHANGED
data/soaspec.gemspec
CHANGED
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.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,12 +108,27 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: xml-simple
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.1.5
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.1.5
|
111
125
|
description: "Helps to create RSpec specs for SOAP or REST apis. Easily represent
|
112
126
|
multiple requests with\nthe same configuration "
|
113
127
|
email:
|
114
128
|
- samuel.garratt@integrationqa.com
|
115
129
|
executables:
|
116
130
|
- soaspec-init
|
131
|
+
- xml_to_yaml_file
|
117
132
|
extensions: []
|
118
133
|
extra_rdoc_files: []
|
119
134
|
files:
|
@@ -130,6 +145,7 @@ files:
|
|
130
145
|
- bin/console
|
131
146
|
- bin/setup
|
132
147
|
- exe/soaspec-init
|
148
|
+
- exe/xml_to_yaml_file
|
133
149
|
- lib/soaspec.rb
|
134
150
|
- lib/soaspec/basic_soap_handler.rb
|
135
151
|
- lib/soaspec/exchange.rb
|