savon_fixes 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 888babf4e141a22f9c8ba15dbb4a5d1c73e17c86f99ca1a6b0f91a45b2a7436c
4
+ data.tar.gz: 3fa7dc891e9ee8988e053081082e8b98c144eca616cd4ffeb19ed1c88ffdb152
5
+ SHA512:
6
+ metadata.gz: abcde0499b8f7b631ede1bae4f3a663a6a83b2b2b5eb72735abc687ead7689545ff4a50a09b86b2dbfc811fe32346e5f4f2ad811bbfdfd388035430279f899f0
7
+ data.tar.gz: 2dd079edb7ccc316ebce1e2fb866377c40357e6e21a76c358102f25a994be27e168630e59912c5f33653793732bbb002897da8cf5bbf17c31416868c5957500a
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # From Savon
6
+ gem "httpclient", "~> 2.7.1"
7
+
8
+ gem "simplecov", :require => false
9
+ gem "coveralls", :require => false
10
+
11
+ platform :rbx do
12
+ gem 'racc'
13
+ gem 'rubysl'
14
+ gem 'rubinius-coverage'
15
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Lukas Oberhuber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,27 @@
1
+ # Savon_fixes
2
+
3
+ This gem has been designed to be included if you require some of the open PRs on Savon and cannot upgrade the gem because of them.
4
+
5
+ ![Build](https://github.com/lukaso/savon_fixes/workflows/Build/badge.svg)
6
+
7
+ # What does it do?
8
+
9
+ It monkey patches the Savon 2.12.0 version of the gem (will not work with other versions). This should not be a problem as it has been well over two years as of May 2020 since this version was release (17 Jan 2018).
10
+
11
+ # Usage
12
+
13
+ Add in your `Gemfile`
14
+
15
+ ```ruby
16
+ gem 'savon_fixes'
17
+ ```
18
+
19
+ # PRs incorporated and bugs fixed
20
+
21
+ Currently there is only one fix incorporated. There are many issues filed against this problem as the stalebot shuts them all down.
22
+
23
+ - Bugs related to namespacing [#916](https://github.com/savonrb/savon/issues/916), [#899](https://github.com/savonrb/savon/issues/899), [#820](https://github.com/savonrb/savon/issues/820), [#895](https://github.com/savonrb/savon/issues/895) and [#862](https://github.com/savonrb/savon/issues/862) which were all fixed by [#917](https://github.com/savonrb/savon/pull/917)
24
+
25
+ # Contributing
26
+
27
+ Please create PR and follow the monkey patching approach already taken. Also please ensure there is a working test for your fix and that all the tests continue to pass.
@@ -0,0 +1,17 @@
1
+ task :default => :test
2
+
3
+ desc "Run tests"
4
+ task :test => [:spec, :savon_spec]
5
+
6
+ begin
7
+ require 'rspec/core/rake_task'
8
+ gem_dir = Gem::Specification.find_by_name('savon').gem_dir
9
+ # Skip failing integration tests
10
+ pattern = Dir.glob(File.join(gem_dir, 'spec/savon/**/*_spec.rb')) +
11
+ [File.join(gem_dir, "spec/integration/zipcode_example_spec.rb")]
12
+ RSpec::Core::RakeTask.new(:spec)
13
+ RSpec::Core::RakeTask.new(:savon_spec) do |t|
14
+ t.pattern = pattern
15
+ end
16
+ rescue LoadError
17
+ end
@@ -0,0 +1,4 @@
1
+ require 'savon_fixes/savon/qualified_message'
2
+
3
+ module SavonFixes
4
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Monkey patches to_hash
4
+ module Savon
5
+ class QualifiedMessage
6
+ def to_hash(hash, path)
7
+ return hash unless hash
8
+ return hash.map { |value| to_hash(value, path) } if hash.is_a?(Array)
9
+ return hash.to_s unless hash.is_a?(Hash)
10
+
11
+ hash.each_with_object({}) do |(key, value), newhash|
12
+ case key
13
+ when :order!
14
+ newhash[key] = add_namespaces_to_values(value, path)
15
+ when :attributes!, :content!
16
+ newhash[key] = to_hash(value, path)
17
+ else
18
+ if key.to_s =~ /!$/
19
+ newhash[key] = value
20
+ else
21
+ translated_key = translate_tag(key)
22
+ newkey = add_namespaces_to_values(key, path).first
23
+ newpath = path + [translated_key]
24
+ newhash[newkey] = to_hash(value, @types[newpath] ? [@types[newpath]] : newpath)
25
+ end
26
+ end
27
+ newhash
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ module SavonFixes
2
+ VERSION = '0.0.2'
3
+ end
metadata ADDED
@@ -0,0 +1,162 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: savon_fixes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Lukas Oberhuber
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: savon
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.12.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.12.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: puma
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.14'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.14'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mocha
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.14'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.14'
97
+ - !ruby/object:Gem::Dependency
98
+ name: json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.7'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Patches the Savon gem so fixes are included
126
+ email:
127
+ - lukaso@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - Gemfile
133
+ - LICENSE
134
+ - README.md
135
+ - Rakefile
136
+ - lib/savon_fixes.rb
137
+ - lib/savon_fixes/savon/qualified_message.rb
138
+ - lib/savon_fixes/version.rb
139
+ homepage: https://github.com/lukaso/savon_fixes
140
+ licenses:
141
+ - MIT
142
+ metadata: {}
143
+ post_install_message:
144
+ rdoc_options: []
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ requirements: []
158
+ rubygems_version: 3.0.3
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: Patches the Savon gem so fixes are included
162
+ test_files: []