contentstack_utils 1.1.3.2 → 1.2.0
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/.github/workflows/check-branch.yml +20 -0
- data/.github/workflows/codeql-analysis.yml +68 -68
- data/.github/workflows/jira.yml +28 -28
- data/.github/workflows/release-gem.yml +30 -30
- data/.github/workflows/sast-scan.yml +10 -10
- data/.github/workflows/sca-scan.yml +15 -15
- data/.github/workflows/secrets-scan.yml +10 -10
- data/.gitignore +10 -10
- data/.yardopts +3 -3
- data/CHANGELOG.md +23 -21
- data/CODEOWNERS +1 -1
- data/Gemfile +4 -4
- data/Gemfile.lock +10 -16
- data/LICENSE +20 -20
- data/README.md +96 -96
- data/Rakefile +32 -32
- data/SECURITY.md +27 -27
- data/contentstack_utils.gemspec +31 -31
- data/lib/contentstack_utils/interface/renderable.rb +8 -8
- data/lib/contentstack_utils/model/metadata.rb +68 -68
- data/lib/contentstack_utils/model/options.rb +122 -115
- data/lib/contentstack_utils/support/helper.rb +2 -2
- data/lib/contentstack_utils/utils.rb +171 -163
- data/lib/contentstack_utils/version.rb +2 -2
- data/lib/contentstack_utils.rb +3 -3
- data/spec/lib/model/metadata_spec.rb +94 -94
- data/spec/lib/model/option_spec.rb +318 -316
- data/spec/lib/utils_spec.rb +650 -642
- data/spec/mock/constant_render_options.rb +15 -15
- data/spec/mock/custom_render_option.rb +23 -23
- data/spec/mock/json_to_html_mock.rb +146 -146
- data/spec/spec_helper.rb +9 -9
- data/spec/support/constant.rb +616 -616
- data/spec/support/xml_parse.rb +30 -30
- metadata +4 -3
data/spec/support/xml_parse.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
def getElement(xml, query)
|
2
|
-
xml_doc = Nokogiri::XML(xml)
|
3
|
-
xml_doc.xpath(query)
|
4
|
-
end
|
5
|
-
|
6
|
-
def appendFrame(string)
|
7
|
-
"<documentfragmentcontainer>#{string}</documentfragmentcontainer>"
|
8
|
-
end
|
9
|
-
|
10
|
-
def getHTML(xml)
|
11
|
-
xml_doc = Nokogiri::XML(appendFrame(xml))
|
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)
|
1
|
+
def getElement(xml, query)
|
2
|
+
xml_doc = Nokogiri::XML(xml)
|
3
|
+
xml_doc.xpath(query)
|
4
|
+
end
|
5
|
+
|
6
|
+
def appendFrame(string)
|
7
|
+
"<documentfragmentcontainer>#{string}</documentfragmentcontainer>"
|
8
|
+
end
|
9
|
+
|
10
|
+
def getHTML(xml)
|
11
|
+
xml_doc = Nokogiri::XML(appendFrame(xml))
|
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)
|
31
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentstack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -115,6 +115,7 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
+
- ".github/workflows/check-branch.yml"
|
118
119
|
- ".github/workflows/codeql-analysis.yml"
|
119
120
|
- ".github/workflows/jira.yml"
|
120
121
|
- ".github/workflows/release-gem.yml"
|
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
- !ruby/object:Gem::Version
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
172
|
+
rubygems_version: 3.1.6
|
172
173
|
signing_key:
|
173
174
|
specification_version: 4
|
174
175
|
summary: Contentstack Ruby Utils for
|