contentful-management 1.0.0 → 1.0.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
  SHA1:
3
- metadata.gz: 4351225d59ca9af60725c79bd71d0717449e68e6
4
- data.tar.gz: fd90f9d188c96f5446f9f920fe6272ca579a45b6
3
+ metadata.gz: 7bb620d6df69c4e84f671fe8a91e91f1fae53310
4
+ data.tar.gz: f1cb940d955248205c1c564d45aa25e8c59de0d4
5
5
  SHA512:
6
- metadata.gz: fc14898bf09f8bbf6f21324bb549708e887a4dc43e132cfe615ef06dc04cfd1f6736566675060aa613d3e6fbecca9017547b247f8c47465bb11979150c25d37e
7
- data.tar.gz: da8832650d78644687acebd327c84ee7477f7b9013730af37d5815a7ee31804cb9c53a08fffb951e5ac7b3a39f7a6af4db03867529e2ad062b426b3a44b6daa6
6
+ metadata.gz: e7b895437b69329cab7a8d4e45454cf304bcedbb911463ed5fd5b92d37b1cc479c31a164ee96ee46991ced0eddcbf38c186544eeeef135a38b819e6382a78d34
7
+ data.tar.gz: ba872718b2b957c72a36956c72db232b1edbb537d14bd18520ccb32a1921666ae423b8b2172c73a1c84894edd40db732f8bddf775af5751294af4a2fa21f3d66
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 1.0.1
6
+ ### Changed
7
+ * Changed locale selection priority when requesting fields [#91](https://github.com/contentful/contentful-management.rb/issues/91)
8
+
5
9
  ## 1.0.0
6
10
  ### Breaking Changes
7
11
  * `Client` is no longer a singleton. Therefore all `Resource` class calls (`Entry`, `Space`, `ContentType`, etc...) require an instance of a client.
@@ -71,8 +71,8 @@ module Contentful
71
71
  # @param [String] wanted_locale
72
72
  #
73
73
  # @return [Hash] localized fields
74
- def fields(wanted_locale = default_locale)
75
- requested_locale = locale || wanted_locale
74
+ def fields(wanted_locale = locale)
75
+ requested_locale = wanted_locale || default_locale
76
76
  @fields[requested_locale] = {} unless @fields[requested_locale]
77
77
 
78
78
  default_fields = @fields[default_locale] || {}
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '1.0.0'
6
+ VERSION = '1.0.1'
7
7
  end
8
8
  end
@@ -0,0 +1,256 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/iv4sic0eru9h/entries/5GrMLWzfyMs0eKoi4sg2ug
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulManagementGem/1.0.0
12
+ Authorization:
13
+ - Bearer <ACCESS_TOKEN>
14
+ Content-Type:
15
+ - application/vnd.contentful.management.v1+json
16
+ Content-Length:
17
+ - '0'
18
+ Connection:
19
+ - close
20
+ Host:
21
+ - api.contentful.com
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Access-Control-Allow-Headers:
28
+ - 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
29
+ Access-Control-Allow-Methods:
30
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Expose-Headers:
34
+ - Etag
35
+ Access-Control-Max-Age:
36
+ - '1728000'
37
+ Cf-Space-Id:
38
+ - iv4sic0eru9h
39
+ Content-Type:
40
+ - application/vnd.contentful.management.v1+json
41
+ Date:
42
+ - Tue, 29 Mar 2016 14:44:50 GMT
43
+ Etag:
44
+ - '"713c1a621dc27a6680086a0b7095a50a"'
45
+ Server:
46
+ - nginx
47
+ Strict-Transport-Security:
48
+ - max-age=15768000
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Contentful-Request-Id:
52
+ - content-api:5rY7VFgKiseaqGmoIkemKk
53
+ X-Powered-By:
54
+ - Express
55
+ Content-Length:
56
+ - '1101'
57
+ Connection:
58
+ - Close
59
+ Set-Cookie:
60
+ - incap_ses_298_673446=mwF2XL/LHQwHYwYtJrYiBOKU+lYAAAAA9krrCagofL8MiLJ5sMlDYA==;
61
+ path=/; Domain=.contentful.com
62
+ - nlbi_673446=UpBdbmCArwwN0HWPaoBaJgAAAADmzA/SEcWb9AhSVHk0UwGu; path=/; Domain=.contentful.com
63
+ - visid_incap_673446=lUndMoT/Sg2k89hEPcQuKuKU+lYAAAAAQUIPAAAAAAC5JEUUCubFQpBRGmE0ZymW;
64
+ expires=Tue, 28 Mar 2017 23:23:00 GMT; path=/; Domain=.contentful.com
65
+ X-Iinfo:
66
+ - 0-49836165-49836186 NNNN CT(142 141 0) RT(1459262688720 114) q(0 0 3 -1) r(12
67
+ 12) U5
68
+ X-Cdn:
69
+ - Incapsula
70
+ body:
71
+ encoding: UTF-8
72
+ string: |
73
+ {
74
+ "sys": {
75
+ "id": "5GrMLWzfyMs0eKoi4sg2ug",
76
+ "type": "Entry",
77
+ "createdAt": "2016-03-29T14:43:21.462Z",
78
+ "createdBy": {
79
+ "sys": {
80
+ "type": "Link",
81
+ "linkType": "User",
82
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
83
+ }
84
+ },
85
+ "space": {
86
+ "sys": {
87
+ "type": "Link",
88
+ "linkType": "Space",
89
+ "id": "iv4sic0eru9h"
90
+ }
91
+ },
92
+ "contentType": {
93
+ "sys": {
94
+ "type": "Link",
95
+ "linkType": "ContentType",
96
+ "id": "localeTest"
97
+ }
98
+ },
99
+ "firstPublishedAt": "2016-03-29T14:43:38.029Z",
100
+ "publishedCounter": 1,
101
+ "publishedAt": "2016-03-29T14:43:38.029Z",
102
+ "publishedBy": {
103
+ "sys": {
104
+ "type": "Link",
105
+ "linkType": "User",
106
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
107
+ }
108
+ },
109
+ "publishedVersion": 8,
110
+ "version": 9,
111
+ "updatedAt": "2016-03-29T14:43:38.036Z",
112
+ "updatedBy": {
113
+ "sys": {
114
+ "type": "Link",
115
+ "linkType": "User",
116
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
117
+ }
118
+ }
119
+ },
120
+ "fields": {
121
+ "test": {
122
+ "en-US": "foo",
123
+ "es": "bar"
124
+ }
125
+ }
126
+ }
127
+ http_version:
128
+ recorded_at: Tue, 29 Mar 2016 14:44:50 GMT
129
+ - request:
130
+ method: get
131
+ uri: https://api.contentful.com/spaces/iv4sic0eru9h/content_types/localeTest
132
+ body:
133
+ encoding: US-ASCII
134
+ string: ''
135
+ headers:
136
+ User-Agent:
137
+ - RubyContentfulManagementGem/1.0.0
138
+ Authorization:
139
+ - Bearer <ACCESS_TOKEN>
140
+ Content-Type:
141
+ - application/vnd.contentful.management.v1+json
142
+ Content-Length:
143
+ - '0'
144
+ Connection:
145
+ - close
146
+ Host:
147
+ - api.contentful.com
148
+ response:
149
+ status:
150
+ code: 200
151
+ message: OK
152
+ headers:
153
+ Access-Control-Allow-Headers:
154
+ - 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
155
+ Access-Control-Allow-Methods:
156
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
157
+ Access-Control-Allow-Origin:
158
+ - "*"
159
+ Access-Control-Expose-Headers:
160
+ - Etag
161
+ Access-Control-Max-Age:
162
+ - '1728000'
163
+ Cf-Space-Id:
164
+ - iv4sic0eru9h
165
+ Content-Type:
166
+ - application/vnd.contentful.management.v1+json
167
+ Date:
168
+ - Tue, 29 Mar 2016 14:44:52 GMT
169
+ Etag:
170
+ - '"ca61fa30dee92a108318d69e9755340d"'
171
+ Server:
172
+ - nginx
173
+ Strict-Transport-Security:
174
+ - max-age=15768000
175
+ X-Content-Type-Options:
176
+ - nosniff
177
+ X-Contentful-Request-Id:
178
+ - content-api:1yyOlhYoI4U8cAos06Ee2y
179
+ X-Powered-By:
180
+ - Express
181
+ Content-Length:
182
+ - '1146'
183
+ Connection:
184
+ - Close
185
+ Set-Cookie:
186
+ - incap_ses_298_673446=Okc9Vzd1z0mtZQYtJrYiBOOU+lYAAAAAbIDRY0WivDZALbvilASlag==;
187
+ path=/; Domain=.contentful.com
188
+ - nlbi_673446=l8eTKu2a0Gda1EdUaoBaJgAAAABkAEu5aWbUIOVMVgkyz7J3; path=/; Domain=.contentful.com
189
+ - visid_incap_673446=bTnpq/PaTGWA7Z6KC2Mg/OOU+lYAAAAAQUIPAAAAAACdCN48/foqfFg6cCCRX408;
190
+ expires=Tue, 28 Mar 2017 23:23:00 GMT; path=/; Domain=.contentful.com
191
+ X-Iinfo:
192
+ - 1-71448780-71448803 NNNN CT(156 138 0) RT(1459262690162 102) q(0 0 3 -1) r(13
193
+ 13) U5
194
+ X-Cdn:
195
+ - Incapsula
196
+ body:
197
+ encoding: UTF-8
198
+ string: |
199
+ {
200
+ "name": "LocaleTest",
201
+ "fields": [
202
+ {
203
+ "name": "test",
204
+ "id": "test",
205
+ "type": "Symbol",
206
+ "localized": true,
207
+ "validations": [],
208
+ "required": false,
209
+ "disabled": false
210
+ }
211
+ ],
212
+ "displayField": "test",
213
+ "description": "",
214
+ "sys": {
215
+ "id": "localeTest",
216
+ "type": "ContentType",
217
+ "createdAt": "2016-03-29T14:43:00.128Z",
218
+ "createdBy": {
219
+ "sys": {
220
+ "type": "Link",
221
+ "linkType": "User",
222
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
223
+ }
224
+ },
225
+ "space": {
226
+ "sys": {
227
+ "type": "Link",
228
+ "linkType": "Space",
229
+ "id": "iv4sic0eru9h"
230
+ }
231
+ },
232
+ "firstPublishedAt": "2016-03-29T14:43:00.564Z",
233
+ "publishedCounter": 1,
234
+ "publishedAt": "2016-03-29T14:43:00.564Z",
235
+ "publishedBy": {
236
+ "sys": {
237
+ "type": "Link",
238
+ "linkType": "User",
239
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
240
+ }
241
+ },
242
+ "publishedVersion": 1,
243
+ "version": 2,
244
+ "updatedAt": "2016-03-29T14:43:00.580Z",
245
+ "updatedBy": {
246
+ "sys": {
247
+ "type": "Link",
248
+ "linkType": "User",
249
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
250
+ }
251
+ }
252
+ }
253
+ }
254
+ http_version:
255
+ recorded_at: Tue, 29 Mar 2016 14:44:52 GMT
256
+ recorded_with: VCR 2.9.3
@@ -780,6 +780,19 @@ module Contentful
780
780
  }
781
781
  end
782
782
 
783
+ it 'fields_for_query get properly updated when setting a field using _with_locales - #91' do
784
+ vcr('entry/issue_91') {
785
+ entry = client.entries.find('iv4sic0eru9h', '5GrMLWzfyMs0eKoi4sg2ug')
786
+
787
+ expect(entry.test_with_locales).to eq('en-US' => 'foo', 'es' => 'bar')
788
+
789
+ entry.test_with_locales = {'en-US' => 'baz', 'es' => 'foobar'}
790
+
791
+ expect(entry.test_with_locales).to eq('en-US' => 'baz', 'es' => 'foobar')
792
+ expect(entry.fields_for_query).to eq(test: { 'en-US' => 'baz', 'es' => 'foobar' })
793
+ }
794
+ end
795
+
783
796
  describe 'it can properly assign, save and publish - #61' do
784
797
  describe 'on an entry created through the api' do
785
798
  describe 'before refetch' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Protas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-15 00:00:00.000000000 Z
13
+ date: 2016-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -391,6 +391,7 @@ files:
391
391
  - spec/fixtures/vcr_cassettes/entry/issue_61_spaces.yml
392
392
  - spec/fixtures/vcr_cassettes/entry/issue_70.yml
393
393
  - spec/fixtures/vcr_cassettes/entry/issue_73.yml
394
+ - spec/fixtures/vcr_cassettes/entry/issue_91.yml
394
395
  - spec/fixtures/vcr_cassettes/entry/limited_entries.yml
395
396
  - spec/fixtures/vcr_cassettes/entry/locales/fallback_to_default_locale.yml
396
397
  - spec/fixtures/vcr_cassettes/entry/locales/retrieve_localized.yml
@@ -667,6 +668,7 @@ test_files:
667
668
  - spec/fixtures/vcr_cassettes/entry/issue_61_spaces.yml
668
669
  - spec/fixtures/vcr_cassettes/entry/issue_70.yml
669
670
  - spec/fixtures/vcr_cassettes/entry/issue_73.yml
671
+ - spec/fixtures/vcr_cassettes/entry/issue_91.yml
670
672
  - spec/fixtures/vcr_cassettes/entry/limited_entries.yml
671
673
  - spec/fixtures/vcr_cassettes/entry/locales/fallback_to_default_locale.yml
672
674
  - spec/fixtures/vcr_cassettes/entry/locales/retrieve_localized.yml