maremma 4.9.5 → 4.9.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75cce5a38aa18df2aedba173c9a5f6e3c3336b4e8743e6898b41b7886edd0036
4
- data.tar.gz: fecfcd303216366dde1d0096510104190d5ea51fbc776fad940cc722b152c755
3
+ metadata.gz: c8c7478b41d06a371b6515a8dd41c7abeb3a4a046eb9cd12376873823fcbe349
4
+ data.tar.gz: c35e08881191261ca2510c1c9012cb2cd0a239723fdac43bf3ecd9a20519c822
5
5
  SHA512:
6
- metadata.gz: ee866f58f8dac6ecc026b8b85ef862520e1edb9fc4c20c384defeba0578d3227f7b1e331ef4c60a625e1391acf8565aded3ecc4dac0ec3fb914a272ebcb9cd0d
7
- data.tar.gz: 65c2c756ae9ec3e6400557ee6b28a2cf2e76ab7d6f538a628205bda518e79ab75c7367a9f07a79547c714baedcb598d7c7b0124f1e6b0c6eea2385d77cf9671d
6
+ metadata.gz: 5f305c308e7a204fcaae3bfcd61433cac0418dad757addf6944c3c800b90c659076460e680866c01c0937e44d9ed064c20654f1d64041910ec1ddbe692e64b54
7
+ data.tar.gz: 4d64ab236db26628380a259a85b42ed0c5f0540f992a70e184821146b7c29d9f441349b89c2322c826c009f69c2e641737d02f1940fa4aca0652d3864b60cbf3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased](https://github.com/datacite/maremma/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/datacite/maremma/compare/4.9.5...HEAD)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Add option to skip the encoding of the response body. [\#16](https://github.com/datacite/maremma/pull/16) ([jrhoads](https://github.com/jrhoads))
10
+
11
+ ## [4.9.5](https://github.com/datacite/maremma/tree/4.9.5) (2021-07-20)
12
+
13
+ [Full Changelog](https://github.com/datacite/maremma/compare/4.9.4...4.9.5)
14
+
3
15
  ## [4.9.4](https://github.com/datacite/maremma/tree/4.9.4) (2021-06-07)
4
16
 
5
17
  [Full Changelog](https://github.com/datacite/maremma/compare/4.9.3...4.9.4)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maremma (4.9.5)
4
+ maremma (4.9.6)
5
5
  activesupport (>= 4.2.5)
6
6
  addressable (>= 2.3.6)
7
7
  builder (~> 3.2, >= 3.2.2)
@@ -16,7 +16,7 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- activesupport (6.1.4)
19
+ activesupport (6.1.4.1)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
@@ -48,13 +48,13 @@ GEM
48
48
  nokogiri (1.11.7)
49
49
  mini_portile2 (~> 2.5.0)
50
50
  racc (~> 1.4)
51
- oj (3.12.1)
51
+ oj (3.13.9)
52
52
  oj_mimic_json (1.0.1)
53
53
  parallel (1.20.1)
54
54
  parser (3.0.2.0)
55
55
  ast (~> 2.4.1)
56
56
  public_suffix (4.0.6)
57
- racc (1.5.2)
57
+ racc (1.6.0)
58
58
  rack (2.2.3)
59
59
  rack-test (0.8.3)
60
60
  rack (>= 1.0, < 3)
@@ -98,7 +98,7 @@ GEM
98
98
  addressable (>= 2.3.6)
99
99
  crack (>= 0.3.2)
100
100
  hashdiff (>= 0.4.0, < 2.0.0)
101
- zeitwerk (2.4.2)
101
+ zeitwerk (2.5.1)
102
102
 
103
103
  PLATFORMS
104
104
  ruby
@@ -116,4 +116,4 @@ DEPENDENCIES
116
116
  webmock (~> 3.0, >= 3.0.1)
117
117
 
118
118
  BUNDLED WITH
119
- 2.2.19
119
+ 2.2.30
@@ -1,3 +1,3 @@
1
1
  module Maremma
2
- VERSION = "4.9.5".freeze
2
+ VERSION = "4.9.6".freeze
3
3
  end
data/lib/maremma.rb CHANGED
@@ -229,9 +229,18 @@ module Maremma
229
229
  end
230
230
 
231
231
  def self.parse_response(string, options = {})
232
- string = string.dup.encode(Encoding.find("UTF-8"), invalid: :replace,
233
- undef: :replace,
234
- replace: "?")
232
+ string = string.dup
233
+ string =
234
+ if options[:skip_encoding]
235
+ string
236
+ else
237
+ string.encode(
238
+ Encoding.find("UTF-8"),
239
+ invalid: :replace,
240
+ undef: :replace,
241
+ replace: "?"
242
+ )
243
+ end
235
244
  return string if options[:raw]
236
245
 
237
246
  from_json(string) || from_xml(string) || from_string(string)
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://pub.sandbox.orcid.org/v3.0/0000-0002-5721-4355
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Mozilla/5.0 (compatible; Maremma/4.9.5; +https://github.com/datacite/maremma)
12
+ Accept:
13
+ - application/json;charset=UTF-8
14
+ Accept-Encoding:
15
+ - gzip,deflate
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ''
20
+ headers:
21
+ Date:
22
+ - Wed, 27 Oct 2021 13:46:08 GMT
23
+ Content-Type:
24
+ - application/json;charset=UTF-8
25
+ Connection:
26
+ - keep-alive
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ Cache-Control:
30
+ - no-cache, no-store, max-age=0, must-revalidate
31
+ Pragma:
32
+ - no-cache
33
+ Expires:
34
+ - '0'
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ X-Frame-Options:
38
+ - DENY
39
+ X-Content-Type-Options:
40
+ - nosniff
41
+ Vary:
42
+ - accept-encoding
43
+ Content-Encoding:
44
+ - gzip
45
+ Cf-Cache-Status:
46
+ - DYNAMIC
47
+ Expect-Ct:
48
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
49
+ Server:
50
+ - cloudflare
51
+ Cf-Ray:
52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T
59
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://pub.sandbox.orcid.org/v3.0/0000-0002-5721-4355
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Mozilla/5.0 (compatible; Maremma/4.9.5; +https://github.com/datacite/maremma)
12
+ Accept:
13
+ - application/json;charset=UTF-8
14
+ Accept-Encoding:
15
+ - gzip,deflate
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ''
20
+ headers:
21
+ Date:
22
+ - Wed, 27 Oct 2021 13:46:08 GMT
23
+ Content-Type:
24
+ - application/json;charset=UTF-8
25
+ Connection:
26
+ - keep-alive
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ Cache-Control:
30
+ - no-cache, no-store, max-age=0, must-revalidate
31
+ Pragma:
32
+ - no-cache
33
+ Expires:
34
+ - '0'
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ X-Frame-Options:
38
+ - DENY
39
+ X-Content-Type-Options:
40
+ - nosniff
41
+ Vary:
42
+ - accept-encoding
43
+ Content-Encoding:
44
+ - gzip
45
+ Cf-Cache-Status:
46
+ - DYNAMIC
47
+ Expect-Ct:
48
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
49
+ Server:
50
+ - cloudflare
51
+ Cf-Ray:
52
+ - 6a4c5e69ad5f1a07-EWR
53
+ body:
54
+ encoding: ASCII-8BIT
55
+ string: !binary |-
56
+ H4sIAAAAAAAAALRVy27bMBD8FYOnFrDiWH77mqRFr0V6KnqgxbW1DUWqJKXECPJBOeTQb/CPdemnHKumW9gGLAjicGZ3uBo9M20SFBEKUA6nCIaNn1lhkI1Z6lxux62W5UpM9NPVEknXWeuafhH946g3iNtRt9PrsSbLuUtpW/1iqq2jxQMu9kIbDUzBgErAenWpEy6BwKD8aorWaTP3K4kB7lCrKAOXakGQ2y9f727uiT/RWS5huSi4o92qkLLJbDHJ0Nrd42dWclnQTbvf6Q66o+F13Bt0SEZy66JMC2+CqAOPOnGn0437AwInkmMGVIAzBZCKLkyy1RTAE4clPyimBLNih4yj3GzePs0NZtzMq6veHDBWq6UvNRWuiBXPYOtPffXLVjvX7f6/tBoTeIYlqMgr2AqK3XLHbxZvbvHqz2jKM5TzaFPHBvTt/tOwcb94paP3phkQ6Nag9fHsGVeixQlKdHTYLC8mEpPjY0Wk2qVgduX93aMdkI2//9jS1s1yq0pKGhPUM8PzdH6Cx0O6dE/xmHCj/iCOR94ZrRy9f1TOnU0M0rg3Gz/pJbSONxuoSrAOZ1xo0/jwmV6gxRs9vrM5X/ymm/Zo2P54xQL21fa5a4yKMGCBm8R3XhgZcHMfHHb0PTnpLcc8ILN+FULsKxhxciFIyYZmYQ0LE2+ARP0A80dtRIB5jQozb+m8E08OjOKyksIhXw53nOBSnczL8T3r9PHW+kxDh2AjW2Q+qI6XKGh6USU+BEOnMZ3S1K7icmZ0kYdb2SP3Dooi4ZeRqlAvhzaXep6RfxdQqnD7TC2UQDUL6JzIvSUjYgoU9AmWa4uX8exQgWQzyCY0TSnm5xesci+/mZQzBkqEx/PYt0dIAr8KLonsUjP3jr4SzlTE6pt5nr5qaEnMgikxKPEffW2JSYTS7+E8TayYAkG2i68Akr38AQAA//8DAEWCRUMUCwAA
57
+ http_version:
58
+ recorded_at: Wed, 27 Oct 2021 13:46:00 GMT
59
+ recorded_with: VCR 3.0.3
data/spec/maremma_spec.rb CHANGED
@@ -92,6 +92,20 @@ describe Maremma do
92
92
  response = subject.get("https://data.crosscite.org/application/vnd.datacite.datacite+xml/10.5061/dryad.8515", headers: { "Accept-Encoding" => "gzip" })
93
93
  expect(response.body["data"]).to be_a(Hash)
94
94
  end
95
+
96
+ it "get utf8 bad encoding", vcr: true do
97
+ response = subject.get("https://pub.sandbox.orcid.org/v3.0/0000-0002-5721-4355", accept: "json")
98
+ expect(response.body["data"]).to be_a(Hash)
99
+ expect(response.body["data"]["person"]["name"]["given-names"]["value"]).to eq("DataC??t??")
100
+ expect(response.body["data"]["person"]["name"]["family-name"]["value"]).to eq("UTF8 T??st")
101
+ end
102
+
103
+ it "get utf8 skip encoding", vcr: true do
104
+ response = subject.get("https://pub.sandbox.orcid.org/v3.0/0000-0002-5721-4355", accept: "json", skip_encoding: true)
105
+ expect(response.body["data"]).to be_a(Hash)
106
+ expect(response.body["data"]["person"]["name"]["given-names"]["value"]).to eq("DataCíté")
107
+ expect(response.body["data"]["person"]["name"]["family-name"]["value"]).to eq("UTF8 Tést")
108
+ end
95
109
  end
96
110
 
97
111
  context "head" do
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.9.5
4
+ version: 4.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-20 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -344,6 +344,8 @@ files:
344
344
  - spec/fixtures/vcr_cassettes/Maremma/get/get_html_compressed.yml
345
345
  - spec/fixtures/vcr_cassettes/Maremma/get/get_json_compressed.yml
346
346
  - spec/fixtures/vcr_cassettes/Maremma/get/get_json_with_params.yml
347
+ - spec/fixtures/vcr_cassettes/Maremma/get/get_utf8_bad_encoding.yml
348
+ - spec/fixtures/vcr_cassettes/Maremma/get/get_utf8_skip_encoding.yml
347
349
  - spec/fixtures/vcr_cassettes/Maremma/get/get_xml_compressed.yml
348
350
  - spec/fixtures/vcr_cassettes/Maremma/link_headers/parses_link_headers.yml
349
351
  - spec/fixtures/vcr_cassettes/Maremma/set_host/crossref.yml