contentful-management 1.5.0 → 1.6.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
  SHA1:
3
- metadata.gz: a5375f7ca984d57cac6d910e9499a7fee451f57f
4
- data.tar.gz: 7d847b47c7cb3f9af9dae098f869fb99b4cd04dc
3
+ metadata.gz: 59a0b72970e30e8e4fa850361c2ed6c52603e6b0
4
+ data.tar.gz: b1f2d446a426a052a8ca164e1f9ca3a9b15f8212
5
5
  SHA512:
6
- metadata.gz: 648da2fcb41cb3007f9201e606f460f20b72104b03c6dd57ee5df680d7fca13162b9bfc08018cf4e779d0ff858bc7536d06c8d3a2010239fecab4ff776e93304
7
- data.tar.gz: 194e585093ea3025e1b582aa60a96b3d4871afd2030cd9b3cbd5b8b8f29879819d5a7bc56987bfd66adeed95febdd3cb6f188717cb65b920b1b875532f72e53a
6
+ metadata.gz: d245df3cd7ab483f306fd8fb7823cfbe41bb3b93c4fa1798c8833ac6fcfdbbba4eb62b72c0ef5be78bcc963528ac0983436594c79005309262d83340eca1a199
7
+ data.tar.gz: 03b149bc58082a045ccda45820f07c590616a50c96ce3af8777ada574f6ab7f453b57f8197b754f687ea60f679f7c162020f5973b064ad783b47fa157ca42a3b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 1.6.0
6
+
7
+ ### Added
8
+ * Added support for Snapshot API
9
+
5
10
  ## 1.5.0
6
11
  ### Added
7
12
  * Added support for Select Operator in Entries and Assets
data/README.md CHANGED
@@ -661,6 +661,20 @@ pass the ids of the levels below it.
661
661
  > Hierarchy is as follows:
662
662
  > `No Object -> Space -> ContentType -> EditorInterface`
663
663
 
664
+ ### Snapshots
665
+
666
+ Retrieving all Snapshot for a given Entry:
667
+
668
+ ```ruby
669
+ snapshots = entry.snapshots.all
670
+ ```
671
+
672
+ Retrieving a Snapshot for a given Entry:
673
+
674
+ ```ruby
675
+ snapshot = entry.snapshots.find('some_snapshot_id')
676
+ ```
677
+
664
678
  ### Pagination
665
679
 
666
680
  ```ruby
@@ -14,6 +14,7 @@ require 'contentful/management/client_locale_methods_factory'
14
14
  require 'contentful/management/client_role_methods_factory'
15
15
  require 'contentful/management/client_editor_interface_methods_factory'
16
16
  require 'contentful/management/client_webhook_methods_factory'
17
+ require 'contentful/management/client_snapshot_methods_factory'
17
18
 
18
19
  require_relative 'request'
19
20
  require 'http'
@@ -155,6 +156,15 @@ module Contentful
155
156
  ClientWebhookMethodsFactory.new(self)
156
157
  end
157
158
 
159
+ # Allows manipulation of snapshots in context of the current client
160
+ # Allows listing all webhooks for client, creating new and finding one by id.
161
+ # @see _ README for details.
162
+ #
163
+ # @return [Contentful::Management::ClientSnapshotMethodsFactory]
164
+ def snapshots
165
+ ClientSnapshotMethodsFactory.new(self)
166
+ end
167
+
158
168
  # @private
159
169
  def setup_logger
160
170
  @logger = configuration[:logger]
@@ -7,7 +7,7 @@ module Contentful
7
7
  #
8
8
  # @param [String] space_id
9
9
  # @param [Hash] params
10
- # @see _ For complete option list: http://docs.contentfulcda.apiary.io/#reference/search-parameters
10
+ # @see _ For complete option list: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
11
11
  # @deprecated This call will be soon removed from the API except for Content Types
12
12
  #
13
13
  # @return [Contentful::Management::Array<Contentful::Management::Resource>]
@@ -16,7 +16,7 @@ module Contentful
16
16
  #
17
17
  # @param [String] space_id
18
18
  # @param [Hash] params
19
- # @see _ For complete option list: http://docs.contentfulcda.apiary.io/#reference/search-parameters
19
+ # @see _ For complete option list: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
20
20
  #
21
21
  # @return [Contentful::Management::Array<Contentful::Management::Resource>]
22
22
  def all(space_id, params = {})
@@ -17,8 +17,7 @@ module Contentful
17
17
  #
18
18
  # @param [String] space_id
19
19
  # @param [String] content_type_id
20
- # @param [Hash] params
21
- # @see _ For complete option list: http://docs.contentfulcda.apiary.io/#reference/search-parameters
20
+ # @see _ For complete option list: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
22
21
  #
23
22
  # @return [Contentful::Management::EditorInterface]
24
23
  def default(space_id, content_type_id)
@@ -0,0 +1,34 @@
1
+ require_relative 'client_association_methods_factory'
2
+
3
+ module Contentful
4
+ module Management
5
+ # Wrapper for Webhook API for usage from within Client
6
+ # @private
7
+ class ClientSnapshotMethodsFactory
8
+ include Contentful::Management::ClientAssociationMethodsFactory
9
+
10
+ def create(*)
11
+ fail 'Not supported'
12
+ end
13
+
14
+ def all(space_id, entry_id, _params = {})
15
+ @resource_requester.find(
16
+ space_id: space_id,
17
+ entry_id: entry_id
18
+ )
19
+ end
20
+
21
+ def find(space_id, entry_id, snapshot_id)
22
+ @resource_requester.find(
23
+ space_id: space_id,
24
+ entry_id: entry_id,
25
+ snapshot_id: snapshot_id
26
+ )
27
+ end
28
+
29
+ def new(*)
30
+ fail 'Not supported'
31
+ end
32
+ end
33
+ end
34
+ end
@@ -15,7 +15,7 @@ module Contentful
15
15
  # Gets all entries for a specific ContentType
16
16
  #
17
17
  # @param [Hash] params
18
- # @see _ For complete option list: http://docs.contentfulcda.apiary.io/#reference/search-parameters
18
+ # @see _ For complete option list: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
19
19
  # @option params [String] 'sys.id'
20
20
  # @option params [String] :limit
21
21
  # @option params [String] :skip
@@ -12,10 +12,9 @@ module Contentful
12
12
 
13
13
  # Gets the Default Editor Interface
14
14
  #
15
+ # @param [Contentful::Management::Client] client
15
16
  # @param [String] space_id
16
17
  # @param [String] content_type_id
17
- # @param [Hash] params
18
- # @see _ For complete option list: http://docs.contentfulcda.apiary.io/#reference/search-parameters
19
18
  #
20
19
  # @return [Contentful::Management::EditorInterface]
21
20
  def self.default(client, space_id, content_type_id)
@@ -1,6 +1,7 @@
1
1
  require_relative 'resource'
2
2
  require_relative 'resource_requester'
3
3
  require_relative 'client_entry_methods_factory'
4
+ require_relative 'entry_snapshot_methods_factory'
4
5
  require_relative 'resource/entry_fields'
5
6
  require_relative 'resource/fields'
6
7
  require_relative 'resource/field_aware'
@@ -139,6 +140,15 @@ module Contentful
139
140
  end
140
141
  end
141
142
 
143
+ # Allows manipulation of snapshots in context of the current entry
144
+ # Allows listing all snapshots belonging to this entry and finding one by id.
145
+ # @see _ README for details.
146
+ #
147
+ # @return [Contentful::Management::EntrySnapshotMethodsFactory]
148
+ def snapshots
149
+ EntrySnapshotMethodsFactory.new(self)
150
+ end
151
+
142
152
  protected
143
153
 
144
154
  def query_attributes(attributes)
@@ -188,7 +198,13 @@ module Contentful
188
198
  end
189
199
 
190
200
  def fetch_content_type
191
- @content_type ||= ::Contentful::Management::ContentType.find(client, space.id, sys[:contentType].id)
201
+ content_type_id = if sys[:contentType].is_a?(::Contentful::Management::Resource)
202
+ sys[:contentType].id
203
+ else
204
+ sys[:contentType]['sys']['id']
205
+ end
206
+ space_id = space.is_a?(::Contentful::Management::Resource) ? space.id : space['sys']['id']
207
+ @content_type ||= ::Contentful::Management::ContentType.find(client, space_id, content_type_id)
192
208
  end
193
209
 
194
210
  def self.hash_with_link_object(type, attribute)
@@ -0,0 +1,30 @@
1
+ require_relative 'resource_requester'
2
+
3
+ module Contentful
4
+ module Management
5
+ # Wrapper for Entry Association Methods
6
+ # @private
7
+ module EntryAssociationMethodsFactory
8
+ attr_reader :entry
9
+
10
+ def initialize(entry)
11
+ @entry = entry
12
+ end
13
+
14
+ def all(_params = {})
15
+ associated_class.all(entry.client, entry.sys[:space].id, entry.id)
16
+ end
17
+
18
+ def find(id)
19
+ associated_class.find(entry.client, entry.sys[:space].id, entry.id, id)
20
+ end
21
+
22
+ def associated_class
23
+ class_name = /\A(.+)Entry(.+)MethodsFactory\z/.match(self.class.name).captures.join
24
+ class_name.split('::').reduce(Object) do |mod, actual_class_name|
25
+ mod.const_get(actual_class_name)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,23 @@
1
+ require_relative 'entry_association_methods_factory'
2
+
3
+ module Contentful
4
+ module Management
5
+ # Wrapper for Snapshot API for usage from within Space
6
+ # @private
7
+ class EntrySnapshotMethodsFactory
8
+ include Contentful::Management::EntryAssociationMethodsFactory
9
+
10
+ def new
11
+ fail 'Not supported'
12
+ end
13
+
14
+ def create(*)
15
+ fail 'Not supported'
16
+ end
17
+
18
+ def update(*)
19
+ fail 'Not supported'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -172,7 +172,7 @@ module Contentful
172
172
  # @param [Contentful::Management::Client] client
173
173
  # @param [String] space_id
174
174
  # @param [Hash] parameters Search Options
175
- # @see _ For complete option list: http://docs.contentfulcda.apiary.io/#reference/search-parameters
175
+ # @see _ For complete option list: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
176
176
  #
177
177
  # @return [Contentful::Management::Array<Contentful::Management::Resource>]
178
178
  def all(client, space_id, parameters = {})
@@ -8,7 +8,7 @@ module Contentful
8
8
  # @param [Contentful::Management::Client] client
9
9
  # @param [String] space_id
10
10
  # @param [Hash] parameters
11
- # @see _ For complete option list: http://docs.contentfulcda.apiary.io/#reference/search-parameters
11
+ # @see _ For complete option list: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters
12
12
  # @option parameters [String] 'sys.id' Entry ID
13
13
  # @option parameters [String] :content_type
14
14
  # @option parameters [Integer] :limit
@@ -12,6 +12,7 @@ require_relative 'api_key'
12
12
  require_relative 'locale'
13
13
  require_relative 'role'
14
14
  require_relative 'editor_interface'
15
+ require_relative 'snapshot'
15
16
 
16
17
  module Contentful
17
18
  module Management
@@ -31,7 +32,8 @@ module Contentful
31
32
  'ApiKey' => Contentful::Management::ApiKey,
32
33
  'Locale' => Contentful::Management::Locale,
33
34
  'Role' => Contentful::Management::Role,
34
- 'EditorInterface' => Contentful::Management::EditorInterface
35
+ 'EditorInterface' => Contentful::Management::EditorInterface,
36
+ 'Snapshot' => Contentful::Management::Snapshot
35
37
  }
36
38
  # Default Entry Mapping
37
39
  # @see _ README for more information on Entry Mapping
@@ -0,0 +1,77 @@
1
+ require_relative 'resource'
2
+ require_relative 'client_snapshot_methods_factory'
3
+
4
+ module Contentful
5
+ module Management
6
+ # Resource class for Snapshot.
7
+ # @see _ https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
8
+ class Snapshot
9
+ include Contentful::Management::Resource
10
+ include Contentful::Management::Resource::SystemProperties
11
+ include Contentful::Management::Resource::Refresher
12
+
13
+ property :snapshot, DynamicEntry
14
+
15
+ # Gets all Snapshots for an Entry
16
+ #
17
+ # @param [Contentful::Management::Client] client
18
+ # @param [String] space_id
19
+ # @param [String] entry_id
20
+ #
21
+ # @return [Contentful::Management::Array<Contentful::Management::Snapshot>]
22
+ def self.all(client, space_id, entry_id)
23
+ ClientSnapshotMethodsFactory.new(client).all(space_id, entry_id)
24
+ end
25
+
26
+ # Gets a Snapshot by ID
27
+ #
28
+ # @param [Contentful::Management::Client] client
29
+ # @param [String] space_id
30
+ # @param [String] entry_id
31
+ # @param [String] snapshot_id
32
+ #
33
+ # @return [Contentful::Management::Snapshot]
34
+ def self.find(client, space_id, entry_id, snapshot_id)
35
+ ClientSnapshotMethodsFactory.new(client).find(space_id, entry_id, snapshot_id)
36
+ end
37
+
38
+ # Creates a Snapshot
39
+ #
40
+ # Not Supported
41
+ def self.create(*)
42
+ fail 'Not supported'
43
+ end
44
+
45
+ # @private
46
+ def self.endpoint
47
+ 'snapshots'
48
+ end
49
+
50
+ # @private
51
+ def self.build_endpoint(endpoint_options)
52
+ space_id = endpoint_options.fetch(:space_id)
53
+ entry_id = endpoint_options.fetch(:entry_id)
54
+ snapshot_id = endpoint_options.fetch(:snapshot_id, nil)
55
+
56
+ endpoint = "/#{space_id}/entries/#{entry_id}/snapshots"
57
+ endpoint = "#{endpoint}/#{snapshot_id}" unless snapshot_id.nil?
58
+
59
+ endpoint
60
+ end
61
+
62
+ # Deletes a Snapshot
63
+ #
64
+ # Not Supported
65
+ def destroy
66
+ fail 'Not supported'
67
+ end
68
+
69
+ # Updates a Snapshot
70
+ #
71
+ # Not Supported
72
+ def update(*)
73
+ fail 'Not supported'
74
+ end
75
+ end
76
+ end
77
+ end
@@ -18,6 +18,10 @@ module Contentful
18
18
  end
19
19
  end
20
20
 
21
+ # If the query contains the :select operator, we enforce :sys properties.
22
+ # The SDK requires sys.type to function properly, but as other of our SDKs
23
+ # require more parts of the :sys properties, we decided that every SDK should
24
+ # include the complete :sys block to provide consistency accross our SDKs.
21
25
  def normalize_select!(parameters)
22
26
  return parameters unless parameters.key?(:select)
23
27
 
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '1.5.0'
6
+ VERSION = '1.6.0'
7
7
  end
8
8
  end
@@ -0,0 +1,175 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/entries/5gQdVmPHKwIk2MumquYwOu/snapshots
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulManagementGem/1.5.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
+ - facgnwwgj5fe
39
+ Content-Type:
40
+ - application/vnd.contentful.management.v1+json
41
+ Date:
42
+ - Wed, 15 Mar 2017 13:00:48 GMT
43
+ Etag:
44
+ - '"ee206ff530734e5e435ba4e4a6f65138"'
45
+ Server:
46
+ - Contentful
47
+ Strict-Transport-Security:
48
+ - max-age=15768000
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Contentful-Ratelimit-Hour-Limit:
52
+ - '36000'
53
+ X-Contentful-Ratelimit-Hour-Remaining:
54
+ - '35989'
55
+ X-Contentful-Ratelimit-Reset:
56
+ - '0'
57
+ X-Contentful-Ratelimit-Second-Limit:
58
+ - '10'
59
+ X-Contentful-Ratelimit-Second-Remaining:
60
+ - '9'
61
+ X-Contentful-Request-Id:
62
+ - fdd656a48caca3b9ebdb56278bbd97e9
63
+ Content-Length:
64
+ - '2230'
65
+ Connection:
66
+ - Close
67
+ Set-Cookie:
68
+ - incap_ses_455_673446=LdblBCssCV4lrtEEe3xQBv86yVgAAAAA/6vCZQKOGiM1pnwP0ueCPg==;
69
+ path=/; Domain=.contentful.com
70
+ - nlbi_673446=XchXGox3MHWSirWi6lKYhQAAAAD11IdruXmlA9lecyNqikh/; path=/; Domain=.contentful.com
71
+ - visid_incap_673446=nUCpGmO8SuqSEyl+gmJhG/86yVgAAAAAQUIPAAAAAABZ7NG5ziIBQ9ssmjhdUq1L;
72
+ expires=Thu, 15 Mar 2018 11:35:42 GMT; path=/; Domain=.contentful.com
73
+ X-Iinfo:
74
+ - 5-81023772-81023789 NNNN CT(80 84 0) RT(1489582840232 76) q(0 0 1 -1) r(72
75
+ 72) U5
76
+ X-Cdn:
77
+ - Incapsula
78
+ body:
79
+ encoding: ASCII-8BIT
80
+ string: |
81
+ {
82
+ "sys": {
83
+ "type": "Array"
84
+ },
85
+ "items": [
86
+ {
87
+ "sys": {
88
+ "type": "Snapshot",
89
+ "snapshotType": "publish",
90
+ "id": "6DglRQMMHWUnzi2F3RjFFo",
91
+ "createdAt": "2017-03-10T15:58:05.435Z",
92
+ "createdBy": {
93
+ "sys": {
94
+ "type": "Link",
95
+ "linkType": "User",
96
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
97
+ }
98
+ },
99
+ "updatedAt": "2017-03-10T15:58:05.435Z",
100
+ "updatedBy": {
101
+ "sys": {
102
+ "type": "Link",
103
+ "linkType": "User",
104
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
105
+ }
106
+ },
107
+ "space": {
108
+ "sys": {
109
+ "type": "Link",
110
+ "linkType": "Space",
111
+ "id": "facgnwwgj5fe"
112
+ }
113
+ }
114
+ },
115
+ "snapshot": {
116
+ "fields": {
117
+ "name": {
118
+ "en-US": "something else"
119
+ }
120
+ },
121
+ "sys": {
122
+ "id": "5gQdVmPHKwIk2MumquYwOu",
123
+ "type": "Entry",
124
+ "createdAt": "2017-03-02T18:47:44.195Z",
125
+ "createdBy": {
126
+ "sys": {
127
+ "type": "Link",
128
+ "linkType": "User",
129
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
130
+ }
131
+ },
132
+ "space": {
133
+ "sys": {
134
+ "type": "Link",
135
+ "linkType": "Space",
136
+ "id": "facgnwwgj5fe"
137
+ }
138
+ },
139
+ "contentType": {
140
+ "sys": {
141
+ "type": "Link",
142
+ "linkType": "ContentType",
143
+ "id": "test"
144
+ }
145
+ },
146
+ "version": 3,
147
+ "updatedAt": "2017-03-10T15:58:05.418Z",
148
+ "updatedBy": {
149
+ "sys": {
150
+ "type": "Link",
151
+ "linkType": "User",
152
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
153
+ }
154
+ },
155
+ "firstPublishedAt": "2017-03-10T15:58:05.418Z",
156
+ "publishedCounter": 1,
157
+ "publishedAt": "2017-03-10T15:58:05.418Z",
158
+ "publishedBy": {
159
+ "sys": {
160
+ "type": "Link",
161
+ "linkType": "User",
162
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
163
+ }
164
+ },
165
+ "publishedVersion": 2
166
+ }
167
+ }
168
+ }
169
+ ],
170
+ "skip": 0,
171
+ "limit": 100
172
+ }
173
+ http_version:
174
+ recorded_at: Wed, 15 Mar 2017 13:00:48 GMT
175
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,166 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/entries/5gQdVmPHKwIk2MumquYwOu/snapshots/6DglRQMMHWUnzi2F3RjFFo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulManagementGem/1.5.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
+ - facgnwwgj5fe
39
+ Content-Type:
40
+ - application/vnd.contentful.management.v1+json
41
+ Date:
42
+ - Wed, 15 Mar 2017 13:00:40 GMT
43
+ Etag:
44
+ - '"e7cb4a6a14f463d523a7917c8f8c0798"'
45
+ Server:
46
+ - Contentful
47
+ Strict-Transport-Security:
48
+ - max-age=15768000
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Contentful-Ratelimit-Hour-Limit:
52
+ - '36000'
53
+ X-Contentful-Ratelimit-Hour-Remaining:
54
+ - '35990'
55
+ X-Contentful-Ratelimit-Reset:
56
+ - '0'
57
+ X-Contentful-Ratelimit-Second-Limit:
58
+ - '10'
59
+ X-Contentful-Ratelimit-Second-Remaining:
60
+ - '9'
61
+ X-Contentful-Request-Id:
62
+ - 22d901abad32cb929af5ff811fa7c576
63
+ Content-Length:
64
+ - '1812'
65
+ Connection:
66
+ - Close
67
+ Set-Cookie:
68
+ - incap_ses_455_673446=GeSLeHIwgDkBptEEe3xQBvg6yVgAAAAA066E7B87Jk5uc41TYOkiVA==;
69
+ path=/; Domain=.contentful.com
70
+ - nlbi_673446=Z+7JIgkUJjjGDvGK6lKYhQAAAABvPw9JF3ZUHlxEUbV7CrLL; path=/; Domain=.contentful.com
71
+ - visid_incap_673446=piS6dEBqQB6IarxgWlDmRPg6yVgAAAAAQUIPAAAAAABgkxLUNytbyjh0ZKnBdnlf;
72
+ expires=Thu, 15 Mar 2018 11:35:42 GMT; path=/; Domain=.contentful.com
73
+ X-Iinfo:
74
+ - 7-48171554-48171566 NNNN CT(76 76 0) RT(1489582836194 75) q(0 0 2 -1) r(38
75
+ 38) U5
76
+ X-Cdn:
77
+ - Incapsula
78
+ body:
79
+ encoding: ASCII-8BIT
80
+ string: |
81
+ {
82
+ "sys": {
83
+ "type": "Snapshot",
84
+ "snapshotType": "publish",
85
+ "id": "6DglRQMMHWUnzi2F3RjFFo",
86
+ "createdAt": "2017-03-10T15:58:05.435Z",
87
+ "createdBy": {
88
+ "sys": {
89
+ "type": "Link",
90
+ "linkType": "User",
91
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
92
+ }
93
+ },
94
+ "updatedAt": "2017-03-10T15:58:05.435Z",
95
+ "updatedBy": {
96
+ "sys": {
97
+ "type": "Link",
98
+ "linkType": "User",
99
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
100
+ }
101
+ },
102
+ "space": {
103
+ "sys": {
104
+ "type": "Link",
105
+ "linkType": "Space",
106
+ "id": "facgnwwgj5fe"
107
+ }
108
+ }
109
+ },
110
+ "snapshot": {
111
+ "fields": {
112
+ "name": {
113
+ "en-US": "something else"
114
+ }
115
+ },
116
+ "sys": {
117
+ "id": "5gQdVmPHKwIk2MumquYwOu",
118
+ "type": "Entry",
119
+ "createdAt": "2017-03-02T18:47:44.195Z",
120
+ "createdBy": {
121
+ "sys": {
122
+ "type": "Link",
123
+ "linkType": "User",
124
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
125
+ }
126
+ },
127
+ "space": {
128
+ "sys": {
129
+ "type": "Link",
130
+ "linkType": "Space",
131
+ "id": "facgnwwgj5fe"
132
+ }
133
+ },
134
+ "contentType": {
135
+ "sys": {
136
+ "type": "Link",
137
+ "linkType": "ContentType",
138
+ "id": "test"
139
+ }
140
+ },
141
+ "version": 3,
142
+ "updatedAt": "2017-03-10T15:58:05.418Z",
143
+ "updatedBy": {
144
+ "sys": {
145
+ "type": "Link",
146
+ "linkType": "User",
147
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
148
+ }
149
+ },
150
+ "firstPublishedAt": "2017-03-10T15:58:05.418Z",
151
+ "publishedCounter": 1,
152
+ "publishedAt": "2017-03-10T15:58:05.418Z",
153
+ "publishedBy": {
154
+ "sys": {
155
+ "type": "Link",
156
+ "linkType": "User",
157
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
158
+ }
159
+ },
160
+ "publishedVersion": 2
161
+ }
162
+ }
163
+ }
164
+ http_version:
165
+ recorded_at: Wed, 15 Mar 2017 13:00:40 GMT
166
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,92 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/entries/5gQdVmPHKwIk2MumquYwOu/snapshots/not_exist
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulManagementGem/1.5.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: 404
25
+ message: Not Found
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
+ Content-Type:
38
+ - application/vnd.contentful.management.v1+json
39
+ Date:
40
+ - Wed, 15 Mar 2017 13:01:18 GMT
41
+ Server:
42
+ - Contentful
43
+ Strict-Transport-Security:
44
+ - max-age=15768000
45
+ X-Content-Type-Options:
46
+ - nosniff
47
+ X-Contentful-Ratelimit-Hour-Limit:
48
+ - '36000'
49
+ X-Contentful-Ratelimit-Hour-Remaining:
50
+ - '35988'
51
+ X-Contentful-Ratelimit-Reset:
52
+ - '0'
53
+ X-Contentful-Ratelimit-Second-Limit:
54
+ - '10'
55
+ X-Contentful-Ratelimit-Second-Remaining:
56
+ - '9'
57
+ X-Contentful-Request-Id:
58
+ - afd5d6e7bc6aaf08d085fc4c23aaf744
59
+ Content-Length:
60
+ - '256'
61
+ Connection:
62
+ - Close
63
+ Set-Cookie:
64
+ - incap_ses_455_673446=OJ4+BSi+WGBf09EEe3xQBh47yVgAAAAAX+bqWYlGC4oiKmWzaDxmLQ==;
65
+ path=/; Domain=.contentful.com
66
+ - nlbi_673446=wwHdJpMe1xiJzwoq6lKYhQAAAADZTOr3iSzc+jzOAjfUX2eF; path=/; Domain=.contentful.com
67
+ - visid_incap_673446=+KmqM5KzTLSG+5bIDro0aB47yVgAAAAAQUIPAAAAAAAeOn0F7mP/l5RRcC7XvjIt;
68
+ expires=Thu, 15 Mar 2018 11:35:42 GMT; path=/; Domain=.contentful.com
69
+ X-Iinfo:
70
+ - 4-66000696-66000702 NNNN CT(97 97 0) RT(1489582877658 78) q(0 0 2 -1) r(5
71
+ 5) U5
72
+ X-Cdn:
73
+ - Incapsula
74
+ body:
75
+ encoding: ASCII-8BIT
76
+ string: |
77
+ {
78
+ "sys": {
79
+ "type": "Error",
80
+ "id": "NotFound"
81
+ },
82
+ "message": "The resource could not be found.",
83
+ "details": {
84
+ "space": "facgnwwgj5fe",
85
+ "id": "not_exist",
86
+ "type": "Snapshot"
87
+ },
88
+ "requestId": "afd5d6e7bc6aaf08d085fc4c23aaf744"
89
+ }
90
+ http_version:
91
+ recorded_at: Wed, 15 Mar 2017 13:01:18 GMT
92
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,301 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/entries/5gQdVmPHKwIk2MumquYwOu/snapshots/6DglRQMMHWUnzi2F3RjFFo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - RubyContentfulManagementGem/1.5.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
+ - facgnwwgj5fe
39
+ Content-Type:
40
+ - application/vnd.contentful.management.v1+json
41
+ Date:
42
+ - Wed, 15 Mar 2017 14:15:11 GMT
43
+ Etag:
44
+ - '"e7cb4a6a14f463d523a7917c8f8c0798"'
45
+ Server:
46
+ - Contentful
47
+ Strict-Transport-Security:
48
+ - max-age=15768000
49
+ X-Content-Type-Options:
50
+ - nosniff
51
+ X-Contentful-Ratelimit-Hour-Limit:
52
+ - '36000'
53
+ X-Contentful-Ratelimit-Hour-Remaining:
54
+ - '35997'
55
+ X-Contentful-Ratelimit-Reset:
56
+ - '0'
57
+ X-Contentful-Ratelimit-Second-Limit:
58
+ - '10'
59
+ X-Contentful-Ratelimit-Second-Remaining:
60
+ - '9'
61
+ X-Contentful-Request-Id:
62
+ - c6415481467edf1db09a8f6af9992f0b
63
+ Content-Length:
64
+ - '1812'
65
+ Connection:
66
+ - Close
67
+ Set-Cookie:
68
+ - incap_ses_455_673446=QOp8Fya4sETH+udOfXxQBm5MyVgAAAAA02XoDJZSZGFtrd9dnzAraQ==;
69
+ path=/; Domain=.contentful.com
70
+ - nlbi_673446=VjGyGI/Z/j6QKUO36lKYhQAAAAAL9l+bL1QH0yHsyL13x65q; path=/; Domain=.contentful.com
71
+ - visid_incap_673446=Gkaf4qLtR+WiJtmNC+2rDG5MyVgAAAAAQUIPAAAAAADB5VOrUuXXOfF40O0pU58Z;
72
+ expires=Thu, 15 Mar 2018 13:30:20 GMT; path=/; Domain=.contentful.com
73
+ X-Iinfo:
74
+ - 6-189905-189906 NNNN CT(75 77 0) RT(1489587310149 82) q(0 0 1 -1) r(3 3) U5
75
+ X-Cdn:
76
+ - Incapsula
77
+ body:
78
+ encoding: ASCII-8BIT
79
+ string: |
80
+ {
81
+ "sys": {
82
+ "type": "Snapshot",
83
+ "snapshotType": "publish",
84
+ "id": "6DglRQMMHWUnzi2F3RjFFo",
85
+ "createdAt": "2017-03-10T15:58:05.435Z",
86
+ "createdBy": {
87
+ "sys": {
88
+ "type": "Link",
89
+ "linkType": "User",
90
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
91
+ }
92
+ },
93
+ "updatedAt": "2017-03-10T15:58:05.435Z",
94
+ "updatedBy": {
95
+ "sys": {
96
+ "type": "Link",
97
+ "linkType": "User",
98
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
99
+ }
100
+ },
101
+ "space": {
102
+ "sys": {
103
+ "type": "Link",
104
+ "linkType": "Space",
105
+ "id": "facgnwwgj5fe"
106
+ }
107
+ }
108
+ },
109
+ "snapshot": {
110
+ "fields": {
111
+ "name": {
112
+ "en-US": "something else"
113
+ }
114
+ },
115
+ "sys": {
116
+ "id": "5gQdVmPHKwIk2MumquYwOu",
117
+ "type": "Entry",
118
+ "createdAt": "2017-03-02T18:47:44.195Z",
119
+ "createdBy": {
120
+ "sys": {
121
+ "type": "Link",
122
+ "linkType": "User",
123
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
124
+ }
125
+ },
126
+ "space": {
127
+ "sys": {
128
+ "type": "Link",
129
+ "linkType": "Space",
130
+ "id": "facgnwwgj5fe"
131
+ }
132
+ },
133
+ "contentType": {
134
+ "sys": {
135
+ "type": "Link",
136
+ "linkType": "ContentType",
137
+ "id": "test"
138
+ }
139
+ },
140
+ "version": 3,
141
+ "updatedAt": "2017-03-10T15:58:05.418Z",
142
+ "updatedBy": {
143
+ "sys": {
144
+ "type": "Link",
145
+ "linkType": "User",
146
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
147
+ }
148
+ },
149
+ "firstPublishedAt": "2017-03-10T15:58:05.418Z",
150
+ "publishedCounter": 1,
151
+ "publishedAt": "2017-03-10T15:58:05.418Z",
152
+ "publishedBy": {
153
+ "sys": {
154
+ "type": "Link",
155
+ "linkType": "User",
156
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
157
+ }
158
+ },
159
+ "publishedVersion": 2
160
+ }
161
+ }
162
+ }
163
+ http_version:
164
+ recorded_at: Wed, 15 Mar 2017 14:15:11 GMT
165
+ - request:
166
+ method: get
167
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/content_types/test
168
+ body:
169
+ encoding: US-ASCII
170
+ string: ''
171
+ headers:
172
+ User-Agent:
173
+ - RubyContentfulManagementGem/1.5.0
174
+ Authorization:
175
+ - Bearer <ACCESS_TOKEN>
176
+ Content-Type:
177
+ - application/vnd.contentful.management.v1+json
178
+ Content-Length:
179
+ - '0'
180
+ Connection:
181
+ - close
182
+ Host:
183
+ - api.contentful.com
184
+ response:
185
+ status:
186
+ code: 200
187
+ message: OK
188
+ headers:
189
+ Access-Control-Allow-Headers:
190
+ - 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
191
+ Access-Control-Allow-Methods:
192
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
193
+ Access-Control-Allow-Origin:
194
+ - "*"
195
+ Access-Control-Expose-Headers:
196
+ - Etag
197
+ Access-Control-Max-Age:
198
+ - '1728000'
199
+ Cf-Space-Id:
200
+ - facgnwwgj5fe
201
+ Content-Type:
202
+ - application/vnd.contentful.management.v1+json
203
+ Date:
204
+ - Wed, 15 Mar 2017 14:15:15 GMT
205
+ Etag:
206
+ - '"c34724c7958eb31fe3ea50969e50f751"'
207
+ Server:
208
+ - Contentful
209
+ Strict-Transport-Security:
210
+ - max-age=15768000
211
+ X-Content-Type-Options:
212
+ - nosniff
213
+ X-Contentful-Ratelimit-Hour-Limit:
214
+ - '36000'
215
+ X-Contentful-Ratelimit-Hour-Remaining:
216
+ - '35996'
217
+ X-Contentful-Ratelimit-Reset:
218
+ - '0'
219
+ X-Contentful-Ratelimit-Second-Limit:
220
+ - '10'
221
+ X-Contentful-Ratelimit-Second-Remaining:
222
+ - '8'
223
+ X-Contentful-Request-Id:
224
+ - b1328a38a8618fede4530cded1786e7c
225
+ Content-Length:
226
+ - '1159'
227
+ Connection:
228
+ - Close
229
+ Set-Cookie:
230
+ - incap_ses_455_673446=2d9VUTNqqQRs/+dOfXxQBnJMyVgAAAAAh4zCgN3NwnL2cQ8hI+ciLA==;
231
+ path=/; Domain=.contentful.com
232
+ - nlbi_673446=ZOdzI6lDwmdaxLEl6lKYhQAAAACxCUtusdaevIGW6gJC4DV/; path=/; Domain=.contentful.com
233
+ - visid_incap_673446=S0SEOYVESMa+CnIHxIO47nJMyVgAAAAAQUIPAAAAAADNV4SQJLTvAQEr6bu7XQSV;
234
+ expires=Thu, 15 Mar 2018 13:30:10 GMT; path=/; Domain=.contentful.com
235
+ X-Iinfo:
236
+ - 4-368281-368307 NNNN CT(78 77 0) RT(1489587310676 76) q(0 0 2 -1) r(39 39)
237
+ U5
238
+ X-Cdn:
239
+ - Incapsula
240
+ body:
241
+ encoding: ASCII-8BIT
242
+ string: |
243
+ {
244
+ "name": "Test",
245
+ "fields": [
246
+ {
247
+ "name": "name",
248
+ "id": "name",
249
+ "type": "Symbol",
250
+ "localized": false,
251
+ "required": false,
252
+ "disabled": false,
253
+ "omitted": false,
254
+ "validations": []
255
+ }
256
+ ],
257
+ "displayField": "name",
258
+ "description": "",
259
+ "sys": {
260
+ "id": "test",
261
+ "type": "ContentType",
262
+ "createdAt": "2017-03-02T18:32:49.570Z",
263
+ "createdBy": {
264
+ "sys": {
265
+ "type": "Link",
266
+ "linkType": "User",
267
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
268
+ }
269
+ },
270
+ "space": {
271
+ "sys": {
272
+ "type": "Link",
273
+ "linkType": "Space",
274
+ "id": "facgnwwgj5fe"
275
+ }
276
+ },
277
+ "firstPublishedAt": "2017-03-02T18:32:50.559Z",
278
+ "publishedCounter": 1,
279
+ "publishedAt": "2017-03-02T18:32:50.559Z",
280
+ "publishedBy": {
281
+ "sys": {
282
+ "type": "Link",
283
+ "linkType": "User",
284
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
285
+ }
286
+ },
287
+ "publishedVersion": 1,
288
+ "version": 2,
289
+ "updatedAt": "2017-03-02T18:32:50.586Z",
290
+ "updatedBy": {
291
+ "sys": {
292
+ "type": "Link",
293
+ "linkType": "User",
294
+ "id": "4SejVrWT96dvL9IV4Nb7sQ"
295
+ }
296
+ }
297
+ }
298
+ }
299
+ http_version:
300
+ recorded_at: Wed, 15 Mar 2017 14:15:15 GMT
301
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,87 @@
1
+ require 'spec_helper'
2
+ require 'contentful/management/space'
3
+ require 'contentful/management/client'
4
+
5
+ module Contentful
6
+ module Management
7
+ describe Snapshot do
8
+ let(:token) { '<ACCESS_TOKEN>' }
9
+ let(:space_id) { 'facgnwwgj5fe' }
10
+ let(:entry_id) { '5gQdVmPHKwIk2MumquYwOu' }
11
+ let(:snapshot_id) { '6DglRQMMHWUnzi2F3RjFFo' }
12
+ let!(:client) { Client.new(token) }
13
+
14
+ subject { client.snapshots }
15
+
16
+ describe '.all' do
17
+ it 'class method also works' do
18
+ vcr('snapshot/all') { expect(Contentful::Management::Snapshot.all(client, space_id, entry_id)).to be_kind_of Contentful::Management::Array }
19
+ end
20
+ it 'returns a Contentful::Array' do
21
+ vcr('snapshot/all') { expect(subject.all(space_id, entry_id)).to be_kind_of Contentful::Management::Array }
22
+ end
23
+ it 'builds a Contentful::Management::Snapshot object' do
24
+ vcr('snapshot/all') { expect(subject.all(space_id, entry_id).first).to be_kind_of Contentful::Management::Snapshot }
25
+ end
26
+ end
27
+
28
+ describe '.find' do
29
+ it 'class method also works' do
30
+ vcr('snapshot/find') { expect(Contentful::Management::Snapshot.find(client, space_id, entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
31
+ end
32
+ it 'returns a Contentful::Management::Snapshot' do
33
+ vcr('snapshot/find') { expect(subject.find(space_id, entry_id, snapshot_id)).to be_kind_of Contentful::Management::Snapshot }
34
+ end
35
+ it 'returns snapshot for a given key' do
36
+ vcr('snapshot/find') do
37
+ snapshot = subject.find(space_id, entry_id, snapshot_id)
38
+ expect(snapshot.id).to eql snapshot_id
39
+ end
40
+ end
41
+ it 'returns an error when snapshot does not exist' do
42
+ vcr('snapshot/find_not_found') do
43
+ result = subject.find(space_id, entry_id, 'not_exist')
44
+ expect(result).to be_kind_of Contentful::Management::NotFound
45
+ end
46
+ end
47
+ end
48
+
49
+ describe '.create' do
50
+ it 'is not supported' do
51
+ expect { subject.create }.to raise_error 'Not supported'
52
+ end
53
+ end
54
+
55
+ describe '#update' do
56
+ it 'is not supported' do
57
+ vcr('snapshot/find') do
58
+ snapshot = subject.find(space_id, entry_id, snapshot_id)
59
+
60
+ expect { snapshot.update }.to raise_error 'Not supported'
61
+ end
62
+ end
63
+ end
64
+
65
+ describe '#destroy' do
66
+ it 'is not supported' do
67
+ vcr('snapshot/find') do
68
+ snapshot = subject.find(space_id, entry_id, snapshot_id)
69
+
70
+ expect { snapshot.destroy }.to raise_error 'Not supported'
71
+ end
72
+ end
73
+ end
74
+
75
+ describe 'properties' do
76
+ it '.snapshot' do
77
+ vcr('snapshot/properties') do
78
+ snapshot = subject.find(space_id, entry_id, snapshot_id)
79
+
80
+ expect(snapshot.snapshot).to be_a Contentful::Management::Entry
81
+ expect(snapshot.snapshot.name['en-US']).to eq 'something else'
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+ 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: 1.5.0
4
+ version: 1.6.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: 2016-12-19 00:00:00.000000000 Z
13
+ date: 2017-04-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -243,6 +243,7 @@ files:
243
243
  - lib/contentful/management/client_entry_methods_factory.rb
244
244
  - lib/contentful/management/client_locale_methods_factory.rb
245
245
  - lib/contentful/management/client_role_methods_factory.rb
246
+ - lib/contentful/management/client_snapshot_methods_factory.rb
246
247
  - lib/contentful/management/client_space_methods_factory.rb
247
248
  - lib/contentful/management/client_webhook_methods_factory.rb
248
249
  - lib/contentful/management/content_type.rb
@@ -251,6 +252,8 @@ files:
251
252
  - lib/contentful/management/dynamic_entry.rb
252
253
  - lib/contentful/management/editor_interface.rb
253
254
  - lib/contentful/management/entry.rb
255
+ - lib/contentful/management/entry_association_methods_factory.rb
256
+ - lib/contentful/management/entry_snapshot_methods_factory.rb
254
257
  - lib/contentful/management/error.rb
255
258
  - lib/contentful/management/field.rb
256
259
  - lib/contentful/management/file.rb
@@ -274,6 +277,7 @@ files:
274
277
  - lib/contentful/management/resource_requester.rb
275
278
  - lib/contentful/management/response.rb
276
279
  - lib/contentful/management/role.rb
280
+ - lib/contentful/management/snapshot.rb
277
281
  - lib/contentful/management/space.rb
278
282
  - lib/contentful/management/space_api_key_methods_factory.rb
279
283
  - lib/contentful/management/space_asset_methods_factory.rb
@@ -493,6 +497,10 @@ files:
493
497
  - spec/fixtures/vcr_cassettes/roles/find.yml
494
498
  - spec/fixtures/vcr_cassettes/roles/find_for_space_not_found.yml
495
499
  - spec/fixtures/vcr_cassettes/roles/update.yml
500
+ - spec/fixtures/vcr_cassettes/snapshot/all.yml
501
+ - spec/fixtures/vcr_cassettes/snapshot/find.yml
502
+ - spec/fixtures/vcr_cassettes/snapshot/find_not_found.yml
503
+ - spec/fixtures/vcr_cassettes/snapshot/properties.yml
496
504
  - spec/fixtures/vcr_cassettes/space/all.yml
497
505
  - spec/fixtures/vcr_cassettes/space/api_key/all.yml
498
506
  - spec/fixtures/vcr_cassettes/space/api_key/create.yml
@@ -556,6 +564,7 @@ files:
556
564
  - spec/lib/contentful/management/entry_spec.rb
557
565
  - spec/lib/contentful/management/locale_spec.rb
558
566
  - spec/lib/contentful/management/role_spec.rb
567
+ - spec/lib/contentful/management/snapshot_spec.rb
559
568
  - spec/lib/contentful/management/space_spec.rb
560
569
  - spec/lib/contentful/management/webhook_spec.rb
561
570
  - spec/spec_helper.rb
@@ -789,6 +798,10 @@ test_files:
789
798
  - spec/fixtures/vcr_cassettes/roles/find.yml
790
799
  - spec/fixtures/vcr_cassettes/roles/find_for_space_not_found.yml
791
800
  - spec/fixtures/vcr_cassettes/roles/update.yml
801
+ - spec/fixtures/vcr_cassettes/snapshot/all.yml
802
+ - spec/fixtures/vcr_cassettes/snapshot/find.yml
803
+ - spec/fixtures/vcr_cassettes/snapshot/find_not_found.yml
804
+ - spec/fixtures/vcr_cassettes/snapshot/properties.yml
792
805
  - spec/fixtures/vcr_cassettes/space/all.yml
793
806
  - spec/fixtures/vcr_cassettes/space/api_key/all.yml
794
807
  - spec/fixtures/vcr_cassettes/space/api_key/create.yml
@@ -852,6 +865,7 @@ test_files:
852
865
  - spec/lib/contentful/management/entry_spec.rb
853
866
  - spec/lib/contentful/management/locale_spec.rb
854
867
  - spec/lib/contentful/management/role_spec.rb
868
+ - spec/lib/contentful/management/snapshot_spec.rb
855
869
  - spec/lib/contentful/management/space_spec.rb
856
870
  - spec/lib/contentful/management/webhook_spec.rb
857
871
  - spec/spec_helper.rb