contentstack_utils 1.1.1 → 1.1.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/.github/workflows/codeql-analysis.yml +68 -0
- data/.github/workflows/jira.yml +28 -0
- data/.github/workflows/release-gem.yml +31 -0
- data/.github/workflows/sast-scan.yml +11 -0
- data/.github/workflows/sca-scan.yml +15 -0
- data/.github/workflows/secrets-scan.yml +11 -0
- data/.gitignore +10 -10
- data/.yardopts +3 -3
- data/CHANGELOG.md +18 -12
- data/CODEOWNERS +1 -1
- data/Gemfile +4 -4
- data/Gemfile.lock +81 -76
- 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 +115 -113
- data/lib/contentstack_utils/support/helper.rb +2 -2
- data/lib/contentstack_utils/utils.rb +163 -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 +316 -309
- data/spec/lib/utils_spec.rb +642 -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 +8 -8
- data/spec/support/constant.rb +616 -616
- data/spec/support/xml_parse.rb +30 -30
- metadata +17 -11
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.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentstack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 7.0.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,27 +29,27 @@ dependencies:
|
|
29
29
|
version: '3.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 7.0.4
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: nokogiri
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '1.11'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: 1.11.0
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.11'
|
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'
|
50
47
|
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: 1.11.0
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.11'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,6 +127,12 @@ executables: []
|
|
127
127
|
extensions: []
|
128
128
|
extra_rdoc_files: []
|
129
129
|
files:
|
130
|
+
- ".github/workflows/codeql-analysis.yml"
|
131
|
+
- ".github/workflows/jira.yml"
|
132
|
+
- ".github/workflows/release-gem.yml"
|
133
|
+
- ".github/workflows/sast-scan.yml"
|
134
|
+
- ".github/workflows/sca-scan.yml"
|
135
|
+
- ".github/workflows/secrets-scan.yml"
|
130
136
|
- ".gitignore"
|
131
137
|
- ".ruby-version"
|
132
138
|
- ".yardopts"
|
@@ -174,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
180
|
- !ruby/object:Gem::Version
|
175
181
|
version: '0'
|
176
182
|
requirements: []
|
177
|
-
rubygems_version: 3.3.
|
183
|
+
rubygems_version: 3.0.3.1
|
178
184
|
signing_key:
|
179
185
|
specification_version: 4
|
180
186
|
summary: Contentstack Ruby Utils for
|