contentful-management 2.9.1 → 2.10.0

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: 4874bf1c1821fdad9b895fb83cfb53f01dbeb161220c2d5e35f6b266b70a75bc
4
- data.tar.gz: 31a641e0b306c5608187591ca2eb7f89024952ece5989243683c2d7ff3effa5a
3
+ metadata.gz: a8e47f9397c8d3c6481770f27abc03ad28789d7c4a60f504a9ce9ebd862fa634
4
+ data.tar.gz: 71e9d37e046d4c5027bbe2b596f2ddf94d6000d36bfad0c088dd6f7fbff63846
5
5
  SHA512:
6
- metadata.gz: e8eb04ac563ffc9e81b47dd2078023d27caa879472c96ea02863e2491819b9bcc2f6e73f25d636ebc2957e40863dc76afbd2bdb4b63232b2dbb2c59012670c58
7
- data.tar.gz: a2332fbc5da6136910d0f7232cc8a9ca6d545aaec1804cdce12f6c8272f086f6951bf90fd6e668d1b002f55cccac9c02ca29a834b8c34a6d69f122ecaa030d92
6
+ metadata.gz: 232a59d47e991f9f01acbadc31136b877729f6c51efd198280fbb29311aea0bfb4b85f8ae3ac866d8a90b9aad68c3c2004fd04ebeded9dec1ab5f24c902bf865
7
+ data.tar.gz: 5915e699b6f16935b5266ab0964b105d60728b8ecf1d6796e5c2e9d685475f32ae5e81b6c50220b9828f7403f30a5db2b5caadd8d63568480cf2c2e225721f79
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 2.10.0
6
+ ### Added
7
+ * Added support for query parameters on the Space endpoints. [#197](https://github.com/contentful/contentful-management.rb/pull/197)
8
+
9
+ ### Fixed
10
+ * Fixed environment aware resources that were not having the `environment_id` properly calculated. [#195](https://github.com/contentful/contentful-management.rb/pull/195)
11
+
12
+ ### Changed
13
+ * Relaxed maximum allowed version of the `json` gem. [#196](https://github.com/contentful/contentful-management.rb/pull/196)
14
+
5
15
  ## 2.9.1
6
16
  ### Fixed
7
17
  * Default locale is now fetched from the client instead of passed around. [#194](https://github.com/contentful/contentful-management.rb/pull/194)
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_dependency 'http', '> 1.0', '< 3.0'
21
21
  spec.add_dependency 'multi_json', '~> 1'
22
- spec.add_dependency 'json', '~> 1.8'
22
+ spec.add_dependency 'json', '>= 1.8', '< 3.0'
23
23
 
24
24
  spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'rake', '< 11.0'
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'guard-yard'
33
33
  spec.add_development_dependency 'rubocop', '~> 0.49.1'
34
34
  spec.add_development_dependency 'listen', '~> 3.0'
35
- spec.add_development_dependency 'vcr'
35
+ spec.add_development_dependency 'vcr', '~> 4.0'
36
36
  spec.add_development_dependency 'webmock', '~> 1', '>= 1.17.3'
37
37
  spec.add_development_dependency 'simplecov'
38
38
  end
@@ -15,8 +15,8 @@ module Contentful
15
15
  # Gets a collection of spaces.
16
16
  #
17
17
  # @return [Contentful::Management::Array<Contentful::Management::Space>]
18
- def all
19
- @resource_requester.all
18
+ def all(query = {})
19
+ @resource_requester.all({}, query)
20
20
  end
21
21
 
22
22
  # Gets a specific space.
@@ -6,14 +6,17 @@ module Contentful
6
6
  # Gets the environment ID for the resource.
7
7
  def environment_id
8
8
  env = sys.fetch(:environment, {})
9
- case env
10
- when ::Hash
11
- env.fetch(:id, 'master')
12
- when ::Contentful::Management::Link
13
- env.id
14
- else
15
- 'master'
16
- end
9
+ env_from_sys =
10
+ case env
11
+ when ::Hash
12
+ env.fetch(:id, nil)
13
+ when ::Contentful::Management::Link, ::Contentful::Management::Environment
14
+ env.id
15
+ end
16
+
17
+ return env_from_sys if env_from_sys
18
+
19
+ respond_to?(:content_type) && content_type && content_type.environment_id || 'master'
17
20
  end
18
21
  end
19
22
  end
@@ -35,8 +35,8 @@ module Contentful
35
35
  # @param [Contentful::Management::Client] client
36
36
  #
37
37
  # @return [Contentful::Management::Array<Contentful::Management::Space>]
38
- def self.all(client)
39
- ClientSpaceMethodsFactory.new(client).all
38
+ def self.all(client, query = {})
39
+ ClientSpaceMethodsFactory.new(client).all(query)
40
40
  end
41
41
 
42
42
  # Gets a specific space.
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '2.9.1'.freeze
6
+ VERSION = '2.10.0'.freeze
7
7
  end
8
8
  end
@@ -0,0 +1,140 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/testing
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/2.10.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/2.2.2
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
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
+ - 4SsuxQCaMaemfIms52Jr8s
43
+ Cf-Space-Id:
44
+ - facgnwwgj5fe
45
+ Content-Type:
46
+ - application/vnd.contentful.management.v1+json
47
+ Contentful-Api:
48
+ - cma
49
+ Date:
50
+ - Wed, 12 Jun 2019 09:50:55 GMT
51
+ Etag:
52
+ - W/"b5f8d465c58fdb2d4de7e800b00f1eaa"
53
+ Referrer-Policy:
54
+ - strict-origin-when-cross-origin
55
+ Server:
56
+ - Contentful
57
+ Strict-Transport-Security:
58
+ - max-age=15768000
59
+ X-Content-Type-Options:
60
+ - nosniff
61
+ X-Contentful-Ratelimit-Hour-Limit:
62
+ - '36000'
63
+ X-Contentful-Ratelimit-Hour-Remaining:
64
+ - '35999'
65
+ X-Contentful-Ratelimit-Reset:
66
+ - '0'
67
+ X-Contentful-Ratelimit-Second-Limit:
68
+ - '10'
69
+ X-Contentful-Ratelimit-Second-Remaining:
70
+ - '9'
71
+ X-Contentful-Request-Id:
72
+ - 2373953b0bf0c685ba5661a9fe0b5d67
73
+ X-Download-Options:
74
+ - noopen
75
+ X-Frame-Options:
76
+ - ALLOWALL
77
+ X-Permitted-Cross-Domain-Policies:
78
+ - none
79
+ X-Xss-Protection:
80
+ - 1; mode=block
81
+ Content-Length:
82
+ - '692'
83
+ Connection:
84
+ - Close
85
+ Set-Cookie:
86
+ - incap_ses_1077_673446=RtgaHDXP7XMdFb6xI0byDv/KAF0AAAAACSGiFccitmBt23MZnqPWxA==;
87
+ path=/; Domain=.contentful.com
88
+ - nlbi_673446=7nwaCaO7f3nYLwxVYMlkBAAAAAD3ZpP6TCMI5gIrwYpyuK9W; path=/; Domain=.contentful.com
89
+ - visid_incap_673446=HtXBvewwRv2t0RzGAoorGv/KAF0AAAAAQUIPAAAAAABa3NNCQ4sPwmHFDGhpUKoq;
90
+ expires=Thu, 11 Jun 2020 08:51:05 GMT; path=/; Domain=.contentful.com
91
+ X-Iinfo:
92
+ - 4-7987266-7987270 NNNN CT(108 108 0) RT(1560333054770 102) q(0 0 2 -1) r(4
93
+ 4) U5
94
+ X-Cdn:
95
+ - Incapsula
96
+ body:
97
+ encoding: ASCII-8BIT
98
+ string: |+
99
+ {
100
+ "name":"testing 2",
101
+ "sys":{
102
+ "type":"Environment",
103
+ "id":"testing",
104
+ "version":7,
105
+ "space":{
106
+ "sys":{
107
+ "type":"Link",
108
+ "linkType":"Space",
109
+ "id":"facgnwwgj5fe"
110
+ }
111
+ },
112
+ "status":{
113
+ "sys":{
114
+ "type":"Link",
115
+ "linkType":"Status",
116
+ "id":"ready"
117
+ }
118
+ },
119
+ "createdBy":{
120
+ "sys":{
121
+ "type":"Link",
122
+ "linkType":"User",
123
+ "id":"4SejVrWT96dvL9IV4Nb7sQ"
124
+ }
125
+ },
126
+ "createdAt":"2018-02-27T10:19:01Z",
127
+ "updatedBy":{
128
+ "sys":{
129
+ "type":"Link",
130
+ "linkType":"User",
131
+ "id":"4SejVrWT96dvL9IV4Nb7sQ"
132
+ }
133
+ },
134
+ "updatedAt":"2019-04-02T13:32:30Z"
135
+ }
136
+ }
137
+
138
+ http_version:
139
+ recorded_at: Wed, 12 Jun 2019 09:50:55 GMT
140
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,150 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/testing/content_types/foo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/2.10.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/2.2.2
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,X-Contentful-Enable-Alpha-Feature,X-Contentful-Source-Environment,X-Contentful-Team,X-Contentful-Parent-Id
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-Environment-Id:
38
+ - testing
39
+ Cf-Space-Id:
40
+ - facgnwwgj5fe
41
+ Content-Type:
42
+ - application/vnd.contentful.management.v1+json
43
+ Contentful-Api:
44
+ - cma
45
+ Date:
46
+ - Wed, 12 Jun 2019 09:53:39 GMT
47
+ Etag:
48
+ - '"0b2c5704e213e8a4a0dd2c52b41f69f6"'
49
+ Server:
50
+ - Contentful
51
+ Strict-Transport-Security:
52
+ - max-age=15768000
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ X-Contentful-Ratelimit-Hour-Limit:
56
+ - '36000'
57
+ X-Contentful-Ratelimit-Hour-Remaining:
58
+ - '35999'
59
+ X-Contentful-Ratelimit-Reset:
60
+ - '0'
61
+ X-Contentful-Ratelimit-Second-Limit:
62
+ - '10'
63
+ X-Contentful-Ratelimit-Second-Remaining:
64
+ - '9'
65
+ X-Contentful-Request-Id:
66
+ - f5fddca25cc4f8e04c8d81881e6e7701
67
+ Content-Length:
68
+ - '1291'
69
+ Connection:
70
+ - Close
71
+ Set-Cookie:
72
+ - incap_ses_1077_673446=BpbBNbCuYjrQIb6xI0byDqPLAF0AAAAAZh/XsY8rfyTQa65eQDXXQA==;
73
+ path=/; Domain=.contentful.com
74
+ - nlbi_673446=EDV6F0YIwmCvoc7iYMlkBAAAAACzIXkMlBj6/0YOnyu4iuW5; path=/; Domain=.contentful.com
75
+ - visid_incap_673446=RDpZ/bR1RpCWIvRJhiD7DaPLAF0AAAAAQUIPAAAAAADdNxoQbzqM+ClPhb8yvpKl;
76
+ expires=Thu, 11 Jun 2020 08:51:29 GMT; path=/; Domain=.contentful.com
77
+ X-Iinfo:
78
+ - 13-3220957-3220958 NNNN CT(0 0 0) RT(1560333218442 92) q(0 0 0 -1) r(10 10)
79
+ U5
80
+ X-Cdn:
81
+ - Incapsula
82
+ body:
83
+ encoding: ASCII-8BIT
84
+ string: |
85
+ {
86
+ "sys": {
87
+ "space": {
88
+ "sys": {
89
+ "type": "Link",
90
+ "linkType": "Space",
91
+ "id": "facgnwwgj5fe"
92
+ }
93
+ },
94
+ "id": "foo",
95
+ "type": "ContentType",
96
+ "createdAt": "2017-03-02T19:32:52.225Z",
97
+ "updatedAt": "2017-03-10T15:38:16.371Z",
98
+ "environment": {
99
+ "sys": {
100
+ "id": "testing",
101
+ "type": "Link",
102
+ "linkType": "Environment"
103
+ }
104
+ },
105
+ "publishedVersion": 6,
106
+ "publishedAt": "2017-03-02T22:41:20.685Z",
107
+ "firstPublishedAt": "2017-03-02T21:51:34.581Z",
108
+ "createdBy": {
109
+ "sys": {
110
+ "type": "Link",
111
+ "linkType": "User",
112
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
113
+ }
114
+ },
115
+ "updatedBy": {
116
+ "sys": {
117
+ "type": "Link",
118
+ "linkType": "User",
119
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
120
+ }
121
+ },
122
+ "publishedCounter": 3,
123
+ "version": 9,
124
+ "publishedBy": {
125
+ "sys": {
126
+ "type": "Link",
127
+ "linkType": "User",
128
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
129
+ }
130
+ }
131
+ },
132
+ "displayField": "name",
133
+ "name": "foo",
134
+ "description": "",
135
+ "fields": [
136
+ {
137
+ "id": "name",
138
+ "name": "name",
139
+ "type": "Symbol",
140
+ "localized": false,
141
+ "required": false,
142
+ "validations": [],
143
+ "disabled": false,
144
+ "omitted": false
145
+ }
146
+ ]
147
+ }
148
+ http_version:
149
+ recorded_at: Wed, 12 Jun 2019 09:53:40 GMT
150
+ recorded_with: VCR 4.0.0
@@ -465,6 +465,14 @@ module Contentful
465
465
  end
466
466
  end
467
467
  end
468
+ describe 'Assets created through environment retain environment identity - #196' do
469
+ it 'should return proper environment id' do
470
+ vcr('asset/196_environment_id') do
471
+ environment = client.environments('facgnwwgj5fe').find('testing')
472
+ expect(environment.assets.new.environment_id).to eq 'testing'
473
+ end
474
+ end
475
+ end
468
476
  end
469
477
  end
470
478
  end
@@ -849,6 +849,12 @@ module Contentful
849
849
  expect(content_type.sys[:version] > 0).to be_truthy
850
850
  }
851
851
  end
852
+ it 'entries created through a content type retain environment id - #196' do
853
+ vcr('content_type/196_retain_environment_id') {
854
+ content_type = described_class.find(client, 'facgnwwgj5fe', 'testing', 'foo')
855
+ expect(content_type.entries.new.environment_id).to eq 'testing'
856
+ }
857
+ end
852
858
  end
853
859
  end
854
860
  end
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: 2.9.1
4
+ version: 2.10.0
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: 2019-05-08 00:00:00.000000000 Z
13
+ date: 2019-06-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -50,16 +50,22 @@ dependencies:
50
50
  name: json
51
51
  requirement: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '1.8'
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: '3.0'
56
59
  type: :runtime
57
60
  prerelease: false
58
61
  version_requirements: !ruby/object:Gem::Requirement
59
62
  requirements:
60
- - - "~>"
63
+ - - ">="
61
64
  - !ruby/object:Gem::Version
62
65
  version: '1.8'
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
63
69
  - !ruby/object:Gem::Dependency
64
70
  name: bundler
65
71
  requirement: !ruby/object:Gem::Requirement
@@ -218,16 +224,16 @@ dependencies:
218
224
  name: vcr
219
225
  requirement: !ruby/object:Gem::Requirement
220
226
  requirements:
221
- - - ">="
227
+ - - "~>"
222
228
  - !ruby/object:Gem::Version
223
- version: '0'
229
+ version: '4.0'
224
230
  type: :development
225
231
  prerelease: false
226
232
  version_requirements: !ruby/object:Gem::Requirement
227
233
  requirements:
228
- - - ">="
234
+ - - "~>"
229
235
  - !ruby/object:Gem::Version
230
- version: '0'
236
+ version: '4.0'
231
237
  - !ruby/object:Gem::Dependency
232
238
  name: webmock
233
239
  requirement: !ruby/object:Gem::Requirement
@@ -422,6 +428,7 @@ files:
422
428
  - spec/fixtures/vcr_cassettes/api_usage/all.yml
423
429
  - spec/fixtures/vcr_cassettes/array_page_1.yml
424
430
  - spec/fixtures/vcr_cassettes/asset/143_assets_next_page.yml
431
+ - spec/fixtures/vcr_cassettes/asset/196_environment_id.yml
425
432
  - spec/fixtures/vcr_cassettes/asset/all.yml
426
433
  - spec/fixtures/vcr_cassettes/asset/archive.yml
427
434
  - spec/fixtures/vcr_cassettes/asset/archive_published.yml
@@ -456,6 +463,7 @@ files:
456
463
  - spec/fixtures/vcr_cassettes/asset/update_file.yml
457
464
  - spec/fixtures/vcr_cassettes/asset/update_to_specified_locale.yml
458
465
  - spec/fixtures/vcr_cassettes/asset/update_with_default_locale_without_file.yml
466
+ - spec/fixtures/vcr_cassettes/content_type/196_retain_environment_id.yml
459
467
  - spec/fixtures/vcr_cassettes/content_type/activate.yml
460
468
  - spec/fixtures/vcr_cassettes/content_type/activate_with_invalid_version.yml
461
469
  - spec/fixtures/vcr_cassettes/content_type/activated_false.yml
@@ -822,6 +830,7 @@ test_files:
822
830
  - spec/fixtures/vcr_cassettes/api_usage/all.yml
823
831
  - spec/fixtures/vcr_cassettes/array_page_1.yml
824
832
  - spec/fixtures/vcr_cassettes/asset/143_assets_next_page.yml
833
+ - spec/fixtures/vcr_cassettes/asset/196_environment_id.yml
825
834
  - spec/fixtures/vcr_cassettes/asset/all.yml
826
835
  - spec/fixtures/vcr_cassettes/asset/archive.yml
827
836
  - spec/fixtures/vcr_cassettes/asset/archive_published.yml
@@ -856,6 +865,7 @@ test_files:
856
865
  - spec/fixtures/vcr_cassettes/asset/update_file.yml
857
866
  - spec/fixtures/vcr_cassettes/asset/update_to_specified_locale.yml
858
867
  - spec/fixtures/vcr_cassettes/asset/update_with_default_locale_without_file.yml
868
+ - spec/fixtures/vcr_cassettes/content_type/196_retain_environment_id.yml
859
869
  - spec/fixtures/vcr_cassettes/content_type/activate.yml
860
870
  - spec/fixtures/vcr_cassettes/content_type/activate_with_invalid_version.yml
861
871
  - spec/fixtures/vcr_cassettes/content_type/activated_false.yml