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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3514e62a075ac398b0c9106f5ecb267357267c8fa607bd0d4e074204314bf5f
4
- data.tar.gz: f577fdda2e5ec172ac6fc938e5964b7b5bd53dc6b0a25228f06d47b9c1225de2
3
+ metadata.gz: 77d1a0312ff87aa52f3b6c0764b9771b38842f1b24e18128bff86c9aefd59fde
4
+ data.tar.gz: bec8478bf8561cc00a782d465f80b839a49002f8d9476af88e624ed5814e5d9b
5
5
  SHA512:
6
- metadata.gz: 35c4148a847481427b22de6314027815ca3f75f3a431f39cad683a654589ab7e73b987273b8bc3c5c3cecfe10624ba9418259505f4f162a19978a3012dbf281e
7
- data.tar.gz: 2ec77898592a47104c5537ef9163d389fa5d62d80e9e6756be2715da3ff5778d169310a2d2b93bf77222208f544242daaa676d8a3ac9f8ee26248cae6b77cdde
6
+ metadata.gz: 0b1d915d4ac1a8ec6f1df4a16a6e2f90e871a93e5c6041fd0e43215fb7ccdaa997a08b7d183d77285516cc2a094be53df8511fad53cf32b24ce3b7907f481622
7
+ data.tar.gz: 918b2ab9bc2831814fb779cdeb124ea41c73aed753907f41f72b8aa0362e39ebdd4a2099db4cc0b2a13569a148c4cea11130c34d30af35b2a77fcfabf99d32ad
@@ -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)
@@ -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[:content_type].id
110
+ sys[content_type_key.to_sym].id
109
111
  )
110
112
 
111
113
  return false if content_type.nil?
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.13.0'
4
+ VERSION = '2.13.1'
5
5
  end
@@ -541,41 +541,85 @@ describe Contentful::Entry do
541
541
  end
542
542
 
543
543
  describe 'empty fields' do
544
- it 'raises an exception by default' do
545
- vcr('entries/empty_fields') {
546
- entry = create_client(
547
- space: 'z4ssexir3p93',
548
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
549
- dynamic_entries: :auto
550
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
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
- expect { entry.title }.to raise_error Contentful::EmptyFieldError
553
- }
554
- end
553
+ expect { entry.title }.to raise_error Contentful::EmptyFieldError
554
+ }
555
+ end
555
556
 
556
- it 'returns nil if raise_for_empty_fields is false' do
557
- vcr('entries/empty_fields') {
558
- entry = create_client(
559
- space: 'z4ssexir3p93',
560
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
561
- dynamic_entries: :auto,
562
- raise_for_empty_fields: false
563
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
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
- expect(entry.title).to be_nil
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
- it 'will properly raise NoMethodError for non-fields' do
570
- vcr('entries/empty_fields') {
571
- entry = create_client(
572
- space: 'z4ssexir3p93',
573
- access_token: 'e157fdaf7b325b71d07a94b7502807d4cfbbb1a34e69b7856838e25b92777bc6',
574
- dynamic_entries: :auto
575
- ).entry('2t1x77MgUA4SM2gMiaUcsy')
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
- expect { entry.unexisting_field }.to raise_error NoMethodError
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.0
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-06-26 00:00:00.000000000 Z
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.1
534
+ rubygems_version: 3.0.3
558
535
  signing_key:
559
536
  specification_version: 4
560
537
  summary: contentful