contentful-management 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. data/CHANGELOG.md +8 -0
  2. data/README.md +17 -0
  3. data/lib/contentful/management/array.rb +3 -1
  4. data/lib/contentful/management/asset.rb +16 -14
  5. data/lib/contentful/management/client.rb +1 -1
  6. data/lib/contentful/management/content_type.rb +18 -18
  7. data/lib/contentful/management/entry.rb +20 -19
  8. data/lib/contentful/management/locale.rb +4 -4
  9. data/lib/contentful/management/request.rb +4 -2
  10. data/lib/contentful/management/resource.rb +8 -8
  11. data/lib/contentful/management/resource/refresher.rb +8 -1
  12. data/lib/contentful/management/resource_builder.rb +3 -3
  13. data/lib/contentful/management/response.rb +10 -3
  14. data/lib/contentful/management/space.rb +11 -11
  15. data/lib/contentful/management/version.rb +1 -1
  16. data/spec/fixtures/vcr_cassettes/asset/create_with_locale.yml +151 -0
  17. data/spec/fixtures/vcr_cassettes/asset/limited_assets_next_page.yml +123 -0
  18. data/spec/fixtures/vcr_cassettes/asset/reload.yml +406 -0
  19. data/spec/fixtures/vcr_cassettes/content_type/reload.yml +394 -0
  20. data/spec/fixtures/vcr_cassettes/entry/all.yml +231 -36
  21. data/spec/fixtures/vcr_cassettes/entry/content_type_entires.yml +99 -23
  22. data/spec/fixtures/vcr_cassettes/entry/create_with_specified_locale.yml +509 -0
  23. data/spec/fixtures/vcr_cassettes/entry/limited_entries.yml +236 -0
  24. data/spec/fixtures/vcr_cassettes/entry/reload.yml +1027 -0
  25. data/spec/fixtures/vcr_cassettes/locale/reload.yml +279 -0
  26. data/spec/fixtures/vcr_cassettes/space/asset/all_with_skip_and_limit.yml +355 -0
  27. data/spec/fixtures/vcr_cassettes/space/asset/with_skipped_and_limited_assets_next_page.yml +635 -0
  28. data/spec/fixtures/vcr_cassettes/space/entry/with_skipped_and_limited_entires_next_page.yml +648 -0
  29. data/spec/fixtures/vcr_cassettes/space/entry/with_skipped_andlimited_entires.yml +468 -0
  30. data/spec/fixtures/vcr_cassettes/space/reload.yml +739 -0
  31. data/spec/lib/contentful/management/asset_spec.rb +42 -2
  32. data/spec/lib/contentful/management/content_type_spec.rb +16 -1
  33. data/spec/lib/contentful/management/entry_spec.rb +38 -5
  34. data/spec/lib/contentful/management/locale_spec.rb +14 -0
  35. data/spec/lib/contentful/management/space_spec.rb +46 -2
  36. metadata +31 -5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 0.0.3
2
+ * Fix: next_page feature
3
+ * Fix: create entry with specific locale
4
+ * Fix: service unavailable error (503)
5
+ * Fix: reload method on objects
6
+ * Code cleanup
7
+ * More documentation
8
+
1
9
  ### 0.0.2
2
10
  * Fix: Convert an Entry to a DynamicEntry after being created.
3
11
 
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
  # Contentful::Management
3
3
  [![Gem Version](https://badge.fury.io/rb/contentful-management.svg)](http://badge.fury.io/rb/contentful-management) [![Build Status](https://travis-ci.org/contentful/contentful-management.rb.svg)](https://travis-ci.org/contentful/contentful-management.rb)
4
4
 
5
+ # This Gem does not yet support the full API functionality.
6
+
5
7
  Ruby client for the Contentful Content Management API.
6
8
 
7
9
  Contentful is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.
@@ -14,6 +16,9 @@ Add this line to your application's Gemfile:
14
16
 
15
17
  ## Usage
16
18
 
19
+ ### Examples
20
+ Some examples can be found in the ```examples/``` directory or you take a look at this [extended example script](https://github.com/contentful/cma_import_script).
21
+
17
22
  ### Client
18
23
 
19
24
  At the beginning the API client instance should be created for each thread that is going to be used in your application:
@@ -108,6 +113,11 @@ blog_post_content_type.fields.create(id: 'title_field_id', name: 'Post Title', t
108
113
  ```
109
114
  - if the field_id exists, the related field will be updated.
110
115
 
116
+ or the field of link type:
117
+ ```ruby
118
+ blog_post_content_type.fields.create(id: 'my_entry_link_field', name: 'My Entry Link Field', type: 'Link', link_type: 'Entry')
119
+ ```
120
+
111
121
  or the field of an array type:
112
122
  ```ruby
113
123
  items = Contentful::Management::Field.new
@@ -389,6 +399,13 @@ Checking if the entry is published:
389
399
  my_entry.published?
390
400
  ```
391
401
 
402
+ ### Pagination
403
+
404
+ ```ruby
405
+ blog_space.entries.all(limit: 5).next_page
406
+ blog_space.assets.all(limit: 5).next_page
407
+ blog_space.entries.all(limit: 5).next_page
408
+ ```
392
409
 
393
410
  ## Contributing
394
411
 
@@ -25,7 +25,9 @@ module Contentful
25
25
  new_skip = (skip || 0) + (limit || DEFAULT_LIMIT)
26
26
  new_request = request.copy
27
27
  new_request.query[:skip] = new_skip
28
- new_request.get
28
+ response = new_request.get
29
+ result = ResourceBuilder.new(response, {}, {})
30
+ result.run
29
31
  else
30
32
  false
31
33
  end
@@ -5,8 +5,8 @@ require_relative 'resource/fields'
5
5
 
6
6
  module Contentful
7
7
  module Management
8
- # Resource class for Asset.
9
- # https://www.contentful.com/developers/documentation/content-management-api/#resources-assets
8
+ # Resource class for Asset.
9
+ # https://www.contentful.com/developers/documentation/content-management-api/#resources-assets
10
10
  class Asset
11
11
 
12
12
  include Contentful::Management::Resource
@@ -16,12 +16,12 @@ module Contentful
16
16
  include Contentful::Management::Resource::Refresher
17
17
 
18
18
  # Gets a collection of assets.
19
- # Takes an id of space.
19
+ # Takes an id of space and an optional hash of query options
20
20
  # Returns a Contentful::Management::Array of Contentful::Management::Asset.
21
- def self.all(space_id)
22
- request = Request.new("/#{ space_id }/assets")
21
+ def self.all(space_id, query = {})
22
+ request = Request.new("/#{ space_id }/assets", query)
23
23
  response = request.get
24
- result = ResourceBuilder.new(self, response, {}, {})
24
+ result = ResourceBuilder.new(response, {}, {})
25
25
  result.run
26
26
  end
27
27
 
@@ -31,7 +31,7 @@ module Contentful
31
31
  def self.find(space_id, asset_id)
32
32
  request = Request.new("/#{ space_id }/assets/#{ asset_id }")
33
33
  response = request.get
34
- result = ResourceBuilder.new(self, response, {}, {})
34
+ result = ResourceBuilder.new(response, {}, {})
35
35
  result.run
36
36
  end
37
37
 
@@ -39,6 +39,7 @@ module Contentful
39
39
  # Takes a space id and hash with attributes (title, description, file)
40
40
  # Returns a Contentful::Management::Asset.
41
41
  def self.create(space_id, attributes)
42
+ locale = attributes[:locale]
42
43
  asset = new
43
44
  asset.instance_variable_set(:@fields, attributes[:fields] || {})
44
45
  asset.locale = attributes[:locale] if attributes[:locale]
@@ -48,8 +49,9 @@ module Contentful
48
49
 
49
50
  request = Request.new("/#{ space_id }/assets/#{ attributes[:id] || ''}", {fields: asset.fields_for_query})
50
51
  response = attributes[:id].nil? ? request.post : request.put
51
- result = ResourceBuilder.new(self, response, {}, {}).run
52
+ result = ResourceBuilder.new(response, {}, {}).run
52
53
  result.process_files if result.is_a? self
54
+ result.locale = locale if locale
53
55
  result
54
56
  end
55
57
 
@@ -72,7 +74,7 @@ module Contentful
72
74
  self.file = attributes[:file] if attributes[:file]
73
75
  request = Request.new("/#{ space.id }/assets/#{ id }", {fields: fields_for_query}, id = nil, version: sys[:version])
74
76
  response = request.put
75
- result = ResourceBuilder.new(self, response, {}, {}).run
77
+ result = ResourceBuilder.new(response, {}, {}).run
76
78
  refresh_data(result)
77
79
  end
78
80
 
@@ -95,7 +97,7 @@ module Contentful
95
97
  if response.status == :no_content
96
98
  return true
97
99
  else
98
- result = ResourceBuilder.new(self, response, {}, {})
100
+ result = ResourceBuilder.new(response, {}, {})
99
101
  result.run
100
102
  end
101
103
  end
@@ -105,7 +107,7 @@ module Contentful
105
107
  def publish
106
108
  request = Request.new("/#{ space.id }/assets/#{ id }/published", {}, id = nil, version: sys[:version])
107
109
  response = request.put
108
- result = ResourceBuilder.new(self, response, {}, {}).run
110
+ result = ResourceBuilder.new(response, {}, {}).run
109
111
  refresh_data(result)
110
112
  end
111
113
 
@@ -114,7 +116,7 @@ module Contentful
114
116
  def unpublish
115
117
  request = Request.new("/#{ space.id }/assets/#{ id }/published", {}, id = nil, version: sys[:version])
116
118
  response = request.delete
117
- result = ResourceBuilder.new(self, response, {}, {}).run
119
+ result = ResourceBuilder.new(response, {}, {}).run
118
120
  refresh_data(result)
119
121
  end
120
122
 
@@ -123,7 +125,7 @@ module Contentful
123
125
  def archive
124
126
  request = Request.new("/#{ space.id }/assets/#{ id }/archived", {}, id = nil, version: sys[:version])
125
127
  response = request.put
126
- result = ResourceBuilder.new(self, response, {}, {}).run
128
+ result = ResourceBuilder.new(response, {}, {}).run
127
129
  refresh_data(result)
128
130
  end
129
131
 
@@ -132,7 +134,7 @@ module Contentful
132
134
  def unarchive
133
135
  request = Request.new("/#{ space.id }/assets/#{ id }/archived", {}, id = nil, version: sys[:version])
134
136
  response = request.delete
135
- result = ResourceBuilder.new(self, response, {}, {}).run
137
+ result = ResourceBuilder.new(response, {}, {}).run
136
138
  refresh_data(result)
137
139
  end
138
140
 
@@ -90,7 +90,7 @@ module Contentful
90
90
 
91
91
  def get(request)
92
92
  execute_request(request) do |url|
93
- self.class.get_http(url, {}, request_headers)
93
+ self.class.get_http(url, request.query, request_headers)
94
94
  end
95
95
  end
96
96
 
@@ -29,14 +29,14 @@ module Contentful
29
29
  property :fields, Field
30
30
 
31
31
  # Gets a collection of content types.
32
- # Takes an id of space.
32
+ # Takes an id of space and an optional hash of query options
33
33
  # Returns a Contentful::Management::Array of Contentful::Management::ContentType.
34
- def self.all(space_id)
35
- request = Request.new("/#{ space_id }/content_types")
34
+ def self.all(space_id, query = {})
35
+ request = Request.new("/#{ space_id }/content_types", query)
36
36
  response = request.get
37
- result = ResourceBuilder.new(self, response, {}, {})
37
+ result = ResourceBuilder.new(response, {}, {})
38
38
  content_types = result.run
39
- Contentful::Management::Client.shared_instance.update_dynamic_entry_cache!(content_types)
39
+ client.update_dynamic_entry_cache!(content_types)
40
40
  content_types
41
41
  end
42
42
 
@@ -46,9 +46,9 @@ module Contentful
46
46
  def self.find(space_id, content_type_id)
47
47
  request = Request.new("/#{ space_id }/content_types/#{ content_type_id }")
48
48
  response = request.get
49
- result = ResourceBuilder.new(self, response, {}, {})
49
+ result = ResourceBuilder.new(response, {}, {})
50
50
  content_type = result.run
51
- Contentful::Management::Client.shared_instance.register_dynamic_entry(content_type.id, DynamicEntry.create(content_type)) if content_type.is_a?(self)
51
+ client.register_dynamic_entry(content_type.id, DynamicEntry.create(content_type)) if content_type.is_a?(self)
52
52
  content_type
53
53
  end
54
54
 
@@ -60,7 +60,7 @@ module Contentful
60
60
  if response.status == :no_content
61
61
  return true
62
62
  else
63
- result = ResourceBuilder.new(self, response, {}, {})
63
+ result = ResourceBuilder.new(response, {}, {})
64
64
  result.run
65
65
  end
66
66
  end
@@ -70,7 +70,7 @@ module Contentful
70
70
  def activate
71
71
  request = Request.new("/#{ space.id }/content_types/#{ id }/published", {}, id = nil, version: sys[:version])
72
72
  response = request.put
73
- result = ResourceBuilder.new(self, response, {}, {}).run
73
+ result = ResourceBuilder.new(response, {}, {}).run
74
74
  refresh_data(result)
75
75
  end
76
76
 
@@ -80,7 +80,7 @@ module Contentful
80
80
  def deactivate
81
81
  request = Request.new("/#{ space.id }/content_types/#{ id }/published")
82
82
  response = request.delete
83
- result = ResourceBuilder.new(self, response, {}, {}).run
83
+ result = ResourceBuilder.new(response, {}, {}).run
84
84
  refresh_data(result)
85
85
  end
86
86
 
@@ -95,12 +95,12 @@ module Contentful
95
95
  # Returns a Contentful::Management::ContentType.
96
96
  def self.create(space_id, attributes)
97
97
  fields = fields_to_nested_properties_hash(attributes[:fields] || [])
98
- request = Request.new("/#{ space_id }/content_types/#{ attributes[:id] || ''}", { name: attributes.fetch(:name),
99
- description: attributes[:description],
100
- fields: fields })
98
+ request = Request.new("/#{ space_id }/content_types/#{ attributes[:id] || ''}", {name: attributes.fetch(:name),
99
+ description: attributes[:description],
100
+ fields: fields})
101
101
  response = attributes[:id].nil? ? request.post : request.put
102
- result = ResourceBuilder.new(self, response, {}, {}).run
103
- Contentful::Management::Client.shared_instance.register_dynamic_entry(result.id, DynamicEntry.create(result)) if result.is_a?(self.class)
102
+ result = ResourceBuilder.new(response, {}, {}).run
103
+ client.register_dynamic_entry(result.id, DynamicEntry.create(result)) if result.is_a?(self.class)
104
104
  result
105
105
  end
106
106
 
@@ -115,7 +115,7 @@ module Contentful
115
115
  parameters.merge!(fields: self.class.fields_to_nested_properties_hash(attributes[:fields] || fields))
116
116
  request = Request.new("/#{ space.id }/content_types/#{ id }", parameters, id = nil, version: sys[:version])
117
117
  response = request.put
118
- result = ResourceBuilder.new(self, response, {}, {}).run
118
+ result = ResourceBuilder.new(response, {}, {}).run
119
119
  refresh_data(result)
120
120
  end
121
121
 
@@ -189,7 +189,7 @@ module Contentful
189
189
  entries.instance_exec(self) do |content_type|
190
190
 
191
191
  define_singleton_method(:all) do
192
- Contentful::Management::Entry.all(content_type.space.id, content_type_id: content_type.id)
192
+ Contentful::Management::Entry.all(content_type.space.id, content_type: content_type.id)
193
193
  end
194
194
 
195
195
  define_singleton_method(:create) do |params|
@@ -197,7 +197,7 @@ module Contentful
197
197
  end
198
198
 
199
199
  define_singleton_method(:new) do
200
- dynamic_entry_class = Contentful::Management::Client.shared_instance.register_dynamic_entry(content_type.id, DynamicEntry.create(content_type))
200
+ dynamic_entry_class = content_type.client.register_dynamic_entry(content_type.id, DynamicEntry.create(content_type))
201
201
  dynamic_entry = dynamic_entry_class.new
202
202
  dynamic_entry.content_type = content_type
203
203
  dynamic_entry
@@ -21,11 +21,9 @@ module Contentful
21
21
  # Takes an id of space and hash of parameters with optional content_type_id.
22
22
  # Returns a Contentful::Management::Array of Contentful::Management::Entry.
23
23
  def self.all(space_id, parameters = {})
24
- path = "/#{ space_id }/entries"
25
- path += "?content_type=#{parameters[:content_type_id]}" if parameters[:content_type_id]
26
- request = Request.new(path)
24
+ request = Request.new("/#{ space_id }/entries", parameters)
27
25
  response = request.get
28
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {})
26
+ result = ResourceBuilder.new(response, {}, {})
29
27
  result.run
30
28
  end
31
29
 
@@ -35,7 +33,7 @@ module Contentful
35
33
  def self.find(space_id, entry_id)
36
34
  request = Request.new("/#{ space_id }/entries/#{ entry_id }")
37
35
  response = request.get
38
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {})
36
+ result = ResourceBuilder.new(response, {}, {})
39
37
  result.run
40
38
  end
41
39
 
@@ -44,6 +42,7 @@ module Contentful
44
42
  # Returns a Contentful::Management::Entry.
45
43
  def self.create(content_type, attributes)
46
44
  custom_id = attributes[:id] || ''
45
+ locale = attributes[:locale]
47
46
  fields_for_create = if attributes[:fields] #create from initialized dynamic entry via save
48
47
  tmp_entry = new
49
48
  tmp_entry.instance_variable_set(:@fields, attributes.delete(:fields) || {})
@@ -55,9 +54,11 @@ module Contentful
55
54
  request = Request.new("/#{ content_type.sys[:space].id }/entries/#{ custom_id }", {fields: fields_for_create}, nil, content_type_id: content_type.id)
56
55
 
57
56
  response = custom_id.empty? ? request.post : request.put
58
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {})
59
- Contentful::Management::Client.shared_instance.register_dynamic_entry(content_type.id, DynamicEntry.create(content_type))
60
- result.run
57
+ result = ResourceBuilder.new(response, {}, {})
58
+ client.register_dynamic_entry(content_type.id, DynamicEntry.create(content_type))
59
+ entry = result.run
60
+ entry.locale = locale if locale
61
+ entry
61
62
  end
62
63
 
63
64
  # Updates an entry.
@@ -66,9 +67,9 @@ module Contentful
66
67
  def update(attributes)
67
68
  fields_for_update = Contentful::Management::Support.deep_hash_merge(fields_for_query, fields_from_attributes(attributes))
68
69
 
69
- request = Request.new("/#{ space.id }/entries/#{ self.id }", { fields: fields_for_update }, id = nil, version: sys[:version])
70
+ request = Request.new("/#{ space.id }/entries/#{ self.id }", {fields: fields_for_update}, id = nil, version: sys[:version])
70
71
  response = request.put
71
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {}).run
72
+ result = ResourceBuilder.new(response, {}, {}).run
72
73
  refresh_data(result)
73
74
  end
74
75
 
@@ -88,7 +89,7 @@ module Contentful
88
89
  def publish
89
90
  request = Request.new("/#{ space.id }/entries/#{ id }/published", {}, id = nil, version: sys[:version])
90
91
  response = request.put
91
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {}).run
92
+ result = ResourceBuilder.new(response, {}, {}).run
92
93
  refresh_data(result)
93
94
  end
94
95
 
@@ -97,7 +98,7 @@ module Contentful
97
98
  def unpublish
98
99
  request = Request.new("/#{ space.id }/entries/#{ id }/published", {}, id = nil, version: sys[:version])
99
100
  response = request.delete
100
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {}).run
101
+ result = ResourceBuilder.new(response, {}, {}).run
101
102
  refresh_data(result)
102
103
  end
103
104
 
@@ -106,7 +107,7 @@ module Contentful
106
107
  def archive
107
108
  request = Request.new("/#{ space.id }/entries/#{ id }/archived", {}, id = nil, version: sys[:version])
108
109
  response = request.put
109
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {}).run
110
+ result = ResourceBuilder.new(response, {}, {}).run
110
111
  refresh_data(result)
111
112
  end
112
113
 
@@ -115,7 +116,7 @@ module Contentful
115
116
  def unarchive
116
117
  request = Request.new("/#{ space.id }/entries/#{ id }/archived", {}, id = nil, version: sys[:version])
117
118
  response = request.delete
118
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {}).run
119
+ result = ResourceBuilder.new(response, {}, {}).run
119
120
  refresh_data(result)
120
121
  end
121
122
 
@@ -127,7 +128,7 @@ module Contentful
127
128
  if response.status == :no_content
128
129
  return true
129
130
  else
130
- result = ResourceBuilder.new(Contentful::Management::Client.shared_instance, response, {}, {})
131
+ result = ResourceBuilder.new(response, {}, {})
131
132
  result.run
132
133
  end
133
134
  end
@@ -173,11 +174,11 @@ module Contentful
173
174
  def self.parse_attribute_with_field(attribute, field)
174
175
  case field.type
175
176
  when ContentType::LINK then
176
- { sys: { type: field.type, linkType: field.link_type, id: attribute.id } } if attribute
177
+ {sys: {type: field.type, linkType: field.link_type, id: attribute.id}} if attribute
177
178
  when ContentType::ARRAY then
178
179
  parse_fields_array(attribute)
179
180
  when ContentType::LOCATION then
180
- { lat: attribute.properties[:lat], lon: attribute.properties[:lon] }
181
+ {lat: attribute.properties[:lat], lon: attribute.properties[:lon]}
181
182
  else
182
183
  attribute
183
184
  end
@@ -203,7 +204,7 @@ module Contentful
203
204
  if type == 'String'
204
205
  attributes
205
206
  else
206
- attributes.each_with_object([]) do |attr, arr|
207
+ attributes.each_with_object([]) do |attr, arr|
207
208
  arr << case type
208
209
  when /Entry/ then
209
210
  {sys: {type: 'Link', linkType: 'Entry', id: attr.id}}
@@ -231,7 +232,7 @@ module Contentful
231
232
  end
232
233
 
233
234
  def self.fields_with_locale(content_type, attributes)
234
- locale = content_type.sys[:space].default_locale
235
+ locale = attributes[:locale] || content_type.sys[:space].default_locale
235
236
  fields = content_type.properties[:fields]
236
237
  field_names = fields.map { |f| f.id.to_sym }
237
238
  attributes.keep_if { |key| field_names.include?(key) }
@@ -21,7 +21,7 @@ module Contentful
21
21
  def self.all(space_id = nil)
22
22
  request = Request.new("/#{ space_id }/locales")
23
23
  response = request.get
24
- result = ResourceBuilder.new(self, response, { 'Locale' => Locale }, {})
24
+ result = ResourceBuilder.new(response, { 'Locale' => Locale }, {})
25
25
  result.run
26
26
  end
27
27
 
@@ -31,7 +31,7 @@ module Contentful
31
31
  def self.find(space_id, locale_id)
32
32
  request = Request.new("/#{ space_id }/locales/#{ locale_id }")
33
33
  response = request.get
34
- result = ResourceBuilder.new(self, response, { 'Locale' => Locale }, {})
34
+ result = ResourceBuilder.new(response, { 'Locale' => Locale }, {})
35
35
  result.run
36
36
  end
37
37
 
@@ -46,7 +46,7 @@ module Contentful
46
46
  def self.create(space_id, attributes)
47
47
  request = Request.new("/#{ space_id }/locales", { 'name' => attributes.fetch(:name), 'code' => attributes.fetch(:code) })
48
48
  response = request.post
49
- result = ResourceBuilder.new(self, response, { 'Locale' => Locale }, {})
49
+ result = ResourceBuilder.new(response, { 'Locale' => Locale }, {})
50
50
  result.run
51
51
  end
52
52
 
@@ -56,7 +56,7 @@ module Contentful
56
56
  def update(attributes)
57
57
  request = Request.new("/#{ space.id }/locales/#{ id }", { 'name' => attributes.fetch(:name) }, id = nil, version: sys[:version])
58
58
  response = request.put
59
- result = ResourceBuilder.new(self, response, { 'Locale' => Locale }, {})
59
+ result = ResourceBuilder.new(response, { 'Locale' => Locale }, {})
60
60
  refresh_data(result.run)
61
61
  end
62
62
  end