contentful-management 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/contentful/management/content_type.rb +2 -1
- data/lib/contentful/management/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/content_type/create_with_StructuredText_field.yml +139 -0
- data/spec/lib/contentful/management/content_type_spec.rb +26 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 386e22c5309df503436b066804e279c4aa8912c6dc84ef02be9c90ce7d617cc5
|
4
|
+
data.tar.gz: e8d54a6fbf5e5a229abf9391743e3d06264d15088e6033d4522bef5b1ab14622
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f3f99d5e04748431abf899b58d4a6e729e3814a3af740676a98cbe0b721fc9c27df0f9c192443014613d7ee36f98172550919bbe5f51a8e5c6d053ecb2c5c43
|
7
|
+
data.tar.gz: 2582509fd98611a065920e9333b6b755dd05aa1389a213caedb3617a66a898f9d94ac45805a16aa6a39064d2186ad0d2912624f9c1d6289bdecc559b81b80646
|
data/CHANGELOG.md
CHANGED
@@ -25,7 +25,8 @@ module Contentful
|
|
25
25
|
LINK = 'Link'.freeze,
|
26
26
|
ARRAY = 'Array'.freeze,
|
27
27
|
OBJECT = 'Object'.freeze,
|
28
|
-
LOCATION = 'Location'.freeze
|
28
|
+
LOCATION = 'Location'.freeze,
|
29
|
+
STRUCTURED_TEXT = 'StructuredText'.freeze
|
29
30
|
].freeze
|
30
31
|
|
31
32
|
include Contentful::Management::Resource
|
@@ -0,0 +1,139 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.contentful.com/spaces/ctgv7kwgsghk/environments/master/content_types
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"name":"StructuredText","description":"Content type with StructuredText
|
9
|
+
field","fields":[{"id":"my_StructuredText_field","name":"My StructuredText
|
10
|
+
Field","type":"StructuredText"}]}'
|
11
|
+
headers:
|
12
|
+
X-Contentful-User-Agent:
|
13
|
+
- sdk contentful-management.rb/2.3.0; platform ruby/2.5.1; os macOS/16;
|
14
|
+
Authorization:
|
15
|
+
- Bearer <ACCESS_TOKEN>
|
16
|
+
Content-Type:
|
17
|
+
- application/vnd.contentful.management.v1+json
|
18
|
+
Connection:
|
19
|
+
- close
|
20
|
+
Host:
|
21
|
+
- api.contentful.com
|
22
|
+
User-Agent:
|
23
|
+
- http.rb/2.2.2
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 201
|
27
|
+
message: Created
|
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
|
+
- 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
|
+
Cf-Space-Id:
|
40
|
+
- ctgv7kwgsghk
|
41
|
+
Content-Type:
|
42
|
+
- application/vnd.contentful.management.v1+json
|
43
|
+
Contentful-Api:
|
44
|
+
- cma
|
45
|
+
Date:
|
46
|
+
- Thu, 23 Aug 2018 11:49:17 GMT
|
47
|
+
Etag:
|
48
|
+
- '"8ae7e958cb3056725cf056ab4fcb7b3b"'
|
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
|
+
- '180000'
|
57
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
58
|
+
- '179999'
|
59
|
+
X-Contentful-Ratelimit-Reset:
|
60
|
+
- '0'
|
61
|
+
X-Contentful-Ratelimit-Second-Limit:
|
62
|
+
- '50'
|
63
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
64
|
+
- '49'
|
65
|
+
X-Contentful-Request-Id:
|
66
|
+
- '08f4f61a5181bce2ed5e4413e37415fe'
|
67
|
+
Content-Length:
|
68
|
+
- '1107'
|
69
|
+
Connection:
|
70
|
+
- Close
|
71
|
+
Set-Cookie:
|
72
|
+
- incap_ses_992_673446=Yn1UdTm3XQ76R5/0JEvEDTyfflsAAAAAKp3BifSPVkXD2N86rFjbBQ==;
|
73
|
+
path=/; Domain=.contentful.com
|
74
|
+
- nlbi_673446=TP4vba6X90H5mvqP6lKYhQAAAABDuuY8YD5YG7IxG4AEOTWe; path=/; Domain=.contentful.com
|
75
|
+
- visid_incap_673446=ZKd3uRQnRpKY0R8dRawgGTyfflsAAAAAQUIPAAAAAADyBJmo5L40YXKtx/m1R+iD;
|
76
|
+
expires=Fri, 23 Aug 2019 08:14:38 GMT; path=/; Domain=.contentful.com
|
77
|
+
X-Iinfo:
|
78
|
+
- 14-25993165-25993178 NNNN CT(28 25 0) RT(1535024955748 29) q(0 0 1 -1) r(8
|
79
|
+
8) 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": "ctgv7kwgsghk"
|
92
|
+
}
|
93
|
+
},
|
94
|
+
"id": "4JTk4UIel2CycSWE0awqie",
|
95
|
+
"type": "ContentType",
|
96
|
+
"createdAt": "2018-08-23T11:49:17.292Z",
|
97
|
+
"updatedAt": "2018-08-23T11:49:17.292Z",
|
98
|
+
"environment": {
|
99
|
+
"sys": {
|
100
|
+
"id": "master",
|
101
|
+
"type": "Link",
|
102
|
+
"linkType": "Environment"
|
103
|
+
}
|
104
|
+
},
|
105
|
+
"createdBy": {
|
106
|
+
"sys": {
|
107
|
+
"type": "Link",
|
108
|
+
"linkType": "User",
|
109
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
110
|
+
}
|
111
|
+
},
|
112
|
+
"updatedBy": {
|
113
|
+
"sys": {
|
114
|
+
"type": "Link",
|
115
|
+
"linkType": "User",
|
116
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
117
|
+
}
|
118
|
+
},
|
119
|
+
"version": 1
|
120
|
+
},
|
121
|
+
"displayField": null,
|
122
|
+
"name": "StructuredText",
|
123
|
+
"description": "Content type with StructuredText field",
|
124
|
+
"fields": [
|
125
|
+
{
|
126
|
+
"id": "my_StructuredText_field",
|
127
|
+
"name": "My StructuredText Field",
|
128
|
+
"type": "StructuredText",
|
129
|
+
"localized": false,
|
130
|
+
"required": false,
|
131
|
+
"validations": [],
|
132
|
+
"disabled": false,
|
133
|
+
"omitted": false
|
134
|
+
}
|
135
|
+
]
|
136
|
+
}
|
137
|
+
http_version:
|
138
|
+
recorded_at: Thu, 23 Aug 2018 11:49:17 GMT
|
139
|
+
recorded_with: VCR 4.0.0
|
@@ -5,7 +5,7 @@ require 'contentful/management/client'
|
|
5
5
|
module Contentful
|
6
6
|
module Management
|
7
7
|
describe ContentType do
|
8
|
-
let(:token) { '<ACCESS_TOKEN>' }
|
8
|
+
let(:token) { ENV.fetch('CF_TEST_CMA_TOKEN', '<ACCESS_TOKEN>') }
|
9
9
|
let(:space_id) { 'yr5m0jky5hsh' }
|
10
10
|
let!(:client) { Client.new(token) }
|
11
11
|
let(:content_type_id) { '5DSpuKrl04eMAGQoQckeIq' }
|
@@ -188,7 +188,7 @@ module Contentful
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
-
Contentful::Management::ContentType::FIELD_TYPES.each do |field_type|
|
191
|
+
Contentful::Management::ContentType::FIELD_TYPES.reject { |f| f == 'StructuredText' }.each do |field_type|
|
192
192
|
it "creates within a space with #{ field_type } field" do
|
193
193
|
vcr("content_type/create_with_#{ field_type }_field") do
|
194
194
|
field = Contentful::Management::Field.new
|
@@ -213,6 +213,30 @@ module Contentful
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
+
it "creates within a space with StructuredText field" do
|
217
|
+
vcr("content_type/create_with_StructuredText_field") do
|
218
|
+
subject = client.content_types('ctgv7kwgsghk', 'master')
|
219
|
+
|
220
|
+
field = Contentful::Management::Field.new
|
221
|
+
field.id = "my_StructuredText_field"
|
222
|
+
field.name = "My StructuredText Field"
|
223
|
+
field.type = 'StructuredText'
|
224
|
+
content_type = subject.create(
|
225
|
+
name: "StructuredText",
|
226
|
+
description: "Content type with StructuredText field",
|
227
|
+
fields: [field]
|
228
|
+
)
|
229
|
+
expect(content_type).to be_kind_of Contentful::Management::ContentType
|
230
|
+
expect(content_type.name).to eq "StructuredText"
|
231
|
+
expect(content_type.description).to eq "Content type with StructuredText field"
|
232
|
+
expect(content_type.fields.size).to eq 1
|
233
|
+
result_field = content_type.fields.first
|
234
|
+
expect(result_field.id).to eq field.id
|
235
|
+
expect(result_field.name).to eq field.name
|
236
|
+
expect(result_field.type).to eq field.type
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
216
240
|
it 'creates a content_type with an omitted field' do
|
217
241
|
vcr('content_type/omitted_field') {
|
218
242
|
space = client.spaces.find('ngtgiva4wofg')
|
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.
|
4
|
+
version: 2.4.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: 2018-
|
13
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|
@@ -466,6 +466,7 @@ files:
|
|
466
466
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Location_field.yml
|
467
467
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Number_field.yml
|
468
468
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Object_field.yml
|
469
|
+
- spec/fixtures/vcr_cassettes/content_type/create_with_StructuredText_field.yml
|
469
470
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Symbol_field.yml
|
470
471
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Text_field.yml
|
471
472
|
- spec/fixtures/vcr_cassettes/content_type/deactivate.yml
|
@@ -852,6 +853,7 @@ test_files:
|
|
852
853
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Location_field.yml
|
853
854
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Number_field.yml
|
854
855
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Object_field.yml
|
856
|
+
- spec/fixtures/vcr_cassettes/content_type/create_with_StructuredText_field.yml
|
855
857
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Symbol_field.yml
|
856
858
|
- spec/fixtures/vcr_cassettes/content_type/create_with_Text_field.yml
|
857
859
|
- spec/fixtures/vcr_cassettes/content_type/deactivate.yml
|