flexirest 1.12.2 → 1.12.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7e62a7d0f69e17e808ebb5a91e63805618a5a0e9dee6fa4e1fabbbbe46c065b
4
- data.tar.gz: e1961e477b96fac798530f5ea1dccdd55a6c1e1aca9f169f848492184d4b6820
3
+ metadata.gz: 61eaaa77dfcbab57b714007844456fe903c759cbb981761a43b7eb4910da3463
4
+ data.tar.gz: 10e7bbe8cc3b35887eb34c32562af637ed8cd4aae34df0547c2e2cd52a730a7e
5
5
  SHA512:
6
- metadata.gz: 10a59eceb8374b68bd5b5a1556a5490ac8d1d1a125d2c64b56e78af6eebf5b54754813504bcb64e728211ee24c3f9ecc58791c3c5797517fbba0b3c45608be31
7
- data.tar.gz: 66d9ef4f620f34c5657bf993e30020b3ceb49d5932a2340e4d7b9f3a0ed7e18082dd02e90c33907f25116df33c758b4ff425fd0fe9bf4fe90951fc2a73973c80
6
+ metadata.gz: 251b2a247480a4f7b3c46a70cd469c3ad24cbdb6c245703ec60658ae3429107a7a364eb12e8794c2e28729ebb58e7a17bc1d2fbeebf59a035d5f277032ba7d82
7
+ data.tar.gz: e4fb534d1775963465155761cd4e6b8a7f14e7c66b0f0406d48d39abe4810906c588a9f00fea1b9325b1ed6d1682c9224f47b07c0f75e51b48986d2be43f5e0c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.12.3
4
+
5
+ Bugfix:
6
+
7
+ - Do not raise undefined method error when ignore_root value is null (thanks to jpawlyn for the PR)
8
+
3
9
  ## 1.12.2
4
10
 
5
11
  Bugfix:
@@ -880,14 +880,14 @@ module Flexirest
880
880
 
881
881
  if ignore_root
882
882
  [ignore_root].flatten.each do |key|
883
- body = body[key.to_s] if body.has_key?(key.to_s)
883
+ body = body[key.to_s] || {} if body.has_key?(key.to_s)
884
884
  end
885
885
  end
886
886
  elsif is_xml_response?
887
887
  body = @response.body.blank? ? {} : Crack::XML.parse(@response.body)
888
888
  if ignore_root
889
889
  [ignore_root].flatten.each do |key|
890
- body = body[key.to_s] if body.has_key?(key.to_s)
890
+ body = body[key.to_s] || {} if body.has_key?(key.to_s)
891
891
  end
892
892
  elsif options[:ignore_xml_root]
893
893
  Flexirest::Logger.warn("Using `ignore_xml_root` is deprecated, please switch to `ignore_root`")
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.12.2"
2
+ VERSION = "1.12.3"
3
3
  end
@@ -221,6 +221,14 @@ describe Flexirest::Request do
221
221
  }
222
222
  end
223
223
 
224
+ class IgnoredRootWithNullValueExampleClient < ExampleClient
225
+ get :root, "/root", ignore_root: "feed", fake: %Q{
226
+ {
227
+ "feed": null
228
+ }
229
+ }
230
+ end
231
+
224
232
  class IgnoredRootWithUnexpectedResponseExampleClient < ExampleClient
225
233
  get :root, "/root", ignore_root: "feed", fake: %Q{
226
234
  {
@@ -1587,6 +1595,10 @@ describe Flexirest::Request do
1587
1595
  expect(IgnoredRootExampleClient.root.title).to eq("Example Feed")
1588
1596
  end
1589
1597
 
1598
+ it "should not raise an error if ignore_root value is null" do
1599
+ expect(IgnoredRootWithNullValueExampleClient.root).to be_instance_of(IgnoredRootWithNullValueExampleClient)
1600
+ end
1601
+
1590
1602
  it "should ignore an ignore_root parameter if the specified element is not in the response" do
1591
1603
  expect(IgnoredRootWithUnexpectedResponseExampleClient.root.error.message).to eq("Example Error")
1592
1604
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -407,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  - !ruby/object:Gem::Version
408
408
  version: '0'
409
409
  requirements: []
410
- rubygems_version: 3.4.10
410
+ rubygems_version: 3.5.6
411
411
  signing_key:
412
412
  specification_version: 4
413
413
  summary: This gem is for accessing REST services in a flexible way. ActiveResource