contentful-management 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6df21aeaccae009003052b0d621c6aebf5be57c
4
- data.tar.gz: d0de855068614ce2b6943d3875f60c6695bac976
3
+ metadata.gz: 9bb62b21ccee20f5fd2ca7c47890fc59d37d716e
4
+ data.tar.gz: 4bbcfbbc2d3dcac8e7fa634a9eb74656e67bdfb4
5
5
  SHA512:
6
- metadata.gz: c70079bbf7f64d9038af87d0ad0be7790824cd5185a4cf2245104adf655808f30af72086f6d4d3e36a227eacbedc3f4106b263f45fd78dc46c2632eedee27f05
7
- data.tar.gz: ee42998b120b306b3f795d917763b94f86cbc3c3fd755092b710d47a1ec913d7d2fd31b427e49ad1289ddc71f53f34242fdcb62a4e99bf0291efea466bce1ef4
6
+ metadata.gz: 7af6c84a633ce3f7a898b89906d48b2dcdff4eea25fefcb97dca16ba7dfd85c60f4e9f04c35dcb6eadeb8dc1b484325cb83676bee5f9806640cfdc1b59cd37ff
7
+ data.tar.gz: 58df3a16a1e2d829a76a018e08fb7c2f7df67ead1de406731cf6f1179128371ffbb60e09cb2cd7dfaa34e22020fba7b80761435eeb428b126594cc9c1cdd3f68
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # Change Log
2
+ =======
3
+
4
+ ## 0.6.1
5
+ ### Fixed
6
+ * Fix access to space default_locale instance variable [#47](https://github.com/contentful/contentful-management.rb/pull/47)
7
+ * Better handling of 503 responses from the API [#48](https://github.com/contentful/contentful-management.rb/pull/48)
8
+ * Do Not loose displayField on update when it is not set [#52](https://github.com/contentful/contentful-management.rb/pull/52)
9
+
2
10
 
3
11
  ## 0.6.0
4
12
  ### Added
@@ -6,6 +14,7 @@
6
14
  ### Fixed
7
15
  * Handle 429 responses as errors [#46](https://github.com/contentful/contentful-management.rb/pull/46)
8
16
 
17
+
9
18
  ## 0.5.0
10
19
  ### Added
11
20
  * Allow setting a default locale when creating a space [#43](https://github.com/contentful/contentful-management.rb/pull/43)
@@ -29,6 +29,7 @@ module Contentful
29
29
  property :name, :string
30
30
  property :description, :string
31
31
  property :fields, Field
32
+ property :displayField, :string
32
33
 
33
34
  # Gets a collection of content types.
34
35
  # Takes an id of space and an optional hash of query options
@@ -122,7 +123,7 @@ module Contentful
122
123
  # Returns a Contentful::Management::ContentType.
123
124
  def update(attributes)
124
125
  parameters = {}
125
- parameters.merge!(displayField: attributes[:displayField]) if attributes[:displayField]
126
+ parameters.merge!(displayField: attributes[:displayField] || display_field)
126
127
  parameters.merge!(name: (attributes[:name] || name))
127
128
  parameters.merge!(description: (attributes[:description] || description))
128
129
  parameters.merge!(fields: self.class.fields_to_nested_properties_hash(attributes[:fields] || fields))
@@ -34,6 +34,8 @@ module Contentful
34
34
  @status = :no_content
35
35
  elsif resource_error?
36
36
  parse_contentful_error
37
+ elsif service_unavailable_response?
38
+ service_unavailable_error
37
39
  else
38
40
  parse_http_error
39
41
  end
@@ -55,6 +57,16 @@ module Contentful
55
57
  [200, 201].include?(raw.status)
56
58
  end
57
59
 
60
+ def service_unavailable_response?
61
+ @raw.status == 503
62
+ end
63
+
64
+ def service_unavailable_error
65
+ @status = :error
66
+ @error_message = 'Service Unavailable, contenful.com API seems to be down'
67
+ @object = Error[@raw.status].new(self)
68
+ end
69
+
58
70
  def parse_http_error
59
71
  @status = :error
60
72
  @object = Error[raw.status].new(self)
@@ -21,7 +21,6 @@ module Contentful
21
21
 
22
22
  property :name, :string
23
23
  property :organization, :string
24
- property :default_locale, :string
25
24
  property :locales, Locale
26
25
 
27
26
  # Gets a collection of spaces.
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Management
3
- VERSION = '0.6.0'
3
+ VERSION = '0.6.1'
4
4
  end
5
5
  end
@@ -68,6 +68,7 @@ module Contentful
68
68
  vcr('entry/service_unavailable') do
69
69
  result = subject.find(space_id, 'not_exist')
70
70
  expect(result).to be_kind_of Contentful::Management::ServiceUnavailable
71
+ expect(result.message).to eq 'Service Unavailable, contenful.com API seems to be down'
71
72
  end
72
73
  end
73
74
  end
@@ -41,6 +41,7 @@ module Contentful
41
41
  vcr('space/find') do
42
42
  space = subject.find(space_id)
43
43
  expect(space.id).to eql space_id
44
+ expect(space.default_locale).to eql 'en-US'
44
45
  end
45
46
  end
46
47
  end
@@ -100,6 +101,7 @@ module Contentful
100
101
  expect(space).to be_kind_of Contentful::Management::Space
101
102
  expect(space.name).to eq 'new space'
102
103
  expect(space.locales.all.first.code).to eql 'pl-PL'
104
+ expect(space.default_locale).to eql 'pl-PL'
103
105
  end
104
106
  end
105
107
  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: 0.6.0
4
+ version: 0.6.1
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: 2015-01-05 00:00:00.000000000 Z
13
+ date: 2015-02-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http