contentful-management 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +4 -0
- data/README.md +12 -0
- data/contentful-management.gemspec +1 -1
- data/lib/contentful/management/resource/publisher.rb +23 -0
- data/lib/contentful/management/resource/system_properties.rb +1 -0
- data/lib/contentful/management/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/entry/unpublished.yml +140 -0
- data/spec/fixtures/vcr_cassettes/entry/updated_false.yml +156 -0
- data/spec/fixtures/vcr_cassettes/entry/updated_true.yml +151 -0
- data/spec/lib/contentful/management/entry_spec.rb +25 -0
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5210f3fa63b06c825be7cc8dc9ac180af8e64a32cd36c3854847cd59c71d0b9b
|
4
|
+
data.tar.gz: 7ce4f9d849de685b056f978915bac05270ea80d2ec054925bf717f298d5fab38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d85036571c6e955bf813acc4041b79dfeb4d6bd0643b019aa738e321bb15740584021a79c50ecf9d1ca771157c5bf719083b6d9584f05cd835f183893419938
|
7
|
+
data.tar.gz: 0fc6713bbcc2ad348c593bbca1fd3c9362f585d8ea444c93474b1638fc86a39d84fad073cbbd0454f46f17e799248796ee32e2ac43cdaf623e5eae77ed79f36a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -248,6 +248,12 @@ Checking if an asset is published:
|
|
248
248
|
my_image_asset.published?
|
249
249
|
```
|
250
250
|
|
251
|
+
Checking if has been updated from last published version:
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
my_image_asset.updated?
|
255
|
+
```
|
256
|
+
|
251
257
|
### File Uploads
|
252
258
|
|
253
259
|
Creating an upload from a file path:
|
@@ -394,6 +400,12 @@ Checking if the entry is published:
|
|
394
400
|
my_entry.published?
|
395
401
|
```
|
396
402
|
|
403
|
+
Checking if the entry has been updated from last publish:
|
404
|
+
|
405
|
+
```ruby
|
406
|
+
my_entry.updated?
|
407
|
+
```
|
408
|
+
|
397
409
|
> Entries created with *empty fields*, will not return those fields in the response. Therefore, entries that don't have cache enabled, will need to
|
398
410
|
> make an extra request to fetch the content type and fill the missing fields.
|
399
411
|
> To allow for content type caching:
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'multi_json', '~> 1'
|
22
22
|
spec.add_dependency 'json', '~> 1.8'
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
24
|
+
spec.add_development_dependency 'bundler'
|
25
25
|
spec.add_development_dependency 'rake', '< 11.0'
|
26
26
|
spec.add_development_dependency 'public_suffix', '< 1.5'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3'
|
@@ -41,6 +41,29 @@ module Contentful
|
|
41
41
|
def published?
|
42
42
|
sys[:publishedAt] ? true : false
|
43
43
|
end
|
44
|
+
|
45
|
+
# Checks if a resource has been updated since last publish.
|
46
|
+
# Returns false if resource has not been published before.
|
47
|
+
#
|
48
|
+
# @return [Boolean]
|
49
|
+
def updated?
|
50
|
+
return false unless sys[:publishedAt]
|
51
|
+
|
52
|
+
sanitize_date(sys[:publishedAt]) < sanitize_date(sys[:updatedAt])
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
# In order to have a more accurate comparison due to minimal delays
|
58
|
+
# upon publishing entries. We strip milliseconds from the dates we compare.
|
59
|
+
#
|
60
|
+
# @param date [::DateTime]
|
61
|
+
# @return [::Time] without milliseconds.
|
62
|
+
def sanitize_date(date)
|
63
|
+
time = date.to_time
|
64
|
+
|
65
|
+
::Time.new(time.year, time.month, time.day, time.hour, time.min, time.sec, time.utc_offset)
|
66
|
+
end
|
44
67
|
end
|
45
68
|
end
|
46
69
|
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/entries/1HDKL0ldPuaKKiquq0IGam
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Contentful-User-Agent:
|
11
|
+
- sdk contentful-management.rb/2.6.0; platform ruby/2.5.3; os macOS/16;
|
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
|
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
|
+
- facgnwwgj5fe
|
39
|
+
Content-Type:
|
40
|
+
- application/vnd.contentful.management.v1+json
|
41
|
+
Contentful-Api:
|
42
|
+
- cma
|
43
|
+
Date:
|
44
|
+
- Thu, 07 Feb 2019 13:43:11 GMT
|
45
|
+
Etag:
|
46
|
+
- '"de2fab668b40865a1907669454f0323a"'
|
47
|
+
Server:
|
48
|
+
- Contentful
|
49
|
+
Strict-Transport-Security:
|
50
|
+
- max-age=15768000
|
51
|
+
X-Content-Type-Options:
|
52
|
+
- nosniff
|
53
|
+
X-Contentful-Ratelimit-Hour-Limit:
|
54
|
+
- '36000'
|
55
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
56
|
+
- '35999'
|
57
|
+
X-Contentful-Ratelimit-Reset:
|
58
|
+
- '0'
|
59
|
+
X-Contentful-Ratelimit-Second-Limit:
|
60
|
+
- '10'
|
61
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
62
|
+
- '9'
|
63
|
+
X-Contentful-Request-Id:
|
64
|
+
- 5171baee8de74c2da51bfd56a402365a
|
65
|
+
Content-Length:
|
66
|
+
- '1056'
|
67
|
+
Connection:
|
68
|
+
- Close
|
69
|
+
Set-Cookie:
|
70
|
+
- incap_ses_1079_673446=md7fZZq+mXYsGoVm+WD5Du41XFwAAAAAcKc1+MPk7k840LBiEDqS1w==;
|
71
|
+
path=/; Domain=.contentful.com
|
72
|
+
- nlbi_673446=Jsj/e1ULRELZ4DWa6lKYhQAAAACln2iE36BIIM9uIw1QTqet; path=/; Domain=.contentful.com
|
73
|
+
- visid_incap_673446=MebT3nL8R9GwS9xxwIyJj+41XFwAAAAAQUIPAAAAAAB1d6jc8KTYah5klQcybBcM;
|
74
|
+
expires=Fri, 07 Feb 2020 10:49:31 GMT; path=/; Domain=.contentful.com
|
75
|
+
X-Iinfo:
|
76
|
+
- 10-2645274-2645275 NNNN CT(0 0 0) RT(1549546989814 58) q(0 0 0 -1) r(10 10)
|
77
|
+
U5
|
78
|
+
X-Cdn:
|
79
|
+
- Incapsula
|
80
|
+
body:
|
81
|
+
encoding: ASCII-8BIT
|
82
|
+
string: |
|
83
|
+
{
|
84
|
+
"sys": {
|
85
|
+
"space": {
|
86
|
+
"sys": {
|
87
|
+
"type": "Link",
|
88
|
+
"linkType": "Space",
|
89
|
+
"id": "facgnwwgj5fe"
|
90
|
+
}
|
91
|
+
},
|
92
|
+
"id": "1HDKL0ldPuaKKiquq0IGam",
|
93
|
+
"type": "Entry",
|
94
|
+
"createdAt": "2017-11-17T12:25:37.976Z",
|
95
|
+
"updatedAt": "2017-11-17T12:25:37.976Z",
|
96
|
+
"environment": {
|
97
|
+
"sys": {
|
98
|
+
"id": "master",
|
99
|
+
"type": "Link",
|
100
|
+
"linkType": "Environment"
|
101
|
+
}
|
102
|
+
},
|
103
|
+
"createdBy": {
|
104
|
+
"sys": {
|
105
|
+
"type": "Link",
|
106
|
+
"linkType": "User",
|
107
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
108
|
+
}
|
109
|
+
},
|
110
|
+
"updatedBy": {
|
111
|
+
"sys": {
|
112
|
+
"type": "Link",
|
113
|
+
"linkType": "User",
|
114
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
115
|
+
}
|
116
|
+
},
|
117
|
+
"version": 1,
|
118
|
+
"contentType": {
|
119
|
+
"sys": {
|
120
|
+
"type": "Link",
|
121
|
+
"linkType": "ContentType",
|
122
|
+
"id": "somethingWithLinks"
|
123
|
+
}
|
124
|
+
}
|
125
|
+
},
|
126
|
+
"fields": {
|
127
|
+
"link": {
|
128
|
+
"en-US": {
|
129
|
+
"sys": {
|
130
|
+
"type": "Link",
|
131
|
+
"linkType": "Entry",
|
132
|
+
"id": "IJLRrADsqq2AmwcugoYeK"
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
http_version:
|
139
|
+
recorded_at: Thu, 07 Feb 2019 13:43:11 GMT
|
140
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,156 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/entries/IJLRrADsqq2AmwcugoYeK
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Contentful-User-Agent:
|
11
|
+
- sdk contentful-management.rb/2.6.0; platform ruby/2.5.3; os macOS/16;
|
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
|
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
|
+
- facgnwwgj5fe
|
39
|
+
Content-Type:
|
40
|
+
- application/vnd.contentful.management.v1+json
|
41
|
+
Contentful-Api:
|
42
|
+
- cma
|
43
|
+
Date:
|
44
|
+
- Thu, 07 Feb 2019 13:43:13 GMT
|
45
|
+
Etag:
|
46
|
+
- '"eda08a4d4a8f6ee99538957dea88de55"'
|
47
|
+
Server:
|
48
|
+
- Contentful
|
49
|
+
Strict-Transport-Security:
|
50
|
+
- max-age=15768000
|
51
|
+
X-Content-Type-Options:
|
52
|
+
- nosniff
|
53
|
+
X-Contentful-Ratelimit-Hour-Limit:
|
54
|
+
- '36000'
|
55
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
56
|
+
- '35999'
|
57
|
+
X-Contentful-Ratelimit-Reset:
|
58
|
+
- '0'
|
59
|
+
X-Contentful-Ratelimit-Second-Limit:
|
60
|
+
- '10'
|
61
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
62
|
+
- '9'
|
63
|
+
X-Contentful-Request-Id:
|
64
|
+
- cfd19dcbe35fabdf0e9985005d22adb8
|
65
|
+
Content-Length:
|
66
|
+
- '1432'
|
67
|
+
Connection:
|
68
|
+
- Close
|
69
|
+
Set-Cookie:
|
70
|
+
- incap_ses_1079_673446=PkUXGTn3fWZvGoVm+WD5DvA1XFwAAAAA0gnlsr803OVgbXIVoRXPww==;
|
71
|
+
path=/; Domain=.contentful.com
|
72
|
+
- nlbi_673446=MUMVeUOCF3U/ehDf6lKYhQAAAADnjGKRTs+/43rKAL+n67Hg; path=/; Domain=.contentful.com
|
73
|
+
- visid_incap_673446=vQqFkFUITDKx8gk8lEs62PA1XFwAAAAAQUIPAAAAAACzfAsh5dGFKSfK4iQt58n9;
|
74
|
+
expires=Fri, 07 Feb 2020 10:49:28 GMT; path=/; Domain=.contentful.com
|
75
|
+
X-Iinfo:
|
76
|
+
- 1-4413458-4413459 NNNN CT(0 0 0) RT(1549546992125 59) q(0 0 0 -1) r(2 2) U5
|
77
|
+
X-Cdn:
|
78
|
+
- Incapsula
|
79
|
+
body:
|
80
|
+
encoding: ASCII-8BIT
|
81
|
+
string: |
|
82
|
+
{
|
83
|
+
"sys": {
|
84
|
+
"space": {
|
85
|
+
"sys": {
|
86
|
+
"type": "Link",
|
87
|
+
"linkType": "Space",
|
88
|
+
"id": "facgnwwgj5fe"
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"id": "IJLRrADsqq2AmwcugoYeK",
|
92
|
+
"type": "Entry",
|
93
|
+
"createdAt": "2017-05-08T14:06:14.367Z",
|
94
|
+
"updatedAt": "2017-05-09T13:39:59.063Z",
|
95
|
+
"environment": {
|
96
|
+
"sys": {
|
97
|
+
"id": "master",
|
98
|
+
"type": "Link",
|
99
|
+
"linkType": "Environment"
|
100
|
+
}
|
101
|
+
},
|
102
|
+
"createdBy": {
|
103
|
+
"sys": {
|
104
|
+
"type": "Link",
|
105
|
+
"linkType": "User",
|
106
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
107
|
+
}
|
108
|
+
},
|
109
|
+
"updatedBy": {
|
110
|
+
"sys": {
|
111
|
+
"type": "Link",
|
112
|
+
"linkType": "User",
|
113
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
114
|
+
}
|
115
|
+
},
|
116
|
+
"publishedCounter": 16,
|
117
|
+
"version": 57,
|
118
|
+
"publishedBy": {
|
119
|
+
"sys": {
|
120
|
+
"type": "Link",
|
121
|
+
"linkType": "User",
|
122
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
123
|
+
}
|
124
|
+
},
|
125
|
+
"publishedVersion": 56,
|
126
|
+
"firstPublishedAt": "2017-05-08T14:06:25.154Z",
|
127
|
+
"publishedAt": "2017-05-09T13:39:59.032Z",
|
128
|
+
"contentType": {
|
129
|
+
"sys": {
|
130
|
+
"type": "Link",
|
131
|
+
"linkType": "ContentType",
|
132
|
+
"id": "cat"
|
133
|
+
}
|
134
|
+
}
|
135
|
+
},
|
136
|
+
"fields": {
|
137
|
+
"name": {
|
138
|
+
"en-US": "Fat Cat"
|
139
|
+
},
|
140
|
+
"lives": {
|
141
|
+
"en-US": 1337
|
142
|
+
},
|
143
|
+
"bestFriend": {
|
144
|
+
"en-US": {
|
145
|
+
"sys": {
|
146
|
+
"type": "Link",
|
147
|
+
"linkType": "Entry",
|
148
|
+
"id": "cq0MrAkH8A0Q8QsYquwMq"
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
http_version:
|
155
|
+
recorded_at: Thu, 07 Feb 2019 13:43:13 GMT
|
156
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,151 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/entries/3fTNzlQsDmge6YQEikEuME
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
X-Contentful-User-Agent:
|
11
|
+
- sdk contentful-management.rb/2.6.0; platform ruby/2.5.3; os macOS/16;
|
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
|
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
|
+
- facgnwwgj5fe
|
39
|
+
Content-Type:
|
40
|
+
- application/vnd.contentful.management.v1+json
|
41
|
+
Contentful-Api:
|
42
|
+
- cma
|
43
|
+
Date:
|
44
|
+
- Thu, 07 Feb 2019 13:43:12 GMT
|
45
|
+
Etag:
|
46
|
+
- '"bbf0ab827d2707d733b376e4276110a4"'
|
47
|
+
Server:
|
48
|
+
- Contentful
|
49
|
+
Strict-Transport-Security:
|
50
|
+
- max-age=15768000
|
51
|
+
X-Content-Type-Options:
|
52
|
+
- nosniff
|
53
|
+
X-Contentful-Ratelimit-Hour-Limit:
|
54
|
+
- '36000'
|
55
|
+
X-Contentful-Ratelimit-Hour-Remaining:
|
56
|
+
- '35999'
|
57
|
+
X-Contentful-Ratelimit-Reset:
|
58
|
+
- '0'
|
59
|
+
X-Contentful-Ratelimit-Second-Limit:
|
60
|
+
- '10'
|
61
|
+
X-Contentful-Ratelimit-Second-Remaining:
|
62
|
+
- '9'
|
63
|
+
X-Contentful-Request-Id:
|
64
|
+
- 20245cb9235ce5be6d5292cf6643bf9d
|
65
|
+
Content-Length:
|
66
|
+
- '1335'
|
67
|
+
Connection:
|
68
|
+
- Close
|
69
|
+
Set-Cookie:
|
70
|
+
- incap_ses_1079_673446=RnOPKyfkUUFgGoVm+WD5DvA1XFwAAAAA+6AWxiEFkTz6O2+Aw0lQEg==;
|
71
|
+
path=/; Domain=.contentful.com
|
72
|
+
- nlbi_673446=gOGdbvlQ/UibPS106lKYhQAAAADkd6Z6IdBqU0YFDoWrPo7P; path=/; Domain=.contentful.com
|
73
|
+
- visid_incap_673446=RE1CbxGfQi+4yHdOaMCBffA1XFwAAAAAQUIPAAAAAABZIWqzJ0MQfNJ/N62uR/x9;
|
74
|
+
expires=Fri, 07 Feb 2020 10:49:05 GMT; path=/; Domain=.contentful.com
|
75
|
+
X-Iinfo:
|
76
|
+
- 4-11645693-11645700 NNNN CT(0 0 0) RT(1549546990948 83) q(0 0 0 -1) r(10 10)
|
77
|
+
U5
|
78
|
+
X-Cdn:
|
79
|
+
- Incapsula
|
80
|
+
body:
|
81
|
+
encoding: ASCII-8BIT
|
82
|
+
string: |
|
83
|
+
{
|
84
|
+
"sys": {
|
85
|
+
"space": {
|
86
|
+
"sys": {
|
87
|
+
"type": "Link",
|
88
|
+
"linkType": "Space",
|
89
|
+
"id": "facgnwwgj5fe"
|
90
|
+
}
|
91
|
+
},
|
92
|
+
"id": "3fTNzlQsDmge6YQEikEuME",
|
93
|
+
"type": "Entry",
|
94
|
+
"createdAt": "2017-06-15T14:23:07.028Z",
|
95
|
+
"updatedAt": "2017-06-15T14:28:46.345Z",
|
96
|
+
"environment": {
|
97
|
+
"sys": {
|
98
|
+
"id": "master",
|
99
|
+
"type": "Link",
|
100
|
+
"linkType": "Environment"
|
101
|
+
}
|
102
|
+
},
|
103
|
+
"createdBy": {
|
104
|
+
"sys": {
|
105
|
+
"type": "Link",
|
106
|
+
"linkType": "User",
|
107
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
108
|
+
}
|
109
|
+
},
|
110
|
+
"updatedBy": {
|
111
|
+
"sys": {
|
112
|
+
"type": "Link",
|
113
|
+
"linkType": "User",
|
114
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
115
|
+
}
|
116
|
+
},
|
117
|
+
"publishedCounter": 1,
|
118
|
+
"version": 12,
|
119
|
+
"publishedBy": {
|
120
|
+
"sys": {
|
121
|
+
"type": "Link",
|
122
|
+
"linkType": "User",
|
123
|
+
"id": "4SejVrWT96dvL9IV4Nb7sQ"
|
124
|
+
}
|
125
|
+
},
|
126
|
+
"publishedVersion": 10,
|
127
|
+
"firstPublishedAt": "2017-06-15T14:23:17.640Z",
|
128
|
+
"publishedAt": "2017-06-15T14:23:17.641Z",
|
129
|
+
"contentType": {
|
130
|
+
"sys": {
|
131
|
+
"type": "Link",
|
132
|
+
"linkType": "ContentType",
|
133
|
+
"id": "missingFields"
|
134
|
+
}
|
135
|
+
}
|
136
|
+
},
|
137
|
+
"fields": {
|
138
|
+
"name": {
|
139
|
+
"en-US": "A Name"
|
140
|
+
},
|
141
|
+
"other": {
|
142
|
+
"en-US": "Other Stuff"
|
143
|
+
},
|
144
|
+
"different": {
|
145
|
+
"en-US": "A Different Field"
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
http_version:
|
150
|
+
recorded_at: Thu, 07 Feb 2019 13:43:12 GMT
|
151
|
+
recorded_with: VCR 4.0.0
|
@@ -195,6 +195,31 @@ describe Contentful::Management::Entry do
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
+
describe '#updated?' do
|
199
|
+
let(:space_id) { 'facgnwwgj5fe' }
|
200
|
+
|
201
|
+
it 'returns true if entry has been updated since last publish' do
|
202
|
+
vcr('entry/updated_true') do
|
203
|
+
entry = subject.find('3fTNzlQsDmge6YQEikEuME')
|
204
|
+
expect(entry.updated?).to be_truthy
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'returns false if entry has not been published' do
|
209
|
+
vcr('entry/unpublished') do
|
210
|
+
entry = subject.find('1HDKL0ldPuaKKiquq0IGam')
|
211
|
+
expect(entry.updated?).to be_falsey
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'returns false if publish date is equal or greater than update date' do
|
216
|
+
vcr('entry/updated_false') do
|
217
|
+
entry = subject.find('IJLRrADsqq2AmwcugoYeK')
|
218
|
+
expect(entry.updated?).to be_falsey
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
198
223
|
describe '#unarchive' do
|
199
224
|
it 'unarchive the entry' do
|
200
225
|
vcr('entry/unarchive') 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: 2.
|
4
|
+
version: 2.7.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:
|
13
|
+
date: 2019-02-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|
@@ -64,16 +64,16 @@ dependencies:
|
|
64
64
|
name: bundler
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '0'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '0'
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: rake
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -596,10 +596,13 @@ files:
|
|
596
596
|
- spec/fixtures/vcr_cassettes/entry/unarchive_already_unarchived.yml
|
597
597
|
- spec/fixtures/vcr_cassettes/entry/unpublish.yml
|
598
598
|
- spec/fixtures/vcr_cassettes/entry/unpublish_already_unpublished.yml
|
599
|
+
- spec/fixtures/vcr_cassettes/entry/unpublished.yml
|
599
600
|
- spec/fixtures/vcr_cassettes/entry/update.yml
|
600
601
|
- spec/fixtures/vcr_cassettes/entry/update_bool_field.yml
|
601
602
|
- spec/fixtures/vcr_cassettes/entry/update_unlocalized_field.yml
|
602
603
|
- spec/fixtures/vcr_cassettes/entry/update_with_custom_locale.yml
|
604
|
+
- spec/fixtures/vcr_cassettes/entry/updated_false.yml
|
605
|
+
- spec/fixtures/vcr_cassettes/entry/updated_true.yml
|
603
606
|
- spec/fixtures/vcr_cassettes/environment/all.yml
|
604
607
|
- spec/fixtures/vcr_cassettes/environment/create.yml
|
605
608
|
- spec/fixtures/vcr_cassettes/environment/destroy.yml
|
@@ -772,7 +775,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
772
775
|
version: '0'
|
773
776
|
requirements: []
|
774
777
|
rubyforge_project:
|
775
|
-
rubygems_version: 2.7.
|
778
|
+
rubygems_version: 2.7.8
|
776
779
|
signing_key:
|
777
780
|
specification_version: 4
|
778
781
|
summary: contentful management api
|
@@ -987,10 +990,13 @@ test_files:
|
|
987
990
|
- spec/fixtures/vcr_cassettes/entry/unarchive_already_unarchived.yml
|
988
991
|
- spec/fixtures/vcr_cassettes/entry/unpublish.yml
|
989
992
|
- spec/fixtures/vcr_cassettes/entry/unpublish_already_unpublished.yml
|
993
|
+
- spec/fixtures/vcr_cassettes/entry/unpublished.yml
|
990
994
|
- spec/fixtures/vcr_cassettes/entry/update.yml
|
991
995
|
- spec/fixtures/vcr_cassettes/entry/update_bool_field.yml
|
992
996
|
- spec/fixtures/vcr_cassettes/entry/update_unlocalized_field.yml
|
993
997
|
- spec/fixtures/vcr_cassettes/entry/update_with_custom_locale.yml
|
998
|
+
- spec/fixtures/vcr_cassettes/entry/updated_false.yml
|
999
|
+
- spec/fixtures/vcr_cassettes/entry/updated_true.yml
|
994
1000
|
- spec/fixtures/vcr_cassettes/environment/all.yml
|
995
1001
|
- spec/fixtures/vcr_cassettes/environment/create.yml
|
996
1002
|
- spec/fixtures/vcr_cassettes/environment/destroy.yml
|