contentful-management 2.9.0 → 2.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/README.md +19 -13
  4. data/contentful-management.gemspec +6 -5
  5. data/lib/contentful/management/client.rb +10 -12
  6. data/lib/contentful/management/{client_usage_period_methods_factory.rb → client_organization_periodic_usage_methods_factory.rb} +3 -4
  7. data/lib/contentful/management/client_space_methods_factory.rb +2 -2
  8. data/lib/contentful/management/{client_api_usage_methods_factory.rb → client_space_periodic_usage_methods_factory.rb} +4 -11
  9. data/lib/contentful/management/entry.rb +14 -12
  10. data/lib/contentful/management/environment.rb +3 -2
  11. data/lib/contentful/management/organization.rb +8 -8
  12. data/lib/contentful/management/{api_usage.rb → organization_periodic_usage.rb} +13 -18
  13. data/lib/contentful/management/resource.rb +7 -4
  14. data/lib/contentful/management/resource/environment_aware.rb +11 -8
  15. data/lib/contentful/management/resource_builder.rb +5 -6
  16. data/lib/contentful/management/space.rb +2 -2
  17. data/lib/contentful/management/{usage_period.rb → space_periodic_usage.rb} +12 -9
  18. data/lib/contentful/management/validation.rb +6 -1
  19. data/lib/contentful/management/version.rb +1 -1
  20. data/spec/fixtures/vcr_cassettes/asset/196_environment_id.yml +140 -0
  21. data/spec/fixtures/vcr_cassettes/content_type/196_retain_environment_id.yml +150 -0
  22. data/spec/fixtures/vcr_cassettes/entry/issue_215_1.yml +905 -0
  23. data/spec/fixtures/vcr_cassettes/entry/issue_215_2.yml +899 -0
  24. data/spec/fixtures/vcr_cassettes/entry/issue_215_3.yml +893 -0
  25. data/spec/fixtures/vcr_cassettes/organization_periodic_usage/all.yml +368 -0
  26. data/spec/fixtures/vcr_cassettes/organization_periodic_usage/filters.yml +167 -0
  27. data/spec/fixtures/vcr_cassettes/space_periodic_usage/all.yml +6800 -0
  28. data/spec/fixtures/vcr_cassettes/space_periodic_usage/filters.yml +1976 -0
  29. data/spec/lib/contentful/management/asset_spec.rb +8 -0
  30. data/spec/lib/contentful/management/content_type_spec.rb +6 -0
  31. data/spec/lib/contentful/management/entry_spec.rb +48 -0
  32. data/spec/lib/contentful/management/organization_periodic_usage_spec.rb +36 -0
  33. data/spec/lib/contentful/management/space_periodic_usage_spec.rb +36 -0
  34. metadata +60 -32
  35. data/spec/fixtures/vcr_cassettes/api_usage/all.yml +0 -155
  36. data/spec/fixtures/vcr_cassettes/usage_period/all.yml +0 -114
  37. data/spec/lib/contentful/management/api_usage_spec.rb +0 -28
  38. data/spec/lib/contentful/management/usage_period_spec.rb +0 -27
@@ -0,0 +1,368 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/organizations/org_id/organization_periodic_usages
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/2.11.0; platform ruby/2.6.3; os macOS/18;
12
+ Authorization:
13
+ - Bearer <ACCESS_TOKEN>
14
+ Content-Type:
15
+ - application/vnd.contentful.management.v1+json
16
+ Connection:
17
+ - close
18
+ Host:
19
+ - api.contentful.com
20
+ User-Agent:
21
+ - http.rb/4.1.1
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Accept-Ranges:
28
+ - bytes
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,X-Contentful-Source-Environment,X-Contentful-Team,X-Contentful-Parent-Id,x-contentful-validate-only,X-Contentful-Marketplace
31
+ Access-Control-Allow-Methods:
32
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Expose-Headers:
36
+ - Etag
37
+ Access-Control-Max-Age:
38
+ - '1728000'
39
+ Cache-Control:
40
+ - max-age=0
41
+ Cf-Organization-Id:
42
+ - org_id
43
+ Content-Type:
44
+ - application/vnd.contentful.management.v1+json
45
+ Contentful-Api:
46
+ - cma
47
+ Date:
48
+ - Fri, 28 Feb 2020 14:42:27 GMT
49
+ Etag:
50
+ - W/"d2185e97c2daf1cd0f0be72a79f7b315"
51
+ Referrer-Policy:
52
+ - strict-origin-when-cross-origin
53
+ Server:
54
+ - Contentful
55
+ Strict-Transport-Security:
56
+ - max-age=15768000
57
+ X-Content-Type-Options:
58
+ - nosniff
59
+ X-Contentful-Request-Id:
60
+ - 36e77549021b20853a9535e89d0bdd4e
61
+ X-Download-Options:
62
+ - noopen
63
+ X-Frame-Options:
64
+ - ALLOWALL
65
+ X-Permitted-Cross-Domain-Policies:
66
+ - none
67
+ X-Xss-Protection:
68
+ - 1; mode=block
69
+ Content-Length:
70
+ - '6586'
71
+ Connection:
72
+ - Close
73
+ Set-Cookie:
74
+ - incap_ses_876_673446=yp+VcZuKci5d35NHZS4oDNImWV4AAAAAqAbS4TY59bq7c7UoUQsrmA==;
75
+ path=/; Domain=.contentful.com
76
+ - nlbi_673446=9x0YNII5ygys9olsYMlkBAAAAAAYBop9w7vJ9Qre8KLQ27zB; path=/; Domain=.contentful.com
77
+ - visid_incap_673446=C/6W96tTQ8qknLo2jzjsgNImWV4AAAAAQUIPAAAAAABjOhaX4s1ZCfVNuGwkxVaw;
78
+ expires=Fri, 26 Feb 2021 18:55:11 GMT; path=/; Domain=.contentful.com
79
+ X-Cdn:
80
+ - Incapsula
81
+ X-Iinfo:
82
+ - 10-14741526-14741528 NNNY CT(0 0 0) RT(1582900946537 55) q(0 0 0 -1) r(2 2)
83
+ U5
84
+ body:
85
+ encoding: ASCII-8BIT
86
+ string: |+
87
+ {
88
+ "total":4,
89
+ "limit":100,
90
+ "skip":0,
91
+ "sys":{
92
+ "type":"Array"
93
+ },
94
+ "items":[
95
+ {
96
+ "metric":"cma",
97
+ "usage":22951,
98
+ "usagePerDay":{
99
+ "2020-01-15":2629,
100
+ "2020-01-16":12,
101
+ "2020-01-17":874,
102
+ "2020-01-18":0,
103
+ "2020-01-19":0,
104
+ "2020-01-20":797,
105
+ "2020-01-21":483,
106
+ "2020-01-22":169,
107
+ "2020-01-23":185,
108
+ "2020-01-24":251,
109
+ "2020-01-25":0,
110
+ "2020-01-26":0,
111
+ "2020-01-27":1502,
112
+ "2020-01-28":161,
113
+ "2020-01-29":33,
114
+ "2020-01-30":49,
115
+ "2020-01-31":305,
116
+ "2020-02-01":0,
117
+ "2020-02-02":0,
118
+ "2020-02-03":541,
119
+ "2020-02-04":6083,
120
+ "2020-02-05":4185,
121
+ "2020-02-06":38,
122
+ "2020-02-07":87,
123
+ "2020-02-08":0,
124
+ "2020-02-09":28,
125
+ "2020-02-10":81,
126
+ "2020-02-11":433,
127
+ "2020-02-12":558,
128
+ "2020-02-13":82,
129
+ "2020-02-14":0,
130
+ "2020-02-15":126,
131
+ "2020-02-16":0,
132
+ "2020-02-17":1165,
133
+ "2020-02-18":656,
134
+ "2020-02-19":178,
135
+ "2020-02-20":133,
136
+ "2020-02-21":645,
137
+ "2020-02-22":0,
138
+ "2020-02-23":0,
139
+ "2020-02-24":0,
140
+ "2020-02-25":0,
141
+ "2020-02-26":324,
142
+ "2020-02-27":132,
143
+ "2020-02-28":26
144
+ },
145
+ "unitOfMeasure":"apiRequestsCount",
146
+ "sys":{
147
+ "type":"OrganizationPeriodicUsage",
148
+ "id":"usage-cma-org_id-2020-01-15-2020-02-28",
149
+ "organization":{
150
+ "sys":{
151
+ "type":"Link",
152
+ "linkType":"Organization",
153
+ "id":"org_id"
154
+ }
155
+ }
156
+ },
157
+ "dateRange":{
158
+ "startAt":"2020-01-15",
159
+ "endAt":"2020-02-28"
160
+ }
161
+ },
162
+ {
163
+ "metric":"cda",
164
+ "usage":961,
165
+ "usagePerDay":{
166
+ "2020-01-15":0,
167
+ "2020-01-16":0,
168
+ "2020-01-17":9,
169
+ "2020-01-18":0,
170
+ "2020-01-19":0,
171
+ "2020-01-20":21,
172
+ "2020-01-21":1,
173
+ "2020-01-22":0,
174
+ "2020-01-23":7,
175
+ "2020-01-24":0,
176
+ "2020-01-25":0,
177
+ "2020-01-26":0,
178
+ "2020-01-27":0,
179
+ "2020-01-28":0,
180
+ "2020-01-29":0,
181
+ "2020-01-30":0,
182
+ "2020-01-31":6,
183
+ "2020-02-01":0,
184
+ "2020-02-02":0,
185
+ "2020-02-03":521,
186
+ "2020-02-04":180,
187
+ "2020-02-05":157,
188
+ "2020-02-06":0,
189
+ "2020-02-07":9,
190
+ "2020-02-08":0,
191
+ "2020-02-09":0,
192
+ "2020-02-10":0,
193
+ "2020-02-11":0,
194
+ "2020-02-12":0,
195
+ "2020-02-13":0,
196
+ "2020-02-14":0,
197
+ "2020-02-15":10,
198
+ "2020-02-16":0,
199
+ "2020-02-17":0,
200
+ "2020-02-18":0,
201
+ "2020-02-19":0,
202
+ "2020-02-20":0,
203
+ "2020-02-21":0,
204
+ "2020-02-22":0,
205
+ "2020-02-23":0,
206
+ "2020-02-24":0,
207
+ "2020-02-25":1,
208
+ "2020-02-26":39,
209
+ "2020-02-27":0,
210
+ "2020-02-28":0
211
+ },
212
+ "unitOfMeasure":"apiRequestsCount",
213
+ "sys":{
214
+ "type":"OrganizationPeriodicUsage",
215
+ "id":"usage-cda-org_id-2020-01-15-2020-02-28",
216
+ "organization":{
217
+ "sys":{
218
+ "type":"Link",
219
+ "linkType":"Organization",
220
+ "id":"org_id"
221
+ }
222
+ }
223
+ },
224
+ "dateRange":{
225
+ "startAt":"2020-01-15",
226
+ "endAt":"2020-02-28"
227
+ }
228
+ },
229
+ {
230
+ "metric":"gql",
231
+ "usage":51,
232
+ "usagePerDay":{
233
+ "2020-01-15":1,
234
+ "2020-01-16":1,
235
+ "2020-01-17":1,
236
+ "2020-01-18":1,
237
+ "2020-01-19":1,
238
+ "2020-01-20":1,
239
+ "2020-01-21":1,
240
+ "2020-01-22":1,
241
+ "2020-01-23":1,
242
+ "2020-01-24":1,
243
+ "2020-01-25":1,
244
+ "2020-01-26":1,
245
+ "2020-01-27":1,
246
+ "2020-01-28":2,
247
+ "2020-01-29":6,
248
+ "2020-01-30":1,
249
+ "2020-01-31":1,
250
+ "2020-02-01":1,
251
+ "2020-02-02":1,
252
+ "2020-02-03":1,
253
+ "2020-02-04":1,
254
+ "2020-02-05":1,
255
+ "2020-02-06":1,
256
+ "2020-02-07":1,
257
+ "2020-02-08":1,
258
+ "2020-02-09":1,
259
+ "2020-02-10":1,
260
+ "2020-02-11":1,
261
+ "2020-02-12":1,
262
+ "2020-02-13":1,
263
+ "2020-02-14":1,
264
+ "2020-02-15":2,
265
+ "2020-02-16":1,
266
+ "2020-02-17":1,
267
+ "2020-02-18":1,
268
+ "2020-02-19":1,
269
+ "2020-02-20":1,
270
+ "2020-02-21":1,
271
+ "2020-02-22":1,
272
+ "2020-02-23":1,
273
+ "2020-02-24":1,
274
+ "2020-02-25":1,
275
+ "2020-02-26":0,
276
+ "2020-02-27":1,
277
+ "2020-02-28":1
278
+ },
279
+ "unitOfMeasure":"apiRequestsCount",
280
+ "sys":{
281
+ "type":"OrganizationPeriodicUsage",
282
+ "id":"usage-gql-org_id-2020-01-15-2020-02-28",
283
+ "organization":{
284
+ "sys":{
285
+ "type":"Link",
286
+ "linkType":"Organization",
287
+ "id":"org_id"
288
+ }
289
+ }
290
+ },
291
+ "dateRange":{
292
+ "startAt":"2020-01-15",
293
+ "endAt":"2020-02-28"
294
+ }
295
+ },
296
+ {
297
+ "metric":"cpa",
298
+ "usage":1,
299
+ "usagePerDay":{
300
+ "2020-01-15":0,
301
+ "2020-01-16":0,
302
+ "2020-01-17":0,
303
+ "2020-01-18":0,
304
+ "2020-01-19":0,
305
+ "2020-01-20":0,
306
+ "2020-01-21":0,
307
+ "2020-01-22":0,
308
+ "2020-01-23":0,
309
+ "2020-01-24":0,
310
+ "2020-01-25":0,
311
+ "2020-01-26":0,
312
+ "2020-01-27":0,
313
+ "2020-01-28":0,
314
+ "2020-01-29":0,
315
+ "2020-01-30":0,
316
+ "2020-01-31":0,
317
+ "2020-02-01":0,
318
+ "2020-02-02":0,
319
+ "2020-02-03":1,
320
+ "2020-02-04":0,
321
+ "2020-02-05":0,
322
+ "2020-02-06":0,
323
+ "2020-02-07":0,
324
+ "2020-02-08":0,
325
+ "2020-02-09":0,
326
+ "2020-02-10":0,
327
+ "2020-02-11":0,
328
+ "2020-02-12":0,
329
+ "2020-02-13":0,
330
+ "2020-02-14":0,
331
+ "2020-02-15":0,
332
+ "2020-02-16":0,
333
+ "2020-02-17":0,
334
+ "2020-02-18":0,
335
+ "2020-02-19":0,
336
+ "2020-02-20":0,
337
+ "2020-02-21":0,
338
+ "2020-02-22":0,
339
+ "2020-02-23":0,
340
+ "2020-02-24":0,
341
+ "2020-02-25":0,
342
+ "2020-02-26":0,
343
+ "2020-02-27":0,
344
+ "2020-02-28":0
345
+ },
346
+ "unitOfMeasure":"apiRequestsCount",
347
+ "sys":{
348
+ "type":"OrganizationPeriodicUsage",
349
+ "id":"usage-cpa-org_id-2020-01-15-2020-02-28",
350
+ "organization":{
351
+ "sys":{
352
+ "type":"Link",
353
+ "linkType":"Organization",
354
+ "id":"org_id"
355
+ }
356
+ }
357
+ },
358
+ "dateRange":{
359
+ "startAt":"2020-01-15",
360
+ "endAt":"2020-02-28"
361
+ }
362
+ }
363
+ ]
364
+ }
365
+
366
+ http_version:
367
+ recorded_at: Fri, 28 Feb 2020 14:42:27 GMT
368
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,167 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/organizations/org_id/organization_periodic_usages?metric%5Bin%5D=cda
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/2.11.0; platform ruby/2.6.3; os macOS/18;
12
+ Authorization:
13
+ - Bearer <ACCESS_TOKEN>
14
+ Content-Type:
15
+ - application/vnd.contentful.management.v1+json
16
+ Connection:
17
+ - close
18
+ Host:
19
+ - api.contentful.com
20
+ User-Agent:
21
+ - http.rb/4.1.1
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Accept-Ranges:
28
+ - bytes
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,X-Contentful-Source-Environment,X-Contentful-Team,X-Contentful-Parent-Id,x-contentful-validate-only,X-Contentful-Marketplace
31
+ Access-Control-Allow-Methods:
32
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
33
+ Access-Control-Allow-Origin:
34
+ - "*"
35
+ Access-Control-Expose-Headers:
36
+ - Etag
37
+ Access-Control-Max-Age:
38
+ - '1728000'
39
+ Cache-Control:
40
+ - max-age=0
41
+ Cf-Organization-Id:
42
+ - org_id
43
+ Content-Type:
44
+ - application/vnd.contentful.management.v1+json
45
+ Contentful-Api:
46
+ - cma
47
+ Date:
48
+ - Fri, 28 Feb 2020 14:43:40 GMT
49
+ Etag:
50
+ - W/"cd9282eb71e221f415ae9025f7f9f118"
51
+ Referrer-Policy:
52
+ - strict-origin-when-cross-origin
53
+ Server:
54
+ - Contentful
55
+ Strict-Transport-Security:
56
+ - max-age=15768000
57
+ X-Content-Type-Options:
58
+ - nosniff
59
+ X-Contentful-Request-Id:
60
+ - 1947e342e8f3266012b951a32d377445
61
+ X-Download-Options:
62
+ - noopen
63
+ X-Frame-Options:
64
+ - ALLOWALL
65
+ X-Permitted-Cross-Domain-Policies:
66
+ - none
67
+ X-Xss-Protection:
68
+ - 1; mode=block
69
+ Content-Length:
70
+ - '1709'
71
+ Connection:
72
+ - Close
73
+ Set-Cookie:
74
+ - incap_ses_876_673446=UM/bajl3kWOxJ5RHZS4oDBsnWV4AAAAAl0pEff/Ge1a9gunfczUgdw==;
75
+ path=/; Domain=.contentful.com
76
+ - nlbi_673446=f1gSfflB8A8DKoDNYMlkBAAAAACQKtjpXtWjdqq1W4HP+qlq; path=/; Domain=.contentful.com
77
+ - visid_incap_673446=LQklok20S/GMRr5UPZJ0zxsnWV4AAAAAQUIPAAAAAAACceMWg4BP/mv5a8tEbXbv;
78
+ expires=Fri, 26 Feb 2021 18:55:11 GMT; path=/; Domain=.contentful.com
79
+ X-Cdn:
80
+ - Incapsula
81
+ X-Iinfo:
82
+ - 12-42383868-42383874 NNNY CT(0 0 0) RT(1582901019713 53) q(0 0 0 -1) r(1 1)
83
+ U5
84
+ body:
85
+ encoding: ASCII-8BIT
86
+ string: |+
87
+ {
88
+ "total":1,
89
+ "limit":100,
90
+ "skip":0,
91
+ "sys":{
92
+ "type":"Array"
93
+ },
94
+ "items":[
95
+ {
96
+ "metric":"cda",
97
+ "usage":961,
98
+ "usagePerDay":{
99
+ "2020-01-15":0,
100
+ "2020-01-16":0,
101
+ "2020-01-17":9,
102
+ "2020-01-18":0,
103
+ "2020-01-19":0,
104
+ "2020-01-20":21,
105
+ "2020-01-21":1,
106
+ "2020-01-22":0,
107
+ "2020-01-23":7,
108
+ "2020-01-24":0,
109
+ "2020-01-25":0,
110
+ "2020-01-26":0,
111
+ "2020-01-27":0,
112
+ "2020-01-28":0,
113
+ "2020-01-29":0,
114
+ "2020-01-30":0,
115
+ "2020-01-31":6,
116
+ "2020-02-01":0,
117
+ "2020-02-02":0,
118
+ "2020-02-03":521,
119
+ "2020-02-04":180,
120
+ "2020-02-05":157,
121
+ "2020-02-06":0,
122
+ "2020-02-07":9,
123
+ "2020-02-08":0,
124
+ "2020-02-09":0,
125
+ "2020-02-10":0,
126
+ "2020-02-11":0,
127
+ "2020-02-12":0,
128
+ "2020-02-13":0,
129
+ "2020-02-14":0,
130
+ "2020-02-15":10,
131
+ "2020-02-16":0,
132
+ "2020-02-17":0,
133
+ "2020-02-18":0,
134
+ "2020-02-19":0,
135
+ "2020-02-20":0,
136
+ "2020-02-21":0,
137
+ "2020-02-22":0,
138
+ "2020-02-23":0,
139
+ "2020-02-24":0,
140
+ "2020-02-25":1,
141
+ "2020-02-26":39,
142
+ "2020-02-27":0,
143
+ "2020-02-28":0
144
+ },
145
+ "unitOfMeasure":"apiRequestsCount",
146
+ "sys":{
147
+ "type":"OrganizationPeriodicUsage",
148
+ "id":"usage-cda-org_id-2020-01-15-2020-02-28",
149
+ "organization":{
150
+ "sys":{
151
+ "type":"Link",
152
+ "linkType":"Organization",
153
+ "id":"org_id"
154
+ }
155
+ }
156
+ },
157
+ "dateRange":{
158
+ "startAt":"2020-01-15",
159
+ "endAt":"2020-02-28"
160
+ }
161
+ }
162
+ ]
163
+ }
164
+
165
+ http_version:
166
+ recorded_at: Fri, 28 Feb 2020 14:43:40 GMT
167
+ recorded_with: VCR 4.0.0