cxml-ruby 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/cxml/document_node.rb +9 -1
- data/lib/cxml/parser.rb +3 -2
- data/lib/cxml/version.rb +1 -1
- data/spec/punch_out_setup_request_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca2ed654a5b8543d2beb69ec7acb0db49b2f1fbd7210ef1d4928b4da4fa0cb96
|
4
|
+
data.tar.gz: 90b66c83fe8ea876050daad559ecd0b3349d578ab1ea21e0ef79e234c0382e44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12d39fe0bd266b4308853a8bd2a331cc546e0ca43643629dbe264ea3f44cdaeb5d55ac7590e42e1297b7dcd957d1f91daba4af96b19e96b0d92548f47f51f307
|
7
|
+
data.tar.gz: 1c9ab1f5f5c03555e9ac12ceedd41afa016a25c38cde5e2eea01ee9792953fb1aad10bc3b47254729daf5563b178534b0c6bd5da2ae65e17bff334f28f4510b5
|
data/CHANGELOG.md
CHANGED
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
14
14
|
|
15
15
|
---
|
16
16
|
|
17
|
+
## [0.4.0] - 2020-04-20
|
18
|
+
### Changed
|
19
|
+
- Return parsed nodes as plain string if they have no attributes and only string content.
|
20
|
+
|
17
21
|
## [0.3.0] - 2020-04-19
|
18
22
|
### Changed
|
19
23
|
- Drop Nokogiri and XMLSimple in favor of Ox.
|
data/lib/cxml/document_node.rb
CHANGED
@@ -127,7 +127,15 @@ module CXML
|
|
127
127
|
rescue NameError => e
|
128
128
|
raise(e) unless e.to_s.match?(klass)
|
129
129
|
|
130
|
-
|
130
|
+
initialize_attribute_raw(key, val)
|
131
|
+
end
|
132
|
+
|
133
|
+
def initialize_attribute_raw(key, val)
|
134
|
+
if val.is_a?(Hash) && val.keys == [:content]
|
135
|
+
send("#{key}=", val[:content])
|
136
|
+
else
|
137
|
+
send("#{key}=", val)
|
138
|
+
end
|
131
139
|
end
|
132
140
|
|
133
141
|
def camelize(string, uppercase_first_letter = true)
|
data/lib/cxml/parser.rb
CHANGED
@@ -22,10 +22,11 @@ module CXML
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
def node_to_hash(node)
|
25
|
+
def node_to_hash(node) # rubocop:disable Metrics/AbcSize
|
26
26
|
return node if node.is_a? String
|
27
|
+
return node.nodes.first if node.nodes.all?(String) && node.attributes.empty?
|
27
28
|
|
28
|
-
hash = node.attributes
|
29
|
+
hash = node.attributes
|
29
30
|
hash.transform_keys!(&method(:underscore_key))
|
30
31
|
node.nodes.reduce(hash) do |acc, child_node|
|
31
32
|
next acc if child_node.is_a?(Ox::Comment)
|
data/lib/cxml/version.rb
CHANGED
@@ -31,6 +31,7 @@ describe CXML::PunchOutSetupRequest do
|
|
31
31
|
punch_out_setup_request_coupa.extrinsics.should be_a Array
|
32
32
|
punch_out_setup_request_coupa.extrinsics.first.should be_a CXML::Extrinsic
|
33
33
|
punch_out_setup_request_coupa.extrinsics.first.name.should_not be_nil
|
34
|
+
doc_coupa.header.sender.credential.shared_secret.should eq('test')
|
34
35
|
end
|
35
36
|
it 'sets the shipping attributes when present' do
|
36
37
|
data = CXML::Parser.new(data: fixture('punch_out_setup_request_doc_with_ship_to.xml')).parse
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cxml-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Beckman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-04-
|
12
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ox
|