contentful_bootstrap 3.5.1 → 3.5.2
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 +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +5 -0
- data/lib/contentful/bootstrap/generator.rb +16 -6
- data/lib/contentful/bootstrap/support.rb +4 -0
- data/lib/contentful/bootstrap/version.rb +1 -1
- 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: 0c266426ff6158f7c5254cab98f9ca38bd5fe20f
|
4
|
+
data.tar.gz: 5993a12e19927dc0de0caa3e93e58863e59b83f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa0980d9e60346eaa9dfd951ff10f007505fd68326f4b6c832842b9feb58b29fb95da89160a864e38c47fd9e7edd6822cf69c63f2940a9416adf92d432ab544b
|
7
|
+
data.tar.gz: 779f7ef0e31f395930d2a14b20b3a45d156dfb61a951d73d132b4021f803461560fb25d708db23b0a7000629e0c1e27a077ba3e09c994251c8502a98a32ebf97
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## v3.5.2
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
* Fixed compatibility with CDA 2.0.0 SDK
|
9
|
+
|
5
10
|
## v3.5.1
|
6
11
|
### Fixed
|
7
12
|
* Fixed organization fetching when no organization ID is provided on the configuration file [#54](https://github.com/contentful/contentful-bootstrap.rb/issues/54)
|
@@ -45,7 +45,7 @@ module Contentful
|
|
45
45
|
result['displayField'] = type.display_field unless type.display_field.nil?
|
46
46
|
|
47
47
|
result['fields'] = type.fields.map do |field|
|
48
|
-
map_field_properties(field
|
48
|
+
map_field_properties(field)
|
49
49
|
end
|
50
50
|
|
51
51
|
result
|
@@ -63,7 +63,7 @@ module Contentful
|
|
63
63
|
|
64
64
|
entry.fields.each do |key, value|
|
65
65
|
value = map_field(value)
|
66
|
-
result['fields'][key] = value unless value.nil?
|
66
|
+
result['fields'][field_id(entry, key)] = value unless value.nil?
|
67
67
|
end
|
68
68
|
|
69
69
|
ct_id = entry.content_type.sys[:id]
|
@@ -74,6 +74,10 @@ module Contentful
|
|
74
74
|
entries
|
75
75
|
end
|
76
76
|
|
77
|
+
def field_id(entry, field_name)
|
78
|
+
entry.raw['fields'].keys.detect { |f| f == field_name.to_s || f == Support.camel_case(field_name.to_s).to_s }
|
79
|
+
end
|
80
|
+
|
77
81
|
def map_field(value)
|
78
82
|
return value.map { |v| map_field(v) } if value.is_a? ::Array
|
79
83
|
|
@@ -89,11 +93,17 @@ module Contentful
|
|
89
93
|
value
|
90
94
|
end
|
91
95
|
|
92
|
-
def map_field_properties(
|
93
|
-
|
94
|
-
|
96
|
+
def map_field_properties(field)
|
97
|
+
properties = {}
|
98
|
+
|
99
|
+
[:id, :name, :type, :link_type, :required, :localized].each do |property|
|
100
|
+
value = field.public_send(property) if field.respond_to?(property)
|
101
|
+
properties[Support.camel_case(property.to_s).to_sym] = value unless value.nil? || [:required, :localized].include?(property)
|
102
|
+
end
|
103
|
+
|
104
|
+
items = field.items if field.respond_to?(:items)
|
105
|
+
properties[:items] = map_field_properties(items) unless items.nil?
|
95
106
|
|
96
|
-
properties.delete_if { |k, v| v.nil? || [:required, :localized].include?(k) }
|
97
107
|
properties
|
98
108
|
end
|
99
109
|
end
|
@@ -3,6 +3,10 @@ require 'stringio'
|
|
3
3
|
module Contentful
|
4
4
|
module Bootstrap
|
5
5
|
module Support
|
6
|
+
def self.camel_case(a_string)
|
7
|
+
a_string.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
|
8
|
+
end
|
9
|
+
|
6
10
|
def self.silence_stderr
|
7
11
|
old_stderr = $stderr
|
8
12
|
$stderr = StringIO.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Litvak Bruno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|