lhs 21.2.3 → 21.2.4

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: 90588d8b49ea001a59c76710d97dc5b2b55ba77917ded5012c35e6924b9f2208
4
- data.tar.gz: 880b24d7a80d32eeccde0e7818fd36a31b59cfb8699cb880746a28c60e7ec983
3
+ metadata.gz: d29a70798d8ce33c3fbd253465123d32fe2fd4a97e213a9f3cdce1350e45bd85
4
+ data.tar.gz: 50d2cd571874e523de51ed9652d4faec1406087e69940ee87f4941f5d416e9b4
5
5
  SHA512:
6
- metadata.gz: 9294294bb7c1c21881bccea2a70e756da27a54edc59385361f2179d3d2069b2a00469a74957bd145b3d54c94eff18d08813db054a87ffa6526388de2473f8649
7
- data.tar.gz: 6bdbfaab6df958c88cb791b7202b9ed713c460e2297bbb3fc9da160bb55c9fc97b6051978f451d074da08e073d647d3653cd94090f2235c4b00fee707d861824
6
+ metadata.gz: a6fcfc2a0507d730e88045b0489d0f463bcff6235fe5a10cafdbd6c3560ae0e561479f3f2ae766ef7495be8c8e6d0efbce2636f468ae98a488d413ece8d6ca75
7
+ data.tar.gz: c7c48a2130f9cf32de2fdc657f0ba3b50b71e10b062a297797b383b0c5f2fd9cbdf1a9023237dcf1ca44c9f822ec3dd25ef3180a9915c166850477592c623b48
@@ -246,7 +246,9 @@ class LHS::Record
246
246
  def skip_loading_includes?(data, included)
247
247
  if data.collection?
248
248
  data.to_a.none? { |item| item[included].present? }
249
- elsif data[included].present? && data[included].item? && data[included].href.blank?
249
+ elsif data.dig(included).blank?
250
+ true
251
+ elsif data[included].item? && data[included][:href].blank?
250
252
  true
251
253
  else
252
254
  !data._raw.key?(included)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LHS
4
- VERSION = '21.2.3'
4
+ VERSION = '21.2.4'
5
5
  end
@@ -705,4 +705,23 @@ describe LHS::Record do
705
705
  }).not_to raise_exception
706
706
  end
707
707
  end
708
+
709
+ context 'include partially empty structures' do
710
+ before do
711
+ class Place < LHS::Record
712
+ endpoint 'https://places/{id}'
713
+ end
714
+ stub_request(:get, "https://places/1")
715
+ .to_return(body: {
716
+ id: '123',
717
+ customer: {}
718
+ }.to_json)
719
+ end
720
+
721
+ it 'skips includes when there is nothing and also does not raise an exception' do
722
+ expect(-> {
723
+ Place.includes(customer: :salesforce).find(1)
724
+ }).not_to raise_exception
725
+ end
726
+ end
708
727
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lhs
3
3
  version: !ruby/object:Gem::Version
4
- version: 21.2.3
4
+ version: 21.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - https://github.com/local-ch/lhs/graphs/contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-24 00:00:00.000000000 Z
11
+ date: 2020-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel