contentful 2.13.0 → 2.13.1
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/contentful/entry.rb +3 -1
- data/lib/contentful/version.rb +1 -1
- data/spec/entry_spec.rb +73 -29
- metadata +4 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77d1a0312ff87aa52f3b6c0764b9771b38842f1b24e18128bff86c9aefd59fde
|
4
|
+
data.tar.gz: bec8478bf8561cc00a782d465f80b839a49002f8d9476af88e624ed5814e5d9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b1d915d4ac1a8ec6f1df4a16a6e2f90e871a93e5c6041fd0e43215fb7ccdaa997a08b7d183d77285516cc2a094be53df8511fad53cf32b24ce3b7907f481622
|
7
|
+
data.tar.gz: 918b2ab9bc2831814fb779cdeb124ea41c73aed753907f41f72b8aa0362e39ebdd4a2099db4cc0b2a13569a148c4cea11130c34d30af35b2a77fcfabf99d32ad
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 2.13.1
|
6
|
+
### Fixed
|
7
|
+
* Fixed detection of empty fields when `:use_camel_case` is `true`. [#203](https://github.com/contentful/contentful.rb/issues/203)
|
8
|
+
|
5
9
|
## 2.13.0
|
6
10
|
### Changed
|
7
11
|
* Updated HTTP gem version limits. [#202](https://github.com/contentful/contentful.rb/pull/202)
|
data/lib/contentful/entry.rb
CHANGED
@@ -103,9 +103,11 @@ module Contentful
|
|
103
103
|
protected
|
104
104
|
|
105
105
|
def content_type_field?(name)
|
106
|
+
content_type_key = Support.snakify('contentType', @configuration[:use_camel_case])
|
107
|
+
|
106
108
|
content_type = ContentTypeCache.cache_get(
|
107
109
|
sys[:space].id,
|
108
|
-
sys[
|
110
|
+
sys[content_type_key.to_sym].id
|
109
111
|
)
|
110
112
|
|
111
113
|
return false if content_type.nil?
|
data/lib/contentful/version.rb
CHANGED
data/spec/entry_spec.rb
CHANGED
@@ -541,41 +541,85 @@ describe Contentful::Entry do
|
|
541
541
|
end
|
542
542
|
|
543
543
|
describe 'empty fields' do
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
544
|
+
context 'when default configuration' do
|
545
|
+
it 'raises an exception by default' do
|
546
|
+
vcr('entries/empty_fields') {
|
547
|
+
entry = create_client(
|
548
|
+
space: 'z4ssexir3p93',
|
549
|
+
access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
|
550
|
+
dynamic_entries: :auto
|
551
|
+
).entry('2t1x77MgUA4SM2gMiaUcsy')
|
551
552
|
|
552
|
-
|
553
|
-
|
554
|
-
|
553
|
+
expect { entry.title }.to raise_error Contentful::EmptyFieldError
|
554
|
+
}
|
555
|
+
end
|
555
556
|
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
557
|
+
it 'returns nil if raise_for_empty_fields is false' do
|
558
|
+
vcr('entries/empty_fields') {
|
559
|
+
entry = create_client(
|
560
|
+
space: 'z4ssexir3p93',
|
561
|
+
access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
|
562
|
+
dynamic_entries: :auto,
|
563
|
+
raise_for_empty_fields: false
|
564
|
+
).entry('2t1x77MgUA4SM2gMiaUcsy')
|
564
565
|
|
565
|
-
|
566
|
-
|
566
|
+
expect(entry.title).to be_nil
|
567
|
+
}
|
568
|
+
end
|
569
|
+
|
570
|
+
it 'will properly raise NoMethodError for non-fields' do
|
571
|
+
vcr('entries/empty_fields') {
|
572
|
+
entry = create_client(
|
573
|
+
space: 'z4ssexir3p93',
|
574
|
+
access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
|
575
|
+
dynamic_entries: :auto
|
576
|
+
).entry('2t1x77MgUA4SM2gMiaUcsy')
|
577
|
+
|
578
|
+
expect { entry.unexisting_field }.to raise_error NoMethodError
|
579
|
+
}
|
580
|
+
end
|
567
581
|
end
|
568
582
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
583
|
+
context 'when use_camel_case is true it should still work' do
|
584
|
+
it 'raises an exception by default' do
|
585
|
+
vcr('entries/empty_fields') {
|
586
|
+
entry = create_client(
|
587
|
+
space: 'z4ssexir3p93',
|
588
|
+
access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
|
589
|
+
dynamic_entries: :auto,
|
590
|
+
use_camel_case: true
|
591
|
+
).entry('2t1x77MgUA4SM2gMiaUcsy')
|
576
592
|
|
577
|
-
|
578
|
-
|
593
|
+
expect { entry.title }.to raise_error Contentful::EmptyFieldError
|
594
|
+
}
|
595
|
+
end
|
596
|
+
|
597
|
+
it 'returns nil if raise_for_empty_fields is false' do
|
598
|
+
vcr('entries/empty_fields') {
|
599
|
+
entry = create_client(
|
600
|
+
space: 'z4ssexir3p93',
|
601
|
+
access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
|
602
|
+
dynamic_entries: :auto,
|
603
|
+
raise_for_empty_fields: false,
|
604
|
+
use_camel_case: true
|
605
|
+
).entry('2t1x77MgUA4SM2gMiaUcsy')
|
606
|
+
|
607
|
+
expect(entry.title).to be_nil
|
608
|
+
}
|
609
|
+
end
|
610
|
+
|
611
|
+
it 'will properly raise NoMethodError for non-fields' do
|
612
|
+
vcr('entries/empty_fields') {
|
613
|
+
entry = create_client(
|
614
|
+
space: 'z4ssexir3p93',
|
615
|
+
access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
|
616
|
+
dynamic_entries: :auto,
|
617
|
+
use_camel_case: true
|
618
|
+
).entry('2t1x77MgUA4SM2gMiaUcsy')
|
619
|
+
|
620
|
+
expect { entry.unexisting_field }.to raise_error NoMethodError
|
621
|
+
}
|
622
|
+
end
|
579
623
|
end
|
580
624
|
end
|
581
625
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentful GmbH (Jan Lelis)
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|
@@ -266,30 +266,6 @@ files:
|
|
266
266
|
- coverage/.last_run.json
|
267
267
|
- coverage/.resultset.json
|
268
268
|
- coverage/.resultset.json.lock
|
269
|
-
- coverage/assets/0.10.1/application.css
|
270
|
-
- coverage/assets/0.10.1/application.js
|
271
|
-
- coverage/assets/0.10.1/colorbox/border.png
|
272
|
-
- coverage/assets/0.10.1/colorbox/controls.png
|
273
|
-
- coverage/assets/0.10.1/colorbox/loading.gif
|
274
|
-
- coverage/assets/0.10.1/colorbox/loading_background.png
|
275
|
-
- coverage/assets/0.10.1/favicon_green.png
|
276
|
-
- coverage/assets/0.10.1/favicon_red.png
|
277
|
-
- coverage/assets/0.10.1/favicon_yellow.png
|
278
|
-
- coverage/assets/0.10.1/loading.gif
|
279
|
-
- coverage/assets/0.10.1/magnify.png
|
280
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
281
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
282
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
283
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
284
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
285
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
286
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
287
|
-
- coverage/assets/0.10.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
288
|
-
- coverage/assets/0.10.1/smoothness/images/ui-icons_222222_256x240.png
|
289
|
-
- coverage/assets/0.10.1/smoothness/images/ui-icons_2e83ff_256x240.png
|
290
|
-
- coverage/assets/0.10.1/smoothness/images/ui-icons_454545_256x240.png
|
291
|
-
- coverage/assets/0.10.1/smoothness/images/ui-icons_888888_256x240.png
|
292
|
-
- coverage/assets/0.10.1/smoothness/images/ui-icons_cd0a0a_256x240.png
|
293
269
|
- coverage/assets/0.10.2/application.css
|
294
270
|
- coverage/assets/0.10.2/application.js
|
295
271
|
- coverage/assets/0.10.2/colorbox/border.png
|
@@ -357,6 +333,7 @@ files:
|
|
357
333
|
- doc/Contentful/ServiceUnavailable.html
|
358
334
|
- doc/Contentful/Space.html
|
359
335
|
- doc/Contentful/StringCoercion.html
|
336
|
+
- doc/Contentful/StructuredTextCoercion.html
|
360
337
|
- doc/Contentful/Support.html
|
361
338
|
- doc/Contentful/SymbolCoercion.html
|
362
339
|
- doc/Contentful/Sync.html
|
@@ -554,7 +531,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
554
531
|
- !ruby/object:Gem::Version
|
555
532
|
version: '0'
|
556
533
|
requirements: []
|
557
|
-
rubygems_version: 3.0.
|
534
|
+
rubygems_version: 3.0.3
|
558
535
|
signing_key:
|
559
536
|
specification_version: 4
|
560
537
|
summary: contentful
|