contentful-management 2.12.1 → 2.13.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: 713c97cfc5294398f42d62da51db32197d2117fff66bc2161741b463593a56f0
4
- data.tar.gz: 78627973b71ab35edf5239e2d5c08ec90c752ff11fcf76966585715849a77d60
3
+ metadata.gz: 4d88eccf48f7dafd7ea1dffa2714427454f90db64d6977f06acf54900e441b39
4
+ data.tar.gz: 8e27ade92ccc73100cb336012ca1cd50e6fc87ae2b50bddf159344cd33e7e17d
5
5
  SHA512:
6
- metadata.gz: '019005f468ed53914a758a7853e5f59535ec03c29a726d6fa8a678418cd42da3de6539d11db3426c03cf26d5cdd6c63bffbb3cd0b61aa4497466f82a5920c63d'
7
- data.tar.gz: 5f65e0d107b4b909ad7678bbd7e108f3a101e39daa9b5e698335ca9efc09860ff16a500fbf7dfd52e398d70c4d5fc745c059c0f1a5921fe0a5499a7c9c9f11a3
6
+ metadata.gz: 72d956064a708379f60b886a27c9a2565922bcad0521e895989ea9c73e3ec046a19895fe343c9e7d5f7cc1dd4adafabd3c52bdf549cb3cfe1344cda737fbf877
7
+ data.tar.gz: '093505dbccbab0e54c94c9cdce7ba9df3ebf338bcf7e3f6ac28fe857020357f7bae6d9b0ccc61d4ef9c4da80d9f854738fd9388f0fbbf0f6cfdfb6c8c6e4cba6'
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 2.13.0
6
+ ### Fixed
7
+ * Fixed a possible validation error when submitting a content type. [#218](https://github.com/contentful/contentful-management.rb/pull/218)
8
+
9
+ ### Added
10
+ * Added support for Users API. [#217](https://github.com/contentful/contentful-management.rb/pull/217)
11
+
5
12
  ## 2.12.1
6
13
 
7
14
  ### Fixed
data/README.md CHANGED
@@ -877,6 +877,17 @@ Retrieving current user details:
877
877
  user = client.users.me
878
878
  ```
879
879
 
880
+ Retrieving one user by ID from the space:
881
+
882
+ ```ruby
883
+ user = blog_space.users.find(user_id)
884
+ ```
885
+
886
+ Retrieving one user by ID from an organization:
887
+
888
+ ```ruby
889
+ user = organization.users.find('user_id')
890
+ ```
880
891
  ### UI Extensions
881
892
 
882
893
  Retrieving all UI extensions from the environment:
@@ -87,7 +87,9 @@ module Contentful
87
87
 
88
88
  def validations_to_hash(validations)
89
89
  validations.each_with_object([]) do |validation, results|
90
- results << validation.properties_to_hash
90
+ validation_hash = validation.properties_to_hash
91
+
92
+ results << validation.properties_to_hash if Field.value_exists?(validation_hash)
91
93
  end
92
94
  end
93
95
  end
@@ -1,4 +1,5 @@
1
1
  require_relative 'resource'
2
+ require 'contentful/management/organization_user_methods_factory'
2
3
 
3
4
  module Contentful
4
5
  module Management
@@ -31,6 +32,15 @@ module Contentful
31
32
  def space_periodic_usages
32
33
  ClientSpacePeriodicUsageMethodsFactory.new(client, id)
33
34
  end
35
+
36
+ # Allows viewing of users in context of an organization
37
+ # Allows listing all users for an organization, and finding one by ID.
38
+ # @see _ README for details.
39
+ #
40
+ # @return [Contentful::Management::OrganizationUserMethodsFactory]
41
+ def users
42
+ OrganizationUserMethodsFactory.new(client, id)
43
+ end
34
44
  end
35
45
  end
36
46
  end
@@ -0,0 +1,18 @@
1
+ module Contentful
2
+ module Management
3
+ # Wrapper for Users API for usage from within Organization
4
+ # @private
5
+ class OrganizationUserMethodsFactory
6
+ attr_reader :client
7
+
8
+ def initialize(client, organization_id)
9
+ @client = client
10
+ @organization_id = organization_id
11
+ end
12
+
13
+ def find(id)
14
+ User.find(client, nil, nil, id, @organization_id)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -237,8 +237,9 @@ module Contentful
237
237
  # @param [String] resource_id
238
238
  #
239
239
  # @return [Contentful::Management::Resource]
240
- def find(client, space_id, environment_id = nil, resource_id = nil)
241
- ResourceRequester.new(client, self).find(space_id: space_id, environment_id: environment_id, resource_id: resource_id)
240
+ def find(client, space_id, environment_id = nil, resource_id = nil, organization_id = nil)
241
+ ResourceRequester.new(client, self).find(space_id: space_id, environment_id: environment_id,
242
+ resource_id: resource_id, organization_id: organization_id)
242
243
  end
243
244
 
244
245
  # Creates a resource.
@@ -6,6 +6,7 @@ require_relative 'resource'
6
6
  require_relative 'environment'
7
7
  require_relative 'space_membership'
8
8
  require_relative 'space_role_methods_factory'
9
+ require_relative 'space_user_methods_factory'
9
10
  require_relative 'space_webhook_methods_factory'
10
11
  require_relative 'space_api_key_methods_factory'
11
12
  require_relative 'space_environment_methods_factory'
@@ -155,6 +156,15 @@ module Contentful
155
156
  SpaceRoleMethodsFactory.new(self)
156
157
  end
157
158
 
159
+ # Allows viewing of users in context of the current space
160
+ # Allows listing all users of space, and finding one by ID.
161
+ # @see _ README for details.
162
+ #
163
+ # @return [Contentful::Management::SpaceUserMethodsFactory]
164
+ def users
165
+ SpaceUserMethodsFactory.new(self)
166
+ end
167
+
158
168
  # Allows manipulation of webhooks in context of the current space
159
169
  # Allows listing all webhooks for space and finding one by ID.
160
170
  # @see _ README for details.
@@ -0,0 +1,19 @@
1
+ require_relative 'space_association_methods_factory'
2
+
3
+ module Contentful
4
+ module Management
5
+ # Wrapper for User API for usage from within Space
6
+ # @private
7
+ class SpaceUserMethodsFactory
8
+ attr_reader :space
9
+
10
+ def initialize(space)
11
+ @space = space
12
+ end
13
+
14
+ def find(id)
15
+ User.find(space.client, space.id, nil, id)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -19,7 +19,13 @@ module Contentful
19
19
 
20
20
  # @private
21
21
  def self.build_endpoint(endpoint_options)
22
- endpoint = 'users'
22
+ endpoint = if endpoint_options[:space_id]
23
+ "spaces/#{endpoint_options[:space_id]}/users"
24
+ elsif endpoint_options[:organization_id]
25
+ "organizations/#{endpoint_options[:organization_id]}/users"
26
+ else
27
+ 'users'
28
+ end
23
29
  endpoint = "#{endpoint}/#{endpoint_options[:resource_id]}" if endpoint_options[:resource_id]
24
30
  endpoint
25
31
  end
@@ -3,6 +3,6 @@ module Contentful
3
3
  # Management Namespace
4
4
  module Management
5
5
  # Gem Version
6
- VERSION = '2.12.1'.freeze
6
+ VERSION = '2.13.0'.freeze
7
7
  end
8
8
  end
@@ -0,0 +1,238 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/organizations
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/2.12.1; platform ruby/2.7.1; os macOS/19;
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.4.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-Skip-UI-Draft-Validation,X-Contentful-Marketplace,X-Contentful-UI-Content-Auto-Save,cf-trace
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
+ - no-store
41
+ Content-Type:
42
+ - application/vnd.contentful.management.v1+json
43
+ Contentful-Api:
44
+ - cma
45
+ Date:
46
+ - Mon, 09 Nov 2020 08:55:01 GMT
47
+ Etag:
48
+ - W/"3efddc0538e5b54bf75cbf90ccb1c729"
49
+ Referrer-Policy:
50
+ - strict-origin-when-cross-origin
51
+ Server:
52
+ - Contentful
53
+ Strict-Transport-Security:
54
+ - max-age=15768000
55
+ X-Content-Type-Options:
56
+ - nosniff
57
+ X-Contentful-Request-Id:
58
+ - 74376d8fd8a19e2d2db176416bc4b0d6
59
+ X-Contentful-Route:
60
+ - "/organizations"
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
+ - '823'
71
+ Connection:
72
+ - Close
73
+ Set-Cookie:
74
+ - incap_ses_712_673446=Qg/RRTvhu2x/pHrfYYjhCeQDqV8AAAAAkz1vmGLh8kSvCA+1Wn/EYg==;
75
+ path=/; Domain=.contentful.com
76
+ - nlbi_673446=MDI4fQlS4HQPna29KsJtVwAAAABOMh2vBc0GSdqHe8VZzfhn; path=/; Domain=.contentful.com
77
+ - visid_incap_673446=pQNC+HAGQ3iDT4Z4jTRuieQDqV8AAAAAQUIPAAAAAACegQNE7BUwsu+uBLEiHbhf;
78
+ expires=Tue, 09 Nov 2021 08:50:58 GMT; HttpOnly; path=/; Domain=.contentful.com
79
+ X-Cdn:
80
+ - Incapsula
81
+ X-Iinfo:
82
+ - 1-8672802-8672803 NNNN CT(196 398 0) RT(1604912099784 21) q(0 0 5 -1) r(8
83
+ 8) U5
84
+ body:
85
+ encoding: ASCII-8BIT
86
+ string: |+
87
+ {
88
+ "total":3,
89
+ "limit":25,
90
+ "skip":0,
91
+ "sys":{
92
+ "type":"Array"
93
+ },
94
+ "items":[
95
+ {
96
+ "name":"Contenful",
97
+ "sys":{
98
+ "type":"Organization",
99
+ "id":"59FPZVgxkP8nNontUf5ngp",
100
+ "version":0,
101
+ "createdAt":"2020-10-21T09:49:40Z",
102
+ "updatedAt":"2020-10-21T09:49:40Z"
103
+ }
104
+ },
105
+ {
106
+ "name":"Contentful Test",
107
+ "sys":{
108
+ "type":"Organization",
109
+ "id":"3JZ2sQfqkxc8XBR82Qu9pF",
110
+ "version":0,
111
+ "createdAt":"2020-10-21T10:09:50Z",
112
+ "updatedAt":"2020-10-21T10:09:50Z"
113
+ }
114
+ },
115
+ {
116
+ "name":"SDK Freelancers ",
117
+ "sys":{
118
+ "type":"Organization",
119
+ "id":"organization_id",
120
+ "version":0,
121
+ "createdAt":"2020-10-28T15:02:44Z",
122
+ "updatedAt":"2020-10-28T15:02:44Z"
123
+ }
124
+ }
125
+ ]
126
+ }
127
+
128
+ http_version:
129
+ recorded_at: Mon, 09 Nov 2020 08:55:10 GMT
130
+ - request:
131
+ method: get
132
+ uri: https://api.contentful.com/organizations/59FPZVgxkP8nNontUf5ngp/users/user_id
133
+ body:
134
+ encoding: UTF-8
135
+ string: ''
136
+ headers:
137
+ X-Contentful-User-Agent:
138
+ - sdk contentful-management.rb/2.12.1; platform ruby/2.7.1; os macOS/19;
139
+ Authorization:
140
+ - Bearer <ACCESS_TOKEN>
141
+ Content-Type:
142
+ - application/vnd.contentful.management.v1+json
143
+ Connection:
144
+ - close
145
+ Host:
146
+ - api.contentful.com
147
+ User-Agent:
148
+ - http.rb/4.4.1
149
+ response:
150
+ status:
151
+ code: 200
152
+ message: OK
153
+ headers:
154
+ Accept-Ranges:
155
+ - bytes
156
+ Access-Control-Allow-Headers:
157
+ - 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-Skip-UI-Draft-Validation,X-Contentful-Marketplace,X-Contentful-UI-Content-Auto-Save,cf-trace
158
+ Access-Control-Allow-Methods:
159
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
160
+ Access-Control-Allow-Origin:
161
+ - "*"
162
+ Access-Control-Expose-Headers:
163
+ - Etag
164
+ Access-Control-Max-Age:
165
+ - '1728000'
166
+ Cache-Control:
167
+ - no-store
168
+ Cf-Organization-Id:
169
+ - organization_id
170
+ Content-Type:
171
+ - application/vnd.contentful.management.v1+json
172
+ Contentful-Api:
173
+ - cma
174
+ Date:
175
+ - Mon, 09 Nov 2020 08:55:01 GMT
176
+ Etag:
177
+ - W/"c38e46e076152b3a920bd6a62203e744"
178
+ Referrer-Policy:
179
+ - strict-origin-when-cross-origin
180
+ Server:
181
+ - Contentful
182
+ Strict-Transport-Security:
183
+ - max-age=15768000
184
+ X-Content-Type-Options:
185
+ - nosniff
186
+ X-Contentful-Request-Id:
187
+ - 4cd94d80aba46c1e6d0cd339faf9ce02
188
+ X-Contentful-Route:
189
+ - "/organizations/:organization_id/users/:id"
190
+ X-Download-Options:
191
+ - noopen
192
+ X-Frame-Options:
193
+ - ALLOWALL
194
+ X-Permitted-Cross-Domain-Policies:
195
+ - none
196
+ X-Xss-Protection:
197
+ - 1; mode=block
198
+ Content-Length:
199
+ - '515'
200
+ Connection:
201
+ - Close
202
+ Set-Cookie:
203
+ - incap_ses_712_673446=wRcGKIb6jmaHpHrfYYjhCeQDqV8AAAAAUtA5S+ueJ5nA2hxlR20Acw==;
204
+ path=/; Domain=.contentful.com
205
+ - nlbi_673446=KqQLWK0Wb30lgiCBKsJtVwAAAABHOcr7Z3WOlKfjRnnwvvRM; path=/; Domain=.contentful.com
206
+ - visid_incap_673446=2jFEZXv3TJmC5NjmH1mj7+QDqV8AAAAAQUIPAAAAAABU4GWNeQFEzD3ONi8cdA2C;
207
+ expires=Tue, 09 Nov 2021 08:50:50 GMT; HttpOnly; path=/; Domain=.contentful.com
208
+ X-Cdn:
209
+ - Incapsula
210
+ X-Iinfo:
211
+ - 4-31177296-31177297 NNNY CT(0 0 0) RT(1604912100654 17) q(0 0 0 -1) r(2 2)
212
+ U5
213
+ body:
214
+ encoding: ASCII-8BIT
215
+ string: |+
216
+ {
217
+ "firstName":"Bhushan",
218
+ "lastName":"Lodha",
219
+ "avatarUrl":"https://lh4.googleusercontent.com/-5GT5yRkXB68/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucn0wIhq43Vhn1LdJM7PXm-iWqMhJg/s96-c/photo.jpg",
220
+ "email":"bhushanlodha@gmail.com",
221
+ "cookieConsentData":null,
222
+ "activated":true,
223
+ "signInCount":42,
224
+ "confirmed":true,
225
+ "2faEnabled":false,
226
+ "sys":{
227
+ "type":"User",
228
+ "id":"user_id",
229
+ "version":7,
230
+ "createdAt":"2020-10-21T09:49:40Z",
231
+ "updatedAt":"2020-11-09T07:19:33Z"
232
+ }
233
+ }
234
+
235
+ http_version:
236
+ recorded_at: Mon, 09 Nov 2020 08:55:10 GMT
237
+ recorded_with: VCR 4.0.0
238
+ ...
@@ -0,0 +1,254 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.contentful.com/spaces/space_id
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ X-Contentful-User-Agent:
11
+ - sdk contentful-management.rb/2.12.1; platform ruby/2.7.1; os macOS/19;
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.4.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-Skip-UI-Draft-Validation,X-Contentful-Marketplace,X-Contentful-UI-Content-Auto-Save,cf-trace
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
+ - no-store
41
+ Cf-Organization-Id:
42
+ - 1UsxHfTdIlaBhnmUQ7gO1o
43
+ Cf-Space-Id:
44
+ - space_id
45
+ Content-Type:
46
+ - application/vnd.contentful.management.v1+json
47
+ Contentful-Api:
48
+ - cma
49
+ Date:
50
+ - Sat, 17 Oct 2020 17:06:47 GMT
51
+ Etag:
52
+ - W/"601fcd7732ee5fd420cd3c7358e7062f"
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
+ - '25200'
63
+ X-Contentful-Ratelimit-Hour-Remaining:
64
+ - '25199'
65
+ X-Contentful-Ratelimit-Reset:
66
+ - '0'
67
+ X-Contentful-Ratelimit-Second-Limit:
68
+ - '7'
69
+ X-Contentful-Ratelimit-Second-Remaining:
70
+ - '6'
71
+ X-Contentful-Request-Id:
72
+ - 69a75135b674f588cb690af6bbe9b6ea
73
+ X-Contentful-Route:
74
+ - "/spaces/:id"
75
+ X-Download-Options:
76
+ - noopen
77
+ X-Frame-Options:
78
+ - ALLOWALL
79
+ X-Permitted-Cross-Domain-Policies:
80
+ - none
81
+ X-Xss-Protection:
82
+ - 1; mode=block
83
+ Content-Length:
84
+ - '599'
85
+ Connection:
86
+ - Close
87
+ Set-Cookie:
88
+ - incap_ses_474_673446=vPVGd3BW/jgpg2utq/yTBqcki18AAAAAJ67aR+d4efGGHhmOy2UPkg==;
89
+ path=/; Domain=.contentful.com
90
+ - nlbi_673446=50dtPI6S12Lj290wKsJtVwAAAACQ4tLl8XKD7NjSXGiYqGU9; path=/; Domain=.contentful.com
91
+ - visid_incap_673446=a/ygk+XzTpi8aqb6Jx66racki18AAAAAQUIPAAAAAACucr842UMhFIsf4K+wvf9w;
92
+ expires=Sun, 17 Oct 2021 12:21:37 GMT; HttpOnly; path=/; Domain=.contentful.com
93
+ X-Cdn:
94
+ - Incapsula
95
+ X-Iinfo:
96
+ - 5-73815720-73815725 NNNN CT(89 181 0) RT(1602954407439 37) q(0 0 3 0) r(4
97
+ 4) U5
98
+ body:
99
+ encoding: ASCII-8BIT
100
+ string: |+
101
+ {
102
+ "name":"TestSpace",
103
+ "sys":{
104
+ "type":"Space",
105
+ "id":"space_id",
106
+ "version":5,
107
+ "createdBy":{
108
+ "sys":{
109
+ "type":"Link",
110
+ "linkType":"User",
111
+ "id":"1Ur8gzTrKXn3qvS5CnO8W2"
112
+ }
113
+ },
114
+ "createdAt":"2018-07-07T11:26:31Z",
115
+ "updatedBy":{
116
+ "sys":{
117
+ "type":"Link",
118
+ "linkType":"User",
119
+ "id":"1Ur8gzTrKXn3qvS5CnO8W2"
120
+ }
121
+ },
122
+ "updatedAt":"2020-06-25T13:15:44Z",
123
+ "organization":{
124
+ "sys":{
125
+ "type":"Link",
126
+ "linkType":"Organization",
127
+ "id":"1UsxHfTdIlaBhnmUQ7gO1o"
128
+ }
129
+ }
130
+ }
131
+ }
132
+
133
+ http_version:
134
+ recorded_at: Sat, 17 Oct 2020 17:06:47 GMT
135
+ - request:
136
+ method: get
137
+ uri: https://api.contentful.com/spaces/space_id/users/user_id
138
+ body:
139
+ encoding: UTF-8
140
+ string: ''
141
+ headers:
142
+ X-Contentful-User-Agent:
143
+ - sdk contentful-management.rb/2.12.1; platform ruby/2.7.1; os macOS/19;
144
+ Authorization:
145
+ - Bearer <ACCESS_TOKEN>
146
+ Content-Type:
147
+ - application/vnd.contentful.management.v1+json
148
+ Connection:
149
+ - close
150
+ Host:
151
+ - api.contentful.com
152
+ User-Agent:
153
+ - http.rb/4.4.1
154
+ response:
155
+ status:
156
+ code: 200
157
+ message: OK
158
+ headers:
159
+ Accept-Ranges:
160
+ - bytes
161
+ Access-Control-Allow-Headers:
162
+ - 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-Skip-UI-Draft-Validation,X-Contentful-Marketplace,X-Contentful-UI-Content-Auto-Save,cf-trace
163
+ Access-Control-Allow-Methods:
164
+ - DELETE,GET,HEAD,POST,PUT,OPTIONS
165
+ Access-Control-Allow-Origin:
166
+ - "*"
167
+ Access-Control-Expose-Headers:
168
+ - Etag
169
+ Access-Control-Max-Age:
170
+ - '1728000'
171
+ Cache-Control:
172
+ - no-store
173
+ Cf-Organization-Id:
174
+ - 1UsxHfTdIlaBhnmUQ7gO1o
175
+ Cf-Space-Id:
176
+ - space_id
177
+ Content-Type:
178
+ - application/vnd.contentful.management.v1+json
179
+ Contentful-Api:
180
+ - cma
181
+ Date:
182
+ - Sat, 17 Oct 2020 17:06:50 GMT
183
+ Etag:
184
+ - W/"e3374bf46067776912d48ff3917814ce"
185
+ Referrer-Policy:
186
+ - strict-origin-when-cross-origin
187
+ Server:
188
+ - Contentful
189
+ Strict-Transport-Security:
190
+ - max-age=15768000
191
+ X-Content-Type-Options:
192
+ - nosniff
193
+ X-Contentful-Ratelimit-Hour-Limit:
194
+ - '25200'
195
+ X-Contentful-Ratelimit-Hour-Remaining:
196
+ - '25199'
197
+ X-Contentful-Ratelimit-Reset:
198
+ - '0'
199
+ X-Contentful-Ratelimit-Second-Limit:
200
+ - '7'
201
+ X-Contentful-Ratelimit-Second-Remaining:
202
+ - '6'
203
+ X-Contentful-Request-Id:
204
+ - 7948b3a2c1b88068c241273d46108da9
205
+ X-Contentful-Route:
206
+ - "/spaces/:space_id/users/:id"
207
+ X-Download-Options:
208
+ - noopen
209
+ X-Frame-Options:
210
+ - ALLOWALL
211
+ X-Permitted-Cross-Domain-Policies:
212
+ - none
213
+ X-Xss-Protection:
214
+ - 1; mode=block
215
+ Content-Length:
216
+ - '1113'
217
+ Connection:
218
+ - Close
219
+ Set-Cookie:
220
+ - incap_ses_474_673446=4xCeftCL8Tspg2utq/yTBqoki18AAAAALQz2u5aCBs/wWXQh5+F+Aw==;
221
+ path=/; Domain=.contentful.com
222
+ - nlbi_673446=YTEOSYwFeViedfgSKsJtVwAAAAAycNJBP9gncn9c2d3w7gVN; path=/; Domain=.contentful.com
223
+ - visid_incap_673446=a/ygk+XzTpi8aqb6Jx66racki18AAAAAQUIPAAAAAACucr842UMhFIsf4K+wvf9w;
224
+ expires=Sun, 17 Oct 2021 12:21:37 GMT; HttpOnly; path=/; Domain=.contentful.com
225
+ X-Cdn:
226
+ - Incapsula
227
+ X-Iinfo:
228
+ - 9-58737366-58737379 NNNY CT(0 0 0) RT(1602954410738 39) q(0 0 0 0) r(2 2)
229
+ U5
230
+ body:
231
+ encoding: ASCII-8BIT
232
+ string: |+
233
+ {
234
+ "firstName":"Bhushan",
235
+ "lastName":"Test",
236
+ "avatarUrl":"https://avatars3.githubusercontent.com/u/328673?s=460&u=694ca8902eaed51f8d8974d22d89423d558c4c4c&v=4",
237
+ "email":"bhushanlodha@gmail.com",
238
+ "activated":true,
239
+ "signInCount":42,
240
+ "confirmed":true,
241
+ "2faEnabled":false,
242
+ "sys":{
243
+ "type":"User",
244
+ "id":"user_id",
245
+ "version":353,
246
+ "createdAt":"2018-01-25T10:41:44Z",
247
+ "updatedAt":"2020-10-16T09:07:40Z"
248
+ }
249
+ }
250
+
251
+ http_version:
252
+ recorded_at: Sat, 17 Oct 2020 17:06:51 GMT
253
+ recorded_with: VCR 4.0.0
254
+ ...
@@ -28,6 +28,26 @@ module Contentful
28
28
  expect { subject.find }.to raise_error 'Not supported'
29
29
  end
30
30
  end
31
+
32
+ describe "users" do
33
+ describe '.find' do
34
+ it "should fetch the user if under the organizaton id" do
35
+ vcr('organization/user') {
36
+ organization = subject.all.first
37
+ user = organization.users.find('user_id')
38
+
39
+ expect(user).to be_a Contentful::Management::User
40
+ expect(user.first_name).to eq 'Bhushan'
41
+ expect(user.last_name).to eq 'Lodha'
42
+ expect(user.email).to eq 'bhushanlodha@gmail.com'
43
+ expect(user.activated).to eq true
44
+ expect(user.confirmed).to eq true
45
+ expect(user.sign_in_count).to eq 42
46
+ expect(user.avatar_url).to be_truthy
47
+ }
48
+ end
49
+ end
50
+ end
31
51
  end
32
52
  end
33
53
  end
@@ -240,6 +240,26 @@ module Contentful
240
240
  }
241
241
  end
242
242
  end
243
+
244
+ describe "users" do
245
+ describe "find" do
246
+ it "should fetch the user if under the space id" do
247
+ vcr('space/user') {
248
+ space = subject.find('space_id')
249
+ user = space.users.find('user_id')
250
+
251
+ expect(user).to be_a Contentful::Management::User
252
+ expect(user.first_name).to eq 'Bhushan'
253
+ expect(user.last_name).to eq 'Test'
254
+ expect(user.email).to eq 'bhushanlodha@gmail.com'
255
+ expect(user.activated).to eq true
256
+ expect(user.confirmed).to eq true
257
+ expect(user.sign_in_count).to eq 42
258
+ expect(user.avatar_url).to be_truthy
259
+ }
260
+ end
261
+ end
262
+ end
243
263
  end
244
264
  end
245
265
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful-management
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Protas
8
8
  - Tomasz Warkocki
9
9
  - Contentful GmbH (Andreas Tiefenthaler)
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-07-02 00:00:00.000000000 Z
13
+ date: 2020-11-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -359,6 +359,7 @@ files:
359
359
  - lib/contentful/management/location.rb
360
360
  - lib/contentful/management/organization.rb
361
361
  - lib/contentful/management/organization_periodic_usage.rb
362
+ - lib/contentful/management/organization_user_methods_factory.rb
362
363
  - lib/contentful/management/personal_access_token.rb
363
364
  - lib/contentful/management/preview_api_key.rb
364
365
  - lib/contentful/management/request.rb
@@ -388,6 +389,7 @@ files:
388
389
  - lib/contentful/management/space_preview_api_key_methods_factory.rb
389
390
  - lib/contentful/management/space_role_methods_factory.rb
390
391
  - lib/contentful/management/space_space_membership_methods_factory.rb
392
+ - lib/contentful/management/space_user_methods_factory.rb
391
393
  - lib/contentful/management/space_webhook_methods_factory.rb
392
394
  - lib/contentful/management/support.rb
393
395
  - lib/contentful/management/ui_extension.rb
@@ -649,6 +651,7 @@ files:
649
651
  - spec/fixtures/vcr_cassettes/locale/update_code.yml
650
652
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
651
653
  - spec/fixtures/vcr_cassettes/organization/all.yml
654
+ - spec/fixtures/vcr_cassettes/organization/user.yml
652
655
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/all.yml
653
656
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/filters.yml
654
657
  - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
@@ -718,6 +721,7 @@ files:
718
721
  - spec/fixtures/vcr_cassettes/space/save_update_space.yml
719
722
  - spec/fixtures/vcr_cassettes/space/update.yml
720
723
  - spec/fixtures/vcr_cassettes/space/update_with_the_same_data.yml
724
+ - spec/fixtures/vcr_cassettes/space/user.yml
721
725
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
722
726
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
723
727
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml
@@ -787,7 +791,7 @@ homepage: https://github.com/contentful/contentful-management.rb
787
791
  licenses:
788
792
  - MIT
789
793
  metadata: {}
790
- post_install_message:
794
+ post_install_message:
791
795
  rdoc_options: []
792
796
  require_paths:
793
797
  - lib
@@ -802,8 +806,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
802
806
  - !ruby/object:Gem::Version
803
807
  version: '0'
804
808
  requirements: []
805
- rubygems_version: 3.1.2
806
- signing_key:
809
+ rubygems_version: 3.0.3
810
+ signing_key:
807
811
  specification_version: 4
808
812
  summary: contentful management api
809
813
  test_files:
@@ -1056,6 +1060,7 @@ test_files:
1056
1060
  - spec/fixtures/vcr_cassettes/locale/update_code.yml
1057
1061
  - spec/fixtures/vcr_cassettes/locale/update_name.yml
1058
1062
  - spec/fixtures/vcr_cassettes/organization/all.yml
1063
+ - spec/fixtures/vcr_cassettes/organization/user.yml
1059
1064
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/all.yml
1060
1065
  - spec/fixtures/vcr_cassettes/organization_periodic_usage/filters.yml
1061
1066
  - spec/fixtures/vcr_cassettes/personal_access_token/all.yml
@@ -1125,6 +1130,7 @@ test_files:
1125
1130
  - spec/fixtures/vcr_cassettes/space/save_update_space.yml
1126
1131
  - spec/fixtures/vcr_cassettes/space/update.yml
1127
1132
  - spec/fixtures/vcr_cassettes/space/update_with_the_same_data.yml
1133
+ - spec/fixtures/vcr_cassettes/space/user.yml
1128
1134
  - spec/fixtures/vcr_cassettes/space/webhook/all.yml
1129
1135
  - spec/fixtures/vcr_cassettes/space/webhook/create.yml
1130
1136
  - spec/fixtures/vcr_cassettes/space/webhook/find.yml