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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/contentful/management/content_type.rb +2 -1
- data/lib/contentful/management/response.rb +12 -0
- data/lib/contentful/management/space.rb +0 -1
- data/lib/contentful/management/version.rb +1 -1
- data/spec/lib/contentful/management/entry_spec.rb +1 -0
- data/spec/lib/contentful/management/space_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bb62b21ccee20f5fd2ca7c47890fc59d37d716e
|
4
|
+
data.tar.gz: 4bbcfbbc2d3dcac8e7fa634a9eb74656e67bdfb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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])
|
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)
|
@@ -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.
|
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-
|
13
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|