contentstack_utils 1.2.2 → 1.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26efd48cc6402749d20a2d68650a14fdb9ebaec45805af1eab883f6147276806
4
- data.tar.gz: 69a031322142a21ff93243451ca14ae9474f79d7c8c354a9704d86f0370f2da7
3
+ metadata.gz: f14e384ea5f5505482d0ff84d8d0ec0f6e445a9ed35e9027fcb1c6c98f34973a
4
+ data.tar.gz: 8c769520c8e662221e4b706e5d49050b1e3071966fb8d9787b1f27c7703c897e
5
5
  SHA512:
6
- metadata.gz: ef64aeb62b58e4ae6aef98c0a1448ca4e98196cb6fb0cf634416ebbf84969f8b86735dc4bf552ad660d69fcabd5de15f1ae34bbc7d6ff7245ab647ebfac74413
7
- data.tar.gz: ca0c3505a7ee5949375df10e1912418270668728fabdb81df02ef8248e70488ddde0633be46734b99d4902260ca13aade805ad2c7fa0b9952e58cf7917455782
6
+ metadata.gz: edc506f638312d2d964bd9a24a4dea528a04e2b94bd509b8acbd61e1270b330dccb59c4ac8ace9e962e737a634b0fb062185d378691502a1f1b9ada466ee0eb4
7
+ data.tar.gz: 48cc4d4351208b30f1b2cd00156d8fb811d06140402b6e7ae0d43ec7bc7a0d55881bb7b594606e03b2869bebb995dba5e75d796f23c3748813c986114b998da6
@@ -0,0 +1,5 @@
1
+ # Cursor (optional)
2
+
3
+ **Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
4
+
5
+ This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6
1
+ 3.1.4
data/AGENTS.md ADDED
@@ -0,0 +1,49 @@
1
+ # Contentstack Utils Ruby – Agent guide
2
+
3
+ **Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
4
+
5
+ ## What this repo is
6
+
7
+ | Field | Detail |
8
+ |--------|--------|
9
+ | **Name:** | [contentstack/contentstack-utils-ruby](https://github.com/contentstack/contentstack-utils-ruby) |
10
+ | **Purpose:** | Ruby gem that renders Contentstack rich text and JSON RTE (including GraphQL-shaped payloads) to HTML, with pluggable rendering via `ContentstackUtils::Model::Options` subclasses. |
11
+ | **Out of scope (if any):** | This package does not ship an HTTP client or stack SDK; it pairs with the separate Contentstack Ruby delivery client for entry data and `_embedded_items`. |
12
+
13
+ ## Tech stack (at a glance)
14
+
15
+ | Area | Details |
16
+ |------|---------|
17
+ | Language | Ruby **≥ 3.1** (see `contentstack_utils.gemspec` and `.ruby-version` for local dev) |
18
+ | Build | **Bundler** + **RubyGems**; `contentstack_utils.gemspec`, `Gemfile` |
19
+ | Tests | **RSpec**; specs under `spec/**/*_spec.rb`, loaded via `spec/spec_helper.rb` |
20
+ | Lint / coverage | No RuboCop in-repo; **SimpleCov** in `spec/spec_helper.rb`; API docs via **YARD** (`.yardopts`, `rake yard`) |
21
+ | Runtime deps | **activesupport** (7.x), **nokogiri** (HTML / XML for legacy RTE strings) |
22
+
23
+ ## Commands (quick reference)
24
+
25
+ | Command type | Command |
26
+ |--------------|---------|
27
+ | Install deps | `bundle install` |
28
+ | Build (default task) | `bundle exec rake` (runs **spec**) |
29
+ | Test | `bundle exec rake spec` or `bundle exec rspec` |
30
+ | Docs | `bundle exec rake yard` |
31
+
32
+ **CI / automation:** There is no dedicated workflow that runs `rspec` on every push; local verification is `bundle exec rake`. Other workflows include branch checks (PRs into `master`), release publish, CodeQL, policy/SCA scans—see `.github/workflows/`.
33
+
34
+ ## Where the documentation lives: skills
35
+
36
+ | Skill | Path | What it covers |
37
+ |-------|------|----------------|
38
+ | Code review | `skills/code-review/SKILL.md` | PR checklist for this gem |
39
+ | Contentstack Utils SDK | `skills/contentstack-utils/SKILL.md` | Public API, models, CDA vs GQL paths, versioning |
40
+ | Development workflow | `skills/dev-workflow/SKILL.md` | Branches, Bundler/Rake, gem build, workflows |
41
+ | Framework & packaging | `skills/framework/SKILL.md` | Gemspec, dependencies, Ruby version, release |
42
+ | Ruby style and layout | `skills/ruby-style/SKILL.md` | Module layout, naming, matching existing code |
43
+ | Testing | `skills/testing/SKILL.md` | RSpec layout, mocks, SimpleCov, WebMock |
44
+
45
+ An index with “when to use” hints is in `skills/README.md`.
46
+
47
+ ## Using Cursor (optional)
48
+
49
+ If you use **Cursor**, **`.cursor/rules/README.md`** is the only file under `.cursor/rules`; it points to **`AGENTS.md`**—same docs as everyone else.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.4](https://github.com/contentstack/contentstack-utils-ruby/tree/v1.2.4) (2026-04-15)
4
+ - Fixed Security issues.
5
+
6
+ ## [1.2.3](https://github.com/contentstack/contentstack-utils-ruby/tree/v1.2.3) (2026-03-30)
7
+ - Fixed GQL JSON test helper parsing for hash-based fixtures by serializing Ruby hashes to JSON.
8
+ - Normalized non-doc fragment list fixtures into doc-root shape to keep nested list fragment specs stable.
9
+
3
10
  ## [1.2.2](https://github.com/contentstack/contentstack-utils-ruby/tree/v1.2.2) (2026-01-05)
4
11
  - Fixed snyk security issues
5
12
  ## [1.2.1](https://github.com/contentstack/contentstack-utils-ruby/tree/v1.2.1) (2024-02-27)
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- contentstack_utils (1.2.2)
5
- activesupport (>= 7.0)
6
- nokogiri (>= 1.11)
4
+ contentstack_utils (1.2.4)
5
+ activesupport (>= 7.0, < 8)
6
+ nokogiri (>= 1.13, < 1.19)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.2.3)
11
+ activesupport (7.2.3.1)
12
12
  base64
13
13
  benchmark (>= 0.3)
14
14
  bigdecimal
@@ -17,14 +17,14 @@ GEM
17
17
  drb
18
18
  i18n (>= 1.6, < 2)
19
19
  logger (>= 1.4.2)
20
- minitest (>= 5.1)
20
+ minitest (>= 5.1, < 6)
21
21
  securerandom (>= 0.3)
22
22
  tzinfo (~> 2.0, >= 2.0.5)
23
- addressable (2.8.8)
23
+ addressable (2.9.0)
24
24
  public_suffix (>= 2.0.2, < 8.0)
25
25
  base64 (0.3.0)
26
26
  benchmark (0.5.0)
27
- bigdecimal (4.0.1)
27
+ bigdecimal (4.1.1)
28
28
  concurrent-ruby (1.3.6)
29
29
  connection_pool (2.5.5)
30
30
  crack (1.0.1)
@@ -42,7 +42,7 @@ GEM
42
42
  racc (~> 1.4)
43
43
  public_suffix (6.0.2)
44
44
  racc (1.8.1)
45
- rake (13.3.1)
45
+ rake (13.4.1)
46
46
  rexml (3.4.4)
47
47
  rspec (3.13.2)
48
48
  rspec-core (~> 3.13.0)
@@ -53,10 +53,10 @@ GEM
53
53
  rspec-expectations (3.13.5)
54
54
  diff-lcs (>= 1.2.0, < 2.0)
55
55
  rspec-support (~> 3.13.0)
56
- rspec-mocks (3.13.7)
56
+ rspec-mocks (3.13.8)
57
57
  diff-lcs (>= 1.2.0, < 2.0)
58
58
  rspec-support (~> 3.13.0)
59
- rspec-support (3.13.6)
59
+ rspec-support (3.13.7)
60
60
  securerandom (0.4.1)
61
61
  simplecov (0.22.0)
62
62
  docile (~> 1.1)
@@ -66,14 +66,15 @@ GEM
66
66
  simplecov_json_formatter (0.1.4)
67
67
  tzinfo (2.0.6)
68
68
  concurrent-ruby (~> 1.0)
69
- webmock (3.26.1)
69
+ webmock (3.26.2)
70
70
  addressable (>= 2.8.0)
71
71
  crack (>= 0.3.2)
72
72
  hashdiff (>= 0.4.0, < 2.0.0)
73
- yard (0.9.38)
73
+ yard (0.9.41)
74
74
 
75
75
  PLATFORMS
76
76
  arm64-darwin-22
77
+ arm64-darwin-25
77
78
 
78
79
  DEPENDENCIES
79
80
  contentstack_utils!
@@ -81,7 +82,7 @@ DEPENDENCIES
81
82
  rspec (~> 3.13)
82
83
  simplecov (~> 0.22)
83
84
  webmock (~> 3.23)
84
- yard (~> 0.9.36)
85
+ yard (~> 0.9.38)
85
86
 
86
87
  BUNDLED WITH
87
88
  2.3.26
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.authors = [%q{Contentstack}]
10
10
  s.email = ["support@contentstack.com"]
11
11
 
12
- s.required_ruby_version = '>= 3.0'
12
+ s.required_ruby_version = '>= 3.1'
13
13
 
14
14
  s.license = "MIT"
15
15
  s.homepage = "https://github.com/contentstack/contentstack-utils-ruby"
@@ -21,12 +21,12 @@ Gem::Specification.new do |s|
21
21
  s.test_files = s.files.grep(%r{^spec/})
22
22
  s.require_paths = ["lib"]
23
23
 
24
- s.add_dependency 'activesupport', '>= 7.0'
25
- s.add_dependency 'nokogiri', '>= 1.11'
24
+ s.add_dependency 'activesupport', '>= 7.0', '< 8'
25
+ s.add_dependency 'nokogiri', '>= 1.13', '< 1.19'
26
26
 
27
27
  s.add_development_dependency 'rake', '~> 13.0'
28
28
  s.add_development_dependency 'rspec', '~> 3.13'
29
29
  s.add_development_dependency 'webmock', '~> 3.23'
30
30
  s.add_development_dependency 'simplecov', '~> 0.22'
31
- s.add_development_dependency 'yard', '~> 0.9.36'
31
+ s.add_development_dependency 'yard', '~> 0.9.38'
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module ContentstackUtils
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.4"
3
3
  end
data/skills/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Skills – Contentstack Utils Ruby
2
+
3
+ Source of truth for detailed guidance. Read [AGENTS.md](../AGENTS.md) first, then open the skill that matches your task.
4
+
5
+ ## When to use which skill
6
+
7
+ | Skill folder | Use when |
8
+ |--------------|----------|
9
+ | `code-review` | Preparing or reviewing a PR |
10
+ | `contentstack-utils` | Changing rendering behavior, JSON RTE / GQL paths, options API, or public `lib/` entry points |
11
+ | `dev-workflow` | Setting up the repo, running tests/docs, opening PRs, understanding CI and release |
12
+ | `framework` | Gemspec, Bundler, Ruby version constraints, activesupport/nokogiri dependencies, gem build/release |
13
+ | `ruby-style` | File layout, modules, or staying consistent with existing Ruby style in this repo |
14
+ | `testing` | Adding or changing specs, fixtures, mocks, or coverage |
15
+
16
+ Each folder contains `SKILL.md` with YAML frontmatter (`name`, `description`).
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: code-review
3
+ description: Use when reviewing or preparing a PR for this gem—behavior, tests, API compatibility, and release notes.
4
+ ---
5
+
6
+ # Code review – Contentstack Utils Ruby
7
+
8
+ ## When to use
9
+
10
+ - Authoring a pull request that changes rendering, models, or dependencies
11
+ - Reviewing someone else’s PR before merge
12
+ - Checking release readiness (version + changelog)
13
+
14
+ ## Instructions
15
+
16
+ ### Blockers (fix before merge)
17
+
18
+ - **Tests:** `bundle exec rake` (or `bundle exec rspec`) passes locally
19
+ - **Breaking API:** unintended removal or signature change of public methods on **`ContentstackUtils`**, **`ContentstackUtils::GQL`**, or **`ContentstackUtils::Model::Options`** without version bump and changelog entry
20
+ - **Security:** no secrets in code, fixtures, or logs; HTML output changes reviewed for injection or XSS risk when embedding untrusted fields
21
+
22
+ ### Major (should address)
23
+
24
+ - **CHANGELOG.md** updated for user-visible behavior fixes or features
25
+ - **`lib/contentstack_utils/version.rb`** updated when publishing a release (if this PR is release-bound)
26
+ - New JSON/RTE node types or GQL shapes covered by **`spec/lib/utils_spec.rb`** (or focused new spec files)
27
+ - Dependency range changes in **`contentstack_utils.gemspec`** justified and compatible with Ruby **≥ 3.1**
28
+
29
+ ### Minor (nice to have)
30
+
31
+ - **README.md** examples match actual class names (**`Options`**, not a non-existent **`Option`** unless aliased)
32
+ - YARD or comments only where they clarify non-obvious RTE or GQL mapping
33
+
34
+ ### Process
35
+
36
+ - Respect **CODEOWNERS** and branch policy (**`master`** vs **`staging`**) described in [dev-workflow](../dev-workflow/SKILL.md)
37
+
38
+ ## References
39
+
40
+ - [AGENTS.md](../../AGENTS.md)
41
+ - [Development workflow](../dev-workflow/SKILL.md)
42
+ - [Contentstack Utils SDK](../contentstack-utils/SKILL.md)
43
+ - [Framework & packaging](../framework/SKILL.md)
44
+ - [Testing](../testing/SKILL.md)
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: contentstack-utils
3
+ description: Use when changing the public Ruby API, RTE rendering (HTML string or JSON), GQL payloads, Model::Options/Metadata, or integration boundaries with the delivery client.
4
+ ---
5
+
6
+ # Contentstack Utils SDK – Contentstack Utils Ruby
7
+
8
+ ## When to use
9
+
10
+ - Implementing or fixing HTML output for rich text / JSON RTE
11
+ - Extending or subclassing rendering options (`ContentstackUtils::Model::Options`)
12
+ - Parsing GraphQL-shaped RTE (`ContentstackUtils::GQL`)
13
+ - Changing load paths or public entry points under `lib/` (gemspec and dependency ranges: see [framework](../framework/SKILL.md))
14
+
15
+ ## Instructions
16
+
17
+ ### Entry points
18
+
19
+ - **`lib/contentstack_utils.rb`** — requires version and `utils`
20
+ - **`lib/contentstack_utils/utils.rb`** — main module **`ContentstackUtils`** with class methods:
21
+ - **`render_content(content, options)`** — legacy HTML string RTE (array of strings or single string); uses Nokogiri and `_embedded_items` on the entry passed via options
22
+ - **`json_to_html(content, options)`** — JSON RTE document tree (Hash/Array) for CDA-style payloads with embedded items on the entry
23
+ - Internal helpers such as **`json_doc_to_html`** (used by GQL path)
24
+ - **`ContentstackUtils::GQL`** — **`json_to_html(content, options)`** for GraphQL responses: expects keys like `json` and optional `embedded_itemsConnection.edges`; reuses `ContentstackUtils.json_doc_to_html` with a GQL-specific reference resolver
25
+
26
+ ### Models and extension points
27
+
28
+ - **`ContentstackUtils::Model::Options`** (`lib/contentstack_utils/model/options.rb`) — default **`render_option`**, **`render_mark`**, **`render_node`**; subclass for custom HTML (see tests under `spec/mock/custom_render_option.rb`)
29
+ - **`ContentstackUtils::Model::Metadata`** — built from DOM nodes (HTML path) or JSON reference nodes
30
+ - **`ContentstackUtils::Interface::Rendarable`** (`lib/contentstack_utils/interface/renderable.rb`) — base for options; implement **`render_option`** in subclasses
31
+
32
+ ### Data contracts
33
+
34
+ - **CDA / delivery JSON path:** options may carry an **`entry`** hash with **`_embedded_items`** keyed by field UIDs
35
+ - **GQL path:** payload uses **`embedded_itemsConnection.edges`** with **`node`** objects; reference resolution matches **`metadata.item_uid`** to **`node.system.uid`**
36
+
37
+ ### Boundaries
38
+
39
+ - HTTP and stack access belong to the separate **Contentstack Ruby** client; this gem only renders given content + embedded metadata
40
+
41
+ ### Versioning
42
+
43
+ - Public API and behavior changes should be reflected in `CHANGELOG.md` and `lib/contentstack_utils/version.rb`
44
+
45
+ ## References
46
+
47
+ - Product overview: [README.md](../../README.md)
48
+ - [Framework & packaging](../framework/SKILL.md)
49
+ - [Testing](../testing/SKILL.md)
50
+ - [Ruby style and layout](../ruby-style/SKILL.md)
51
+ - [Contentstack documentation](https://www.contentstack.com/docs/)
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: dev-workflow
3
+ description: Use when setting up the dev environment, running build/test/docs, or understanding CI, branches, and gem release for this repo.
4
+ ---
5
+
6
+ # Development workflow – Contentstack Utils Ruby
7
+
8
+ ## When to use
9
+
10
+ - Cloning the repo or onboarding a new contributor
11
+ - Running tests, generating docs, or building the gem locally
12
+ - Understanding branch rules and GitHub Actions for this repository
13
+
14
+ ## Instructions
15
+
16
+ ### Prerequisites
17
+
18
+ - Ruby **≥ 3.1** (matches `s.required_ruby_version` in `contentstack_utils.gemspec`)
19
+ - Bundler; install gems with `bundle install`
20
+
21
+ ### Everyday commands
22
+
23
+ - **Run tests (default Rake task):** `bundle exec rake` or `bundle exec rake spec`
24
+ - **RSpec directly:** `bundle exec rspec` (pattern `spec/**/*_spec.rb` is configured in `Rakefile`)
25
+ - **YARD API docs:** `bundle exec rake yard` (see `.yardopts` for included paths)
26
+ - **Build gem artifact:** `gem build contentstack_utils.gemspec` (also used in `.github/workflows/release-gem.yml`)
27
+
28
+ ### Version and changelog
29
+
30
+ - Gem version lives in `lib/contentstack_utils/version.rb` as `ContentstackUtils::VERSION`
31
+ - Document user-visible changes in `CHANGELOG.md` when releasing
32
+
33
+ ### Branches and PRs
34
+
35
+ - `.github/workflows/check-branch.yml` blocks merging into **`master`** unless the head branch is **`staging`** (organizational policy). Prefer PRs that follow team conventions for `master` / `staging`.
36
+ - Use `CODEOWNERS` for required reviewers when applicable
37
+
38
+ ### CI and automation (no RSpec workflow today)
39
+
40
+ - **Release:** `.github/workflows/release-gem.yml` — on GitHub **release created**, builds and pushes to RubyGems (note: workflow pins Ruby 2.7 for publish; align with gemspec minimum when changing)
41
+ - **Security / compliance:** CodeQL, policy scan, SCA scan — see `.github/workflows/`
42
+ - **Issues:** Jira integration workflow in `.github/workflows/issues-jira.yml`
43
+
44
+ ### Optional housekeeping
45
+
46
+ - `.talismanrc` is used for secret scanning hooks in some environments; do not commit credentials or tokens
47
+
48
+ ## References
49
+
50
+ - [AGENTS.md](../../AGENTS.md)
51
+ - [Contentstack Utils SDK](../contentstack-utils/SKILL.md)
52
+ - [Framework & packaging](../framework/SKILL.md)
53
+ - [Testing](../testing/SKILL.md)
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: framework
3
+ description: Use when changing the gemspec, Bundler setup, Ruby/runtime constraints, or runtime dependencies (activesupport, nokogiri) and native extension implications.
4
+ ---
5
+
6
+ # Framework & packaging – Contentstack Utils Ruby
7
+
8
+ ## When to use
9
+
10
+ - Editing **`contentstack_utils.gemspec`** (dependencies, `required_ruby_version`, files list)
11
+ - Changing **`Gemfile`** / **`Gemfile.lock`** workflow or documenting install for contributors
12
+ - Evaluating impact of **nokogiri** (native extension) or **activesupport** version ranges on consumers
13
+
14
+ ## Instructions
15
+
16
+ ### Gem definition
17
+
18
+ - **`contentstack_utils.gemspec`** — canonical metadata: `s.files` from `git ls-files`, `spec/` as test files, `lib` as `require_paths`
19
+ - **`Gemfile`** — `gemspec` only; runtime and development dependencies are declared in the gemspec
20
+
21
+ ### Runtime dependencies (as shipped)
22
+
23
+ - **activesupport** `>= 7.0`, `< 8`
24
+ - **nokogiri** `>= 1.13`, `< 1.19` — HTML/XML parsing for legacy string RTE paths; consumers need a compatible platform build
25
+
26
+ ### Development dependencies
27
+
28
+ - **rake**, **rspec**, **webmock**, **simplecov**, **yard** — see gemspec; used for tasks in `Rakefile` and CI-style local checks
29
+
30
+ ### Ruby version
31
+
32
+ - **`s.required_ruby_version`** is **>= 3.1**; `.ruby-version` pins a team default for local dev
33
+ - **Release workflow** (`.github/workflows/release-gem.yml`) uses its own Ruby pin for `gem build` / `gem push`; keep it aligned with gemspec when updating
34
+
35
+ ### Build and publish
36
+
37
+ - Local artifact: `gem build contentstack_utils.gemspec`
38
+ - Publishing is triggered by GitHub **release** per `release-gem.yml`
39
+
40
+ ## References
41
+
42
+ - [Development workflow](../dev-workflow/SKILL.md)
43
+ - [Contentstack Utils SDK](../contentstack-utils/SKILL.md)
44
+ - [Ruby style and layout](../ruby-style/SKILL.md)
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: ruby-style
3
+ description: Use when editing Ruby in this repo—module layout, require paths, and staying consistent with existing style (not introducing a new linter config).
4
+ ---
5
+
6
+ # Ruby style and layout – Contentstack Utils Ruby
7
+
8
+ ## When to use
9
+
10
+ - Adding new `.rb` files under `lib/` or `spec/`
11
+ - Refactoring while keeping diffs readable for reviewers
12
+ - Deciding where a new helper or model class should live
13
+
14
+ ## Instructions
15
+
16
+ ### Layout
17
+
18
+ - **Library code:** `lib/contentstack_utils/` with nested folders `model/`, `interface/`, `support/`
19
+ - **Top-level require:** `lib/contentstack_utils.rb` should stay a thin loader
20
+ - **Specs:** mirror behavior under `spec/lib/` and `spec/mock/` / `spec/support/` as in existing examples
21
+
22
+ ### Conventions in this codebase
23
+
24
+ - **`ContentstackUtils`** as the root module; nested **`Model`**, **`Interface`**, **`GQL`** as already used
25
+ - **`require_relative`** for internal lib files (see `utils.rb`, `options.rb`)
26
+ - Existing files use a mix of spacing and `def self.` patterns; **prefer matching the surrounding file** over wholesale reformatting
27
+ - Typo in base class name **`Rendarable`** is historical; new code should remain compatible unless a dedicated rename is approved project-wide
28
+
29
+ ### Linting and format
30
+
31
+ - There is **no RuboCop or Standard** configuration in this repository; do not add large style-only churn unless the team adopts a formatter
32
+ - Run **`bundle exec rake spec`** before pushing substantive changes
33
+
34
+ ### Documentation
35
+
36
+ - YARD can document public APIs; keep user-facing usage examples in `README.md` accurate (e.g. class name **`Options`** vs informal “Option” in prose)
37
+
38
+ ## References
39
+
40
+ - [Contentstack Utils SDK](../contentstack-utils/SKILL.md)
41
+ - [Framework & packaging](../framework/SKILL.md)
42
+ - [Development workflow](../dev-workflow/SKILL.md)
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: testing
3
+ description: Use when writing or fixing RSpec tests, mocks, fixtures, SimpleCov filters, or WebMock usage in this repo.
4
+ ---
5
+
6
+ # Testing – Contentstack Utils Ruby
7
+
8
+ ## When to use
9
+
10
+ - Adding coverage for a new code path in `lib/`
11
+ - Debugging a failing spec in `spec/`
12
+ - Adjusting SimpleCov scope or shared test helpers
13
+
14
+ ## Instructions
15
+
16
+ ### Runner and config
17
+
18
+ - **RSpec** is the test framework; **`spec/spec_helper.rb`** loads SimpleCov, then `contentstack_utils`, mocks, and support files
19
+ - **Default task:** `bundle exec rake` runs **`spec`** with `--format documentation` (see `Rakefile`)
20
+
21
+ ### Layout
22
+
23
+ - **`spec/lib/`** — primary examples (`utils_spec.rb`, `model/option_spec.rb`, `model/metadata_spec.rb`)
24
+ - **`spec/mock/`** — constants and custom option subclasses used across examples
25
+ - **`spec/support/`** — helpers (e.g. XML/JSON fixture builders like `getGQLJSONRTE`)
26
+
27
+ ### Coverage
28
+
29
+ - **SimpleCov** starts in `spec_helper.rb` and **filters** `spec/` and `lib/contentstack_utils/support` from coverage metrics
30
+ - Aim to cover both **HTML `render_content`** paths and **JSON / GQL `json_to_html`** branches when changing `utils.rb`
31
+
32
+ ### HTTP and external I/O
33
+
34
+ - **webmock** is a development dependency; stub outbound HTTP if future tests introduce network calls (current suite is largely pure parsing/rendering)
35
+
36
+ ### Credentials
37
+
38
+ - Do not add real API keys, delivery tokens, or stack secrets to the repo; use fixture hashes and constants as in `spec/mock/` and `spec/support/constant.rb`
39
+
40
+ ## References
41
+
42
+ - [Development workflow](../dev-workflow/SKILL.md)
43
+ - [Contentstack Utils SDK](../contentstack-utils/SKILL.md)
44
+ - [RSpec](https://rspec.info/)
45
+ - [SimpleCov](https://github.com/simplecov-ruby/simplecov)
@@ -17,14 +17,22 @@ def getJson(text)
17
17
  end
18
18
 
19
19
  def getGQLJSONRTE(node, item = '""')
20
+ normalized_node = node
21
+ if node.is_a?(Hash) && node["type"] != "doc" && node[:type] != "doc"
22
+ normalized_node = { "type" => "doc", "children" => [node] }
23
+ end
24
+
25
+ node_payload = normalized_node.is_a?(String) ? normalized_node : JSON.generate(normalized_node)
26
+ item_payload = item.is_a?(String) ? item : JSON.generate(item)
27
+
20
28
  entry = "{
21
29
  \"single_rte\": {
22
- \"json\": #{node},
23
- \"embedded_itemsConnection\": #{item}
30
+ \"json\": #{node_payload},
31
+ \"embedded_itemsConnection\": #{item_payload}
24
32
  },
25
33
  \"multiple_rte\": {
26
- \"json\": [#{node}],
27
- \"embedded_itemsConnection\": #{item}
34
+ \"json\": [#{node_payload}],
35
+ \"embedded_itemsConnection\": #{item_payload}
28
36
  }
29
37
  }"
30
38
  getJson(entry)
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.2.2
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentstack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-05 00:00:00.000000000 Z
11
+ date: 2026-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '7.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,20 +27,29 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '7.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: nokogiri
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '1.11'
39
+ version: '1.13'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.19'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '1.11'
49
+ version: '1.13'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.19'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rake
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +112,14 @@ dependencies:
100
112
  requirements:
101
113
  - - "~>"
102
114
  - !ruby/object:Gem::Version
103
- version: 0.9.36
115
+ version: 0.9.38
104
116
  type: :development
105
117
  prerelease: false
106
118
  version_requirements: !ruby/object:Gem::Requirement
107
119
  requirements:
108
120
  - - "~>"
109
121
  - !ruby/object:Gem::Version
110
- version: 0.9.36
122
+ version: 0.9.38
111
123
  description: Contentstack Ruby client for the Content Delivery API
112
124
  email:
113
125
  - support@contentstack.com
@@ -115,6 +127,7 @@ executables: []
115
127
  extensions: []
116
128
  extra_rdoc_files: []
117
129
  files:
130
+ - ".cursor/rules/README.md"
118
131
  - ".github/workflows/check-branch.yml"
119
132
  - ".github/workflows/codeql-analysis.yml"
120
133
  - ".github/workflows/issues-jira.yml"
@@ -125,6 +138,7 @@ files:
125
138
  - ".ruby-version"
126
139
  - ".talismanrc"
127
140
  - ".yardopts"
141
+ - AGENTS.md
128
142
  - CHANGELOG.md
129
143
  - CODEOWNERS
130
144
  - Gemfile
@@ -141,6 +155,13 @@ files:
141
155
  - lib/contentstack_utils/support/helper.rb
142
156
  - lib/contentstack_utils/utils.rb
143
157
  - lib/contentstack_utils/version.rb
158
+ - skills/README.md
159
+ - skills/code-review/SKILL.md
160
+ - skills/contentstack-utils/SKILL.md
161
+ - skills/dev-workflow/SKILL.md
162
+ - skills/framework/SKILL.md
163
+ - skills/ruby-style/SKILL.md
164
+ - skills/testing/SKILL.md
144
165
  - spec/lib/model/metadata_spec.rb
145
166
  - spec/lib/model/option_spec.rb
146
167
  - spec/lib/utils_spec.rb
@@ -162,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
183
  requirements:
163
184
  - - ">="
164
185
  - !ruby/object:Gem::Version
165
- version: '3.0'
186
+ version: '3.1'
166
187
  required_rubygems_version: !ruby/object:Gem::Requirement
167
188
  requirements:
168
189
  - - ">="