contentful 2.9.1 → 2.9.2

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: 98009b534c8ea22dbfa1f4b1192aa715b8ead44425dbaf71ee2523ed67ec9202
4
- data.tar.gz: 1a0f6a62fcc889d813d9e4d3ea603c37bfc09744a7d77541fc00bfbf0c9134b3
3
+ metadata.gz: '086e72b9a7ea3bbc5921407727c14aff220358887fea2bb80180a7e33a977b8e'
4
+ data.tar.gz: 5580a3b84e07ee8346c6b0cbce69fcc7b65d749a091ccc2abc859ca37f3f0708
5
5
  SHA512:
6
- metadata.gz: 9347ad13c5afd28b1da636e2468acf097c139175d3399eaae93cd627c7868d53d2c334b5a8a78c8f2ed2d91c656a1a46565a35f44f1297262b906dec7873e3b3
7
- data.tar.gz: ec4acb6965b3e9c2a7dcd8a9045ac5fa8f02edb8a0e2a15fb2213e18c7837e798fb47a892f4df1fe909c68154520cd015e55dc8a27be51ec6180231e8af854bb
6
+ metadata.gz: 3417c39de8d5432d4b61590812ba6dffd85d350e4bcd1fa4635a404a96abfd7415c37cbdc7bd525dff8120c0224292dc9730e9ee2f1edcd3c4493d36aae14a9c
7
+ data.tar.gz: 51a479869d7265fb85aa154d0541e94f3b9bce0da935e658f8fa5f4d6c66b22efe8db4b3a6b2899e15ff99192a152341cee1adff70380effd470874b7ab24933
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.9.2
6
+ ### Added
7
+ * Added support for `StructuredText` inline Entry include resolution.
8
+
5
9
  ## 2.9.1
6
10
 
7
11
  **Note:** This release includes support for `StructuredText`, this is an **alpha** feature and changes are to be expected. Further releases of this feature
data/README.md CHANGED
@@ -214,11 +214,6 @@ client = Contentful::Client.new(
214
214
  <td><code>'en-US'</code></td>
215
215
  <td>Defines default locale for the client.</td>
216
216
  </tr>
217
- <tr>
218
- <td><code>environment</code></td>
219
- <td><code>'master'</code></td>
220
- <td>Defines default environment to access.</td>
221
- </tr>
222
217
  <tr>
223
218
  <td><code>secure</code></td>
224
219
  <td><code>true</code></td>
@@ -108,17 +108,18 @@ module Contentful
108
108
  private
109
109
 
110
110
  def link?(node)
111
- node['nodeClass'] == 'block' && node.key?('data')
111
+ !node.fetch('data', {}).empty? && node['data']['target']
112
112
  end
113
113
 
114
114
  def content_block?(node)
115
- node['nodeClass'] == 'block' && node.key?('content')
115
+ !node.fetch('content', []).empty?
116
116
  end
117
117
 
118
118
  def coerce_block(block, configuration)
119
119
  return block unless block.is_a?(Hash) && block.key?('content')
120
120
 
121
121
  invalid_nodes = []
122
+ coerced_nodes = {}
122
123
  block['content'].each_with_index do |node, index|
123
124
  if link?(node)
124
125
  link = coerce_link(node, configuration)
@@ -129,10 +130,14 @@ module Contentful
129
130
  invalid_nodes << index
130
131
  end
131
132
  elsif content_block?(node)
132
- node['content'] = coerce_block(node, configuration)
133
+ coerced_nodes[index] = coerce_block(node, configuration)
133
134
  end
134
135
  end
135
136
 
137
+ coerced_nodes.each do |index, coerced_node|
138
+ block['content'][index] = coerced_node
139
+ end
140
+
136
141
  invalid_nodes.each do |index|
137
142
  block['content'].delete_at(index)
138
143
  end
@@ -1,5 +1,5 @@
1
1
  # Contentful Namespace
2
2
  module Contentful
3
3
  # Gem Version
4
- VERSION = '2.9.1'
4
+ VERSION = '2.9.2'
5
5
  end
data/spec/entry_spec.rb CHANGED
@@ -538,5 +538,49 @@ describe Contentful::Entry do
538
538
  expect(expected_entry_occurrances).to eq 0
539
539
  }
540
540
  end
541
+
542
+ it 'respects content in data attribute if its not a Link' do
543
+ vcr('entries/structured_text_nested_fields') {
544
+ entry = create_client(
545
+ space: 'jd7yc4wnatx3',
546
+ access_token: '6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248',
547
+ raise_errors: true,
548
+ dynamic_entries: :auto
549
+ ).entry('6NGLswCREsGA28kGouScyY')
550
+
551
+ expect(entry.body['content'][0]).to eq({
552
+ 'data' => {},
553
+ 'content' => [
554
+ {'marks' => [], 'value' => 'A link to ', 'nodeType' => 'text', 'nodeClass' => 'text'},
555
+ {
556
+ 'data' => {'uri' => 'https://google.com'},
557
+ 'content' => [{'marks' => [], 'value' => 'google', 'nodeType' => 'text', 'nodeClass' => 'text'}],
558
+ 'nodeType' => 'hyperlink',
559
+ 'nodeClass' => 'inline'
560
+ },
561
+ {'marks' => [], 'value' => '', 'nodeType' => 'text', 'nodeClass' => 'text'}
562
+ ],
563
+ 'nodeType' => 'paragraph',
564
+ 'nodeClass' => 'block'
565
+ })
566
+ }
567
+ end
568
+
569
+ it 'supports includes in nested fields' do
570
+ vcr('entries/structured_text_nested_fields') {
571
+ entry = create_client(
572
+ space: 'jd7yc4wnatx3',
573
+ access_token: '6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248',
574
+ raise_errors: true,
575
+ dynamic_entries: :auto
576
+ ).entry('6NGLswCREsGA28kGouScyY')
577
+
578
+ expect(entry.body['content'][3]['nodeType']).to eq('unordered-list')
579
+ expect(entry.body['content'][3]['content'][2]['content'][0]['data'].is_a?(Contentful::Entry)).to be_truthy
580
+
581
+ expect(entry.body['content'][4]['nodeType']).to eq('ordered-list')
582
+ expect(entry.body['content'][4]['content'][2]['content'][0]['data'].is_a?(Contentful::Entry)).to be_truthy
583
+ }
584
+ end
541
585
  end
542
586
  end
@@ -0,0 +1,167 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://cdn.contentful.com/spaces/jd7yc4wnatx3/environments/master/content_types?limit=1000
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful.rb/2.9.1; platform ruby/2.5.1; os macOS/16;
12
+ Authorization:
13
+ - Bearer 6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248
14
+ Content-Type:
15
+ - application/vnd.contentful.delivery.v1+json
16
+ Accept-Encoding:
17
+ - gzip
18
+ Connection:
19
+ - close
20
+ Host:
21
+ - cdn.contentful.com
22
+ User-Agent:
23
+ - http.rb/2.2.2
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Access-Control-Allow-Headers:
30
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature
31
+ Access-Control-Allow-Methods:
32
+ - GET,HEAD,OPTIONS
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Expose-Headers:
36
+ - Etag
37
+ Access-Control-Max-Age:
38
+ - '86400'
39
+ Cache-Control:
40
+ - max-age=0
41
+ Content-Encoding:
42
+ - gzip
43
+ Content-Type:
44
+ - application/vnd.contentful.delivery.v1+json
45
+ Contentful-Api:
46
+ - cda_cached
47
+ Etag:
48
+ - W/"0ecb92174772cc7a40d4a981e109aaab"
49
+ Server:
50
+ - Contentful
51
+ X-Content-Type-Options:
52
+ - nosniff
53
+ X-Contentful-Region:
54
+ - us-east-1
55
+ X-Contentful-Request-Id:
56
+ - 3c7c404eef18163c9a6b5d49eb95e0ed
57
+ Content-Length:
58
+ - '459'
59
+ Accept-Ranges:
60
+ - bytes
61
+ Date:
62
+ - Wed, 12 Sep 2018 11:18:32 GMT
63
+ Via:
64
+ - 1.1 varnish
65
+ Age:
66
+ - '0'
67
+ Connection:
68
+ - close
69
+ X-Served-By:
70
+ - cache-hhn1539-HHN
71
+ X-Cache:
72
+ - MISS
73
+ X-Cache-Hits:
74
+ - '0'
75
+ X-Timer:
76
+ - S1536751113.535747,VS0,VE319
77
+ Vary:
78
+ - Accept-Encoding
79
+ body:
80
+ encoding: ASCII-8BIT
81
+ string: !binary |-
82
+ H4sIAAAAAAAAA91VPW/CMBDd+RXIc0Em0DbKRis6VV1gasVg4kNycZzUNpQU8d9rOyRxoqJSFakfXvCdfffuXu6ZXafbRSpXKOruzNYYOs/AWGgsJcmR8e0v7B2dasKNP3CWWrHMGNgZnCVMG2uAceFgGhKb8cllLPK2YByUykhsscobhdMrxjqcsyzqnokVsqD1MvBiNTsUPXUZWxcYtf080+s8Hr0KordD21a59tXeNVosVMRAsgBKgXoZq1JuU6FBaIfsBcYSiAY6toSgAA/CHg57QTAb4Gg0ivB1PwyvHv2AdUa/FgBiw2QqEgN+EndFKwlRGmSbmlN5nXiYn3InYcMUS4UdicPlilpEmco4ye8YcPdZFinNq6qQIIkbvkmbeERBxZJlusiL6pClzVRPm/1+jXkq2m/A2DsV1I1fgDspSZnmySLlDcoQT2PC2ZsZiai7JFyBP2tIwsuaySOHpnOy4EcOUyMhMzZl1nomD7u5+z3Q+IcVpfQMlD6TnobRJe6HODhZTx8G/C89OQWVQ1kN+bRJ+3fV1ABpqOnBh/99aqrVeq43Qst1rNdG8zPY+nNt/xd/9q0wL8a8s++8A8NDyyriBwAA
83
+ http_version:
84
+ recorded_at: Wed, 12 Sep 2018 11:18:31 GMT
85
+ - request:
86
+ method: get
87
+ uri: https://cdn.contentful.com/spaces/jd7yc4wnatx3/environments/master/entries?sys.id=6NGLswCREsGA28kGouScyY
88
+ body:
89
+ encoding: US-ASCII
90
+ string: ''
91
+ headers:
92
+ X-Contentful-User-Agent:
93
+ - sdk contentful.rb/2.9.1; platform ruby/2.5.1; os macOS/16;
94
+ Authorization:
95
+ - Bearer 6256b8ef7d66805ca41f2728271daf27e8fa6055873b802a813941a0fe696248
96
+ Content-Type:
97
+ - application/vnd.contentful.delivery.v1+json
98
+ Accept-Encoding:
99
+ - gzip
100
+ Connection:
101
+ - close
102
+ Host:
103
+ - cdn.contentful.com
104
+ User-Agent:
105
+ - http.rb/2.2.2
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: OK
110
+ headers:
111
+ Access-Control-Allow-Headers:
112
+ - Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Alpha-Feature
113
+ Access-Control-Allow-Methods:
114
+ - GET,HEAD,OPTIONS
115
+ Access-Control-Allow-Origin:
116
+ - "*"
117
+ Access-Control-Expose-Headers:
118
+ - Etag
119
+ Access-Control-Max-Age:
120
+ - '86400'
121
+ Cache-Control:
122
+ - max-age=0
123
+ Content-Encoding:
124
+ - gzip
125
+ Content-Type:
126
+ - application/vnd.contentful.delivery.v1+json
127
+ Contentful-Api:
128
+ - cda_cached
129
+ Etag:
130
+ - W/"ad6896d8b4604d1307178a506ce1b102"
131
+ Server:
132
+ - Contentful
133
+ X-Content-Type-Options:
134
+ - nosniff
135
+ X-Contentful-Region:
136
+ - us-east-1
137
+ X-Contentful-Request-Id:
138
+ - f59d940c76009e6aea7642be6cee10d5
139
+ Content-Length:
140
+ - '1409'
141
+ Accept-Ranges:
142
+ - bytes
143
+ Date:
144
+ - Wed, 12 Sep 2018 11:18:33 GMT
145
+ Via:
146
+ - 1.1 varnish
147
+ Age:
148
+ - '4243'
149
+ Connection:
150
+ - close
151
+ X-Served-By:
152
+ - cache-hhn1524-HHN
153
+ X-Cache:
154
+ - HIT
155
+ X-Cache-Hits:
156
+ - '1'
157
+ X-Timer:
158
+ - S1536751113.010665,VS0,VE1
159
+ Vary:
160
+ - Accept-Encoding
161
+ body:
162
+ encoding: ASCII-8BIT
163
+ string: !binary |-
164
+ H4sIAAAAAAAAA+0ay27b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yc2z+Sa3F8MPoVNaPUTBMzkfoSE3DmHABNRxim17rklQfx8cQVmdzCOYdzD5ZFy22Nho+mna5kq4c4VYswYbOJ2e3wqkDavT4Bs6CmCP2I3X0SW8KRTsIicPZKgNEywNS855tvMtPdqO/OkxBVJa7LIKNZerrVyokB3KDcReFscMaa51D0cc21DWG71ujatOUSHXkEcQ44nQJt5GE3jhZ4ADarOvMz+E+zTz39P3g//GSUfZ5+ubgfvbqvgFrxvxCnu5Dgb9d2i4e5RhcSeS76LPCbY7B7ZWeYV/v5ZgskxwVY0tuUyhcMe6nHpz0uw68rp4afX7gNei95107cux3I99WzEVYXUgV8RdJUpvWIzBrU9CrZZUzCln7uDvjHKm6bQgNBeHeZVrwhfPRvXSvEUd19hRDtwiPCad9IESNcRMtbQE4pNFJfYFbdnpb1HOT/p/G13iKqxGIpFshSU1StriYtoTfuN5O1XcQsQwTlHzf6Tv5SAn+RRuo6h1HnGMqZd+8tOPwxlVGP3GEZrLri6y6StPWSEXWcXmapHSiGje3XX2k2GyRv6yca9AW0PG55OB0F/ND6V+8nwFENHmT5lpE2x95TZJevoK8OTnOVpLV/e9bMpai/rpipZqcOMtiXyh5+VDT1m9nV059TeaSb0hGeaWq+HxKO6EkvPmXJPZ+o7wwTrVjL/oq4ee+GOqLA9Lp0XZVIdznO/YFKT/pvwiSZlmnI0Kc83Hp0V4z9wkxoYTIra8hf89/Hk8eQHimwRyEctAAA=
165
+ http_version:
166
+ recorded_at: Wed, 12 Sep 2018 11:18:31 GMT
167
+ recorded_with: VCR 4.0.0
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.9.1
4
+ version: 2.9.2
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: 2018-08-24 00:00:00.000000000 Z
13
+ date: 2018-09-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -454,6 +454,7 @@ files:
454
454
  - spec/fixtures/vcr_cassettes/entries/issue_117.yml
455
455
  - spec/fixtures/vcr_cassettes/entries/issue_125.yml
456
456
  - spec/fixtures/vcr_cassettes/entries/structured_text.yml
457
+ - spec/fixtures/vcr_cassettes/entries/structured_text_nested_fields.yml
457
458
  - spec/fixtures/vcr_cassettes/entries/unresolvable_filter.yml
458
459
  - spec/fixtures/vcr_cassettes/entries/unresolvable_filter_deeply_nested.yml
459
460
  - spec/fixtures/vcr_cassettes/entry.yml
@@ -596,6 +597,7 @@ test_files:
596
597
  - spec/fixtures/vcr_cassettes/entries/issue_117.yml
597
598
  - spec/fixtures/vcr_cassettes/entries/issue_125.yml
598
599
  - spec/fixtures/vcr_cassettes/entries/structured_text.yml
600
+ - spec/fixtures/vcr_cassettes/entries/structured_text_nested_fields.yml
599
601
  - spec/fixtures/vcr_cassettes/entries/unresolvable_filter.yml
600
602
  - spec/fixtures/vcr_cassettes/entries/unresolvable_filter_deeply_nested.yml
601
603
  - spec/fixtures/vcr_cassettes/entry.yml