maremma 4.2.3 → 4.2.4
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/Gemfile.lock +1 -1
- data/lib/maremma.rb +9 -0
- data/lib/maremma/version.rb +1 -1
- data/spec/maremma_spec.rb +5 -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: ea20c84e27eb6be3f752bb38fda926ee2aa1ec585e53ba526739bd74b0de569e
|
4
|
+
data.tar.gz: 0f1379f39973c54056a18d13d072204887d78a332a0a2a8e83532962c48cf07e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c4932b932e51cab41daaeeebc38bc61808275a92005170bdb675e2ec2c200eaa629f22272647f7f507e46b230c3dce692b738fcf23cbdd2c0a74f2f73cb28ea
|
7
|
+
data.tar.gz: 399843bd7b7960da78ec36f2e8e5032b397b7dffd61310e0a0b5a72b0c96adaa314c0422f2715e54e4c8564c2c55385e889702c734ae30a2916c548970fde925
|
data/Gemfile.lock
CHANGED
data/lib/maremma.rb
CHANGED
@@ -15,6 +15,7 @@ require 'maremma/set_host'
|
|
15
15
|
|
16
16
|
module Maremma
|
17
17
|
DEFAULT_TIMEOUT = 60
|
18
|
+
ALLOWED_CONTENT_TAGS = %w(strong em b i code pre sub sup br)
|
18
19
|
NETWORKABLE_EXCEPTIONS = [Faraday::ClientError,
|
19
20
|
Faraday::TimeoutError,
|
20
21
|
Faraday::ResourceNotFound,
|
@@ -26,6 +27,8 @@ module Maremma
|
|
26
27
|
NoMethodError,
|
27
28
|
TypeError]
|
28
29
|
|
30
|
+
ActiveSupport::XmlMini.backend = 'Nokogiri'
|
31
|
+
|
29
32
|
def self.post(url, options={})
|
30
33
|
self.method(url, options.merge(method: "post"))
|
31
34
|
end
|
@@ -221,7 +224,13 @@ module Maremma
|
|
221
224
|
end
|
222
225
|
|
223
226
|
# keep XML attributes, http://stackoverflow.com/a/10794044
|
227
|
+
# escape tags allowed in content
|
224
228
|
def self.from_xml(string)
|
229
|
+
ALLOWED_CONTENT_TAGS.each do |tag|
|
230
|
+
string.gsub!("<#{tag}>", "<#{tag}>")
|
231
|
+
string.gsub!("</#{tag}>", "</#{tag}>")
|
232
|
+
end
|
233
|
+
|
225
234
|
if Nokogiri::XML(string, nil, 'UTF-8').errors.empty?
|
226
235
|
Hash.from_xml(string)
|
227
236
|
else
|
data/lib/maremma/version.rb
CHANGED
data/spec/maremma_spec.rb
CHANGED
@@ -573,6 +573,11 @@ describe Maremma do
|
|
573
573
|
expect(subject.parse_success_response(string)).to eq("data"=>{"word"=>{"type"=>"small", "__content__"=>"abc"}})
|
574
574
|
end
|
575
575
|
|
576
|
+
it 'from_xml with allowed content attributes' do
|
577
|
+
string = '<title>Sexual conflict and correlated evolution between male persistence and female resistance traits in the seed beetle <i>Callosobruchus maculatus</i></title>'
|
578
|
+
expect(subject.parse_success_response(string)).to eq("data"=>{"title"=>"Sexual conflict and correlated evolution between male persistence and female resistance traits in the seed beetle <i>Callosobruchus maculatus</i>"})
|
579
|
+
end
|
580
|
+
|
576
581
|
it 'from_xml with attribute type string' do
|
577
582
|
string = '<crm-item name="publisher-name" type="string">eLife Sciences Publications, Ltd</crm-item>'
|
578
583
|
expect(subject.parse_success_response(string)).to eq("data"=>{"crm_item"=>"eLife Sciences Publications, Ltd"})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maremma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|