contentstack_utils 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/CHANGELOG.md +5 -0
- data/CODEOWNERS +1 -0
- data/Gemfile.lock +13 -13
- data/LICENSE +1 -1
- data/README.md +9 -0
- data/SECURITY.md +27 -0
- data/lib/contentstack_utils/model/metadata.rb +36 -11
- data/lib/contentstack_utils/model/options.rb +84 -5
- data/lib/contentstack_utils/utils.rb +109 -0
- data/lib/contentstack_utils/version.rb +1 -1
- data/spec/lib/model/metadata_spec.rb +40 -0
- data/spec/lib/model/option_spec.rb +223 -0
- data/spec/lib/utils_spec.rb +578 -0
- data/spec/mock/json_to_html_mock.rb +147 -0
- data/spec/spec_helper.rb +1 -2
- data/spec/support/constant.rb +116 -116
- data/spec/support/xml_parse.rb +18 -0
- metadata +16 -12
data/spec/support/xml_parse.rb
CHANGED
@@ -10,4 +10,22 @@ end
|
|
10
10
|
def getHTML(xml)
|
11
11
|
xml_doc = Nokogiri::XML(appendFrame(xml))
|
12
12
|
xml_doc.xpath('//documentfragmentcontainer').inner_html
|
13
|
+
end
|
14
|
+
|
15
|
+
def getJson(text)
|
16
|
+
JSON.parse(text)
|
17
|
+
end
|
18
|
+
|
19
|
+
def getGQLJSONRTE(node, item = '""')
|
20
|
+
entry = "{
|
21
|
+
\"single_rte\": {
|
22
|
+
\"json\": #{node},
|
23
|
+
\"embedded_itemsConnection\": #{item}
|
24
|
+
},
|
25
|
+
\"multiple_rte\": {
|
26
|
+
\"json\": [#{node}],
|
27
|
+
\"embedded_itemsConnection\": #{item}
|
28
|
+
}
|
29
|
+
}"
|
30
|
+
getJson(entry)
|
13
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentstack_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentstack
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -34,22 +34,22 @@ dependencies:
|
|
34
34
|
name: nokogiri
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 1.11.0
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '1.11'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.11.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 1.11.0
|
50
47
|
- - "~>"
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '1.11'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.11.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,11 +131,13 @@ files:
|
|
131
131
|
- ".ruby-version"
|
132
132
|
- ".yardopts"
|
133
133
|
- CHANGELOG.md
|
134
|
+
- CODEOWNERS
|
134
135
|
- Gemfile
|
135
136
|
- Gemfile.lock
|
136
137
|
- LICENSE
|
137
138
|
- README.md
|
138
139
|
- Rakefile
|
140
|
+
- SECURITY.md
|
139
141
|
- contentstack_utils.gemspec
|
140
142
|
- lib/contentstack_utils.rb
|
141
143
|
- lib/contentstack_utils/interface/renderable.rb
|
@@ -149,6 +151,7 @@ files:
|
|
149
151
|
- spec/lib/utils_spec.rb
|
150
152
|
- spec/mock/constant_render_options.rb
|
151
153
|
- spec/mock/custom_render_option.rb
|
154
|
+
- spec/mock/json_to_html_mock.rb
|
152
155
|
- spec/spec_helper.rb
|
153
156
|
- spec/support/constant.rb
|
154
157
|
- spec/support/xml_parse.rb
|
@@ -156,7 +159,7 @@ homepage: https://github.com/contentstack/contentstack-utils-ruby
|
|
156
159
|
licenses:
|
157
160
|
- MIT
|
158
161
|
metadata: {}
|
159
|
-
post_install_message:
|
162
|
+
post_install_message:
|
160
163
|
rdoc_options: []
|
161
164
|
require_paths:
|
162
165
|
- lib
|
@@ -171,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
174
|
- !ruby/object:Gem::Version
|
172
175
|
version: '0'
|
173
176
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
175
|
-
signing_key:
|
177
|
+
rubygems_version: 3.3.7
|
178
|
+
signing_key:
|
176
179
|
specification_version: 4
|
177
180
|
summary: Contentstack Ruby Utils for
|
178
181
|
test_files:
|
@@ -181,6 +184,7 @@ test_files:
|
|
181
184
|
- spec/lib/utils_spec.rb
|
182
185
|
- spec/mock/constant_render_options.rb
|
183
186
|
- spec/mock/custom_render_option.rb
|
187
|
+
- spec/mock/json_to_html_mock.rb
|
184
188
|
- spec/spec_helper.rb
|
185
189
|
- spec/support/constant.rb
|
186
190
|
- spec/support/xml_parse.rb
|