contentstack 0.8.3 → 0.8.5

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: 88426b0abac8a7569724d6e382a2c2d602fded747c52f6e9464fa69517fc52b8
4
- data.tar.gz: 36f5e31ca7ecfb36746c58c04c3ed570eee40472bae9ab441d92e1eab57f395a
3
+ metadata.gz: c608b1247b89cb28b9519fbf9e0814879aab951953ca8a82902df4dcf4a38b7b
4
+ data.tar.gz: 0cf04ec05622ffbbb963fb94794da5a80eec6d66fda8609747d2d11312e4808f
5
5
  SHA512:
6
- metadata.gz: 444aa9aa0fa377b1ecd7f0387b8c3a9d739e22fa8d94c3021aa10c32caefa7900660b716c4fe55cceff18c1d472ed27d0fb8ed49b9a9ee609b4b2219433c63ae
7
- data.tar.gz: 603f45c2edea5b7106449beb2873ff5916ebc343c470926682cfdf85eb1fa4ddbfd1befd5e0bb49c11cf458535b0359f319b27630e9dd47c58ba5b3815105380
6
+ metadata.gz: e423a49545eae6ce37d39857877a6fcbf2ba65cbba41a6fb3cd9ec7520d7a3d64cae7ba5d660b0b2726bd53050ea566559d392145bf00413a1c2d7055b345969
7
+ data.tar.gz: e27142598452a529289a8d63e51387ad8f0d89295540fa146651bb623f5bda88962088a9d53cde1fd958f4c8674062bac95fdf5783fac7046a374ac8b445371e
@@ -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.
@@ -0,0 +1,54 @@
1
+ name: Back-merge master to development
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ open-back-merge-pr:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - name: Open back-merge PR if needed
23
+ env:
24
+ GH_TOKEN: ${{ github.token }}
25
+ run: |
26
+ set -euo pipefail
27
+ BASE_BRANCH="development"
28
+ SOURCE_BRANCH="master"
29
+
30
+ git fetch origin "$BASE_BRANCH" "$SOURCE_BRANCH"
31
+
32
+ if ! git show-ref --verify --quiet "refs/remotes/origin/$BASE_BRANCH"; then
33
+ echo "Base branch '$BASE_BRANCH' does not exist on origin; skipping."
34
+ exit 0
35
+ fi
36
+
37
+ SOURCE_SHA=$(git rev-parse "origin/$SOURCE_BRANCH")
38
+ BASE_SHA=$(git rev-parse "origin/$BASE_BRANCH")
39
+
40
+ if [ "$SOURCE_SHA" = "$BASE_SHA" ]; then
41
+ echo "$SOURCE_BRANCH and $BASE_BRANCH are at the same commit; nothing to back-merge."
42
+ exit 0
43
+ fi
44
+
45
+ EXISTING=$(gh pr list --repo "${{ github.repository }}" --base "$BASE_BRANCH" --head "$SOURCE_BRANCH" --state open --json number --jq 'length')
46
+
47
+ if [ "$EXISTING" -gt 0 ]; then
48
+ echo "An open PR from $SOURCE_BRANCH to $BASE_BRANCH already exists; skipping."
49
+ exit 0
50
+ fi
51
+
52
+ gh pr create --repo "${{ github.repository }}" --base "$BASE_BRANCH" --head "$SOURCE_BRANCH" --title "chore: back-merge $SOURCE_BRANCH into $BASE_BRANCH" --body "Automated back-merge after changes landed on \\`$SOURCE_BRANCH\\`. Review and merge to keep \\`$BASE_BRANCH\\` in sync."
53
+
54
+ echo "Created back-merge PR $SOURCE_BRANCH -> $BASE_BRANCH."
@@ -0,0 +1,79 @@
1
+ name: Check Version Bump
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ jobs:
7
+ version-bump:
8
+ name: Version & Changelog bump
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout
12
+ uses: actions/checkout@v4
13
+ with:
14
+ fetch-depth: 0
15
+
16
+ - name: Detect changed files and version bump
17
+ id: detect
18
+ run: |
19
+ if git rev-parse HEAD^2 >/dev/null 2>&1; then
20
+ FILES=$(git diff --name-only HEAD^1 HEAD^2)
21
+ else
22
+ FILES=$(git diff --name-only HEAD~1 HEAD)
23
+ fi
24
+ VERSION_FILES_CHANGED=false
25
+ echo "$FILES" | grep -qx 'lib/contentstack/version.rb' && VERSION_FILES_CHANGED=true
26
+ echo "$FILES" | grep -qx 'CHANGELOG.md' && VERSION_FILES_CHANGED=true
27
+ echo "version_files_changed=$VERSION_FILES_CHANGED" >> $GITHUB_OUTPUT
28
+ # Only lib/ counts as release-affecting; .github/ and spec/ do not
29
+ CODE_CHANGED=false
30
+ echo "$FILES" | grep -qE '^lib/' && CODE_CHANGED=true
31
+ echo "code_changed=$CODE_CHANGED" >> $GITHUB_OUTPUT
32
+
33
+ - name: Skip when only test/docs/.github changed
34
+ if: steps.detect.outputs.code_changed != 'true'
35
+ run: |
36
+ echo "No release-affecting files changed (e.g. only spec/docs/.github). Skipping version-bump check."
37
+ exit 0
38
+
39
+ - name: Fail when version bump was missed
40
+ if: steps.detect.outputs.code_changed == 'true' && steps.detect.outputs.version_files_changed != 'true'
41
+ run: |
42
+ echo "::error::This PR has code changes but no version bump. Please bump the version in lib/contentstack/version.rb and add an entry in CHANGELOG.md."
43
+ exit 1
44
+
45
+ - name: Check version bump
46
+ if: steps.detect.outputs.code_changed == 'true' && steps.detect.outputs.version_files_changed == 'true'
47
+ run: |
48
+ set -e
49
+ GEM_VERSION=$(sed -n 's/.*VERSION = "\(.*\)".*/\1/p' lib/contentstack/version.rb)
50
+ if [ -z "$GEM_VERSION" ]; then
51
+ echo "::error::Could not read version from lib/contentstack/version.rb"
52
+ exit 1
53
+ fi
54
+ git fetch --tags --force 2>/dev/null || true
55
+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || true)
56
+ if [ -z "$LATEST_TAG" ]; then
57
+ echo "No existing tags found. Skipping version-bump check (first release)."
58
+ exit 0
59
+ fi
60
+ LATEST_VERSION="${LATEST_TAG#v}"
61
+ LATEST_VERSION="${LATEST_VERSION%%-*}"
62
+ if [ "$(printf '%s\n' "$LATEST_VERSION" "$GEM_VERSION" | sort -V | tail -1)" != "$GEM_VERSION" ]; then
63
+ echo "::error::Version bump required: lib/contentstack/version.rb ($GEM_VERSION) is not greater than latest tag ($LATEST_TAG). Please bump Contentstack::VERSION."
64
+ exit 1
65
+ fi
66
+ if [ "$GEM_VERSION" = "$LATEST_VERSION" ]; then
67
+ echo "::error::Version bump required: lib/contentstack/version.rb ($GEM_VERSION) equals latest tag ($LATEST_TAG). Please bump Contentstack::VERSION."
68
+ exit 1
69
+ fi
70
+ CHANGELOG_VERSION=$(sed -nE 's/^## Version ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' CHANGELOG.md | head -1)
71
+ if [ -z "$CHANGELOG_VERSION" ]; then
72
+ echo "::error::Could not find a version entry in CHANGELOG.md (expected line like '## Version 1.0.0')."
73
+ exit 1
74
+ fi
75
+ if [ "$CHANGELOG_VERSION" != "$GEM_VERSION" ]; then
76
+ echo "::error::CHANGELOG version mismatch: CHANGELOG.md top version ($CHANGELOG_VERSION) does not match lib/contentstack/version.rb ($GEM_VERSION). Please add or update the CHANGELOG entry for $GEM_VERSION."
77
+ exit 1
78
+ fi
79
+ echo "Version bump check passed: lib/contentstack/version.rb and CHANGELOG.md are at $GEM_VERSION (latest tag: $LATEST_TAG)."
data/.gitignore CHANGED
@@ -4,6 +4,7 @@ test
4
4
  doc
5
5
  spec-integration
6
6
  coverage
7
+ spec/.env.test
7
8
  \.yardoc
8
9
  .DS_Store
9
10
  .bundle/
data/AGENTS.md ADDED
@@ -0,0 +1,51 @@
1
+ # Contentstack Ruby SDK – 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-ruby](https://github.com/contentstack/contentstack-ruby) (Ruby gem `contentstack`) |
10
+ | **Purpose:** | Ruby client for the Contentstack Content Delivery API (CDA): stack client, content types, entries, assets, queries, sync, and live preview. |
11
+ | **Out of scope (if any):** | Management / write APIs and app-specific business logic live outside this gem. Rich-text rendering delegates to the `contentstack_utils` gem. |
12
+
13
+ ## Tech stack (at a glance)
14
+
15
+ | Area | Details |
16
+ | --- | --- |
17
+ | Language | Ruby **≥ 3.3** (see `contentstack.gemspec` and `.ruby-version`; team uses **3.3.x** locally). |
18
+ | Build | **Bundler** + **`contentstack.gemspec`**; `Gemfile` pulls the gemspec. |
19
+ | Tests | **RSpec 3** under `spec/**/*_spec.rb`; **`spec/spec_helper.rb`** loads WebMock and SimpleCov. |
20
+ | Lint / coverage | **SimpleCov** (via `spec_helper.rb`); HTML under `coverage/`. No RuboCop in this repo. **YARD** for API docs (see `rakefile.rb`, `.yardopts`). |
21
+ | Runtime deps | `activesupport`, `contentstack_utils` (~> 1.2); `Gemfile` pins **nokogiri** for security alignment. |
22
+
23
+ ## Commands (quick reference)
24
+
25
+ | Command type | Command |
26
+ | --- | --- |
27
+ | Install deps | `bundle install` |
28
+ | Build gem | `gem build contentstack.gemspec` |
29
+ | Test | `bundle exec rspec` |
30
+ | Single file | `bundle exec rspec spec/path/to_spec.rb` |
31
+ | Lint / format | No RuboCop or formatter in-repo; match existing `lib/` and `spec/` style. |
32
+ | Docs (YARD) | `bundle exec rake yard` |
33
+
34
+ **CI / automation:** `.github/workflows/check-branch.yml` (PR branch rules toward `master`), `.github/workflows/release-gem.yml` (publish on release), plus `codeql-analysis.yml`, `sca-scan.yml`, `policy-scan.yml`, `issues-jira.yml`. There is no dedicated “run RSpec on every PR” workflow in-repo—run tests locally before opening a PR.
35
+
36
+ ## Where the documentation lives: skills
37
+
38
+ | Skill | Path | What it covers |
39
+ | --- | --- | --- |
40
+ | Dev workflow | `skills/dev-workflow/SKILL.md` | Branches, bundler, commands, release notes alignment. |
41
+ | Ruby SDK (CDA) | `skills/contentstack-ruby-sdk/SKILL.md` | Public API, modules, errors, versioning, integration with `contentstack_utils`. |
42
+ | Ruby style & layout | `skills/ruby-style/SKILL.md` | File layout, idioms, and conventions for this codebase. |
43
+ | Testing | `skills/testing/SKILL.md` | RSpec, WebMock, fixtures, env vars, coverage. |
44
+ | Code review | `skills/code-review/SKILL.md` | PR checklist and review expectations. |
45
+ | Framework & packaging | `skills/framework/SKILL.md` | Bundler/gem packaging, HTTP stack (`Net::HTTP`), retries, optional proxy. |
46
+
47
+ An index with “when to use” hints is in `skills/README.md`.
48
+
49
+ ## Using Cursor (optional)
50
+
51
+ If you use **Cursor**, `.cursor/rules/README.md` only points to **`AGENTS.md`**—same docs as everyone else.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ## Version 0.8.5
4
+ ### Date: 5th-June-2026
5
+ ### Deprecated
6
+ - `Query#include_draft` is deprecated. The Content Delivery API returns published content only; the `include_draft` query parameter has no effect. Use Live Preview with the Preview Service to preview unpublished entries, or the Content Management API to work with draft content.
7
+
8
+ ## Version 0.8.4
9
+ ### Date: 15th-April-2026
10
+ ### Security and Compatibility
11
+ - Fixed reported security vulnerability.
12
+
3
13
  ## Version 0.8.3
4
14
  ### Date: 27th-March-2026
5
15
  ### Security and Compatibility
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- contentstack (0.8.3)
4
+ contentstack (0.8.5)
5
5
  activesupport (>= 3.2)
6
6
  contentstack_utils (~> 1.2)
7
7
 
@@ -21,15 +21,15 @@ GEM
21
21
  securerandom (>= 0.3)
22
22
  tzinfo (~> 2.0, >= 2.0.5)
23
23
  uri (>= 0.13.1)
24
- addressable (2.8.9)
24
+ addressable (2.9.0)
25
25
  public_suffix (>= 2.0.2, < 8.0)
26
26
  base64 (0.3.0)
27
- bigdecimal (4.0.1)
27
+ bigdecimal (4.1.2)
28
28
  concurrent-ruby (1.3.6)
29
29
  connection_pool (3.0.2)
30
- contentstack_utils (1.2.2)
31
- activesupport (>= 7.0)
32
- nokogiri (>= 1.11)
30
+ contentstack_utils (1.2.3)
31
+ activesupport (>= 8.0)
32
+ nokogiri (>= 1.19)
33
33
  crack (1.0.1)
34
34
  bigdecimal
35
35
  rexml
@@ -39,12 +39,26 @@ GEM
39
39
  hashdiff (1.2.1)
40
40
  i18n (1.14.8)
41
41
  concurrent-ruby (~> 1.0)
42
- json (2.19.3)
42
+ json (2.19.7)
43
43
  logger (1.7.0)
44
- minitest (6.0.2)
44
+ minitest (6.0.6)
45
45
  drb (~> 2.0)
46
46
  prism (~> 1.5)
47
- nokogiri (1.19.2-arm64-darwin)
47
+ nokogiri (1.19.3-aarch64-linux-gnu)
48
+ racc (~> 1.4)
49
+ nokogiri (1.19.3-aarch64-linux-musl)
50
+ racc (~> 1.4)
51
+ nokogiri (1.19.3-arm-linux-gnu)
52
+ racc (~> 1.4)
53
+ nokogiri (1.19.3-arm-linux-musl)
54
+ racc (~> 1.4)
55
+ nokogiri (1.19.3-arm64-darwin)
56
+ racc (~> 1.4)
57
+ nokogiri (1.19.3-x86_64-darwin)
58
+ racc (~> 1.4)
59
+ nokogiri (1.19.3-x86_64-linux-gnu)
60
+ racc (~> 1.4)
61
+ nokogiri (1.19.3-x86_64-linux-musl)
48
62
  racc (~> 1.4)
49
63
  prism (1.9.0)
50
64
  public_suffix (7.0.5)
@@ -77,12 +91,17 @@ GEM
77
91
  addressable (>= 2.8.0)
78
92
  crack (>= 0.3.2)
79
93
  hashdiff (>= 0.4.0, < 2.0.0)
80
- yard (0.9.38)
94
+ yard (0.9.44)
81
95
 
82
96
  PLATFORMS
83
- arm64-darwin-22
84
- arm64-darwin-24
85
- arm64-darwin-25
97
+ aarch64-linux-gnu
98
+ aarch64-linux-musl
99
+ arm-linux-gnu
100
+ arm-linux-musl
101
+ arm64-darwin
102
+ x86_64-darwin
103
+ x86_64-linux-gnu
104
+ x86_64-linux-musl
86
105
 
87
106
  DEPENDENCIES
88
107
  contentstack!
@@ -92,5 +111,49 @@ DEPENDENCIES
92
111
  webmock (~> 3.26.0)
93
112
  yard (~> 0.9.38)
94
113
 
114
+ CHECKSUMS
115
+ activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e
116
+ addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
117
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
118
+ bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
119
+ concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
120
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
121
+ contentstack (0.8.5)
122
+ contentstack_utils (1.2.3) sha256=cf2f5f996eb487559fd2d7d48a99262710f53dec62c84c6e325b9a598cd31ba7
123
+ crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e
124
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
125
+ docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
126
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
127
+ hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1
128
+ i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
129
+ json (2.19.7) sha256=fe432c8639f6efff69f9d73b518a3705d9581ab93156f981ea72806e1e5bcc3e
130
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
131
+ minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
132
+ nokogiri (1.19.3-aarch64-linux-gnu) sha256=46b89e5d7b9e844c2ee360794240c6ea2a4e6fa0c5892a4ed487db621224b639
133
+ nokogiri (1.19.3-aarch64-linux-musl) sha256=8392dfdcd21be7a94dbbe9ccc138dea01b97b24cb2dc02a114ca98bfb1d9a0b7
134
+ nokogiri (1.19.3-arm-linux-gnu) sha256=3919d5ffc334ad778a4a9eb88fda7dcb8b1fb58c8a52ac640c6dcd2f038e774f
135
+ nokogiri (1.19.3-arm-linux-musl) sha256=9ce1cb6346bb9c67b1550eb537aa183ead91e4b6eadb2f36ade02d8dd2a79fb6
136
+ nokogiri (1.19.3-arm64-darwin) sha256=71b9bd424b1b7abc18b05052a1a3cfd3627abdca62be280854cc411791357e42
137
+ nokogiri (1.19.3-x86_64-darwin) sha256=77f3fba57d46c53ab31e62fc6c28f705109d1bf6264356c76f132b2be5728d4d
138
+ nokogiri (1.19.3-x86_64-linux-gnu) sha256=2f5078620fe12e83669b5b17311b32532a8153d02eee7ad06948b926d6080976
139
+ nokogiri (1.19.3-x86_64-linux-musl) sha256=248c906d2166eca5efb56d52fdee5f9a1f51d69a72e2b64fdac647b4ce39ea3f
140
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
141
+ public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
142
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
143
+ rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
144
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
145
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
146
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
147
+ rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
148
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
149
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
150
+ simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
151
+ simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
152
+ simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
153
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
154
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
155
+ webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90
156
+ yard (0.9.44) sha256=eb087e9b631ccd887b049f303d489963945452d5e2a7eb49a5a74a7cf6887f28
157
+
95
158
  BUNDLED WITH
96
- 2.3.13
159
+ 4.0.11
@@ -565,16 +565,19 @@ module Contentstack
565
565
  self
566
566
  end
567
567
 
568
- # Include objects in 'Draft' mode in response
569
- #
570
- # Example
571
- #
572
- # @query = @stack.content_type('product').query
573
- # @query.include_draft
574
- #
575
- # @return [Contentstack::Query]
576
- def include_draft(flag=true)
577
- @query[:include_draft] = flag
568
+ # @deprecated since 0.8.5 The Content Delivery API returns published content only.
569
+ # Unpublished or draft entries are not available through CDA queries. Use Live Preview
570
+ # with the Preview Service, or the Content Management API, to access unpublished content.
571
+ #
572
+ # @return [Contentstack::Query]
573
+ def include_draft(_flag=true)
574
+ warn(
575
+ "Contentstack: Query#include_draft is deprecated and has no effect on the Content " \
576
+ "Delivery API, which returns published content only. To preview unpublished entries, " \
577
+ "use Live Preview with the Preview Service. To manage or fetch draft entries, use " \
578
+ "the Content Management API.",
579
+ uplevel: 1
580
+ )
578
581
  self
579
582
  end
580
583
 
@@ -1,3 +1,3 @@
1
1
  module Contentstack
2
- VERSION = "0.8.3"
2
+ VERSION = "0.8.5"
3
3
  end
data/skills/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Skills – Contentstack Ruby SDK
2
+
3
+ Source of truth for detailed guidance. Read **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
+ | `dev-workflow` | Setting up the repo, running build/test/docs, branching, or preparing a release-oriented change. |
10
+ | `contentstack-ruby-sdk` | Changing or extending the public CDA client API, errors, or how the gem integrates with Contentstack and `contentstack_utils`. |
11
+ | `ruby-style` | Naming, file layout, Ruby idioms, and keeping changes consistent with existing `lib/` and `spec/` code. |
12
+ | `testing` | Adding or changing specs, fixtures, WebMock stubs, SimpleCov, or test-only helpers. |
13
+ | `code-review` | Reviewing or authoring a PR; scope, docs, and risk checklist. |
14
+ | `framework` | Dependencies, gemspec, HTTP/retry/proxy behavior, or gem build/install mechanics. |
15
+
16
+ Each folder contains **SKILL.md** with YAML frontmatter (`name`, `description`).
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: code-review
3
+ description: Use when authoring or reviewing a pull request for contentstack-ruby—scope, tests, API stability, and documentation.
4
+ ---
5
+
6
+ # Code review – Contentstack Ruby SDK
7
+
8
+ ## When to use
9
+
10
+ - Opening a PR against **`development`** (or the team’s active integration branch)
11
+ - Reviewing a colleague’s change for risk, API impact, or test gaps
12
+ - Deciding whether a change needs **CHANGELOG** / version bump / **README** updates
13
+
14
+ ## Instructions
15
+
16
+ ### Blocker (must fix before merge)
17
+
18
+ - **Tests:** New or changed behavior lacks **`spec`** coverage where feasible, or **`bundle exec rspec`** would fail.
19
+ - **Security / secrets:** No real API keys, tokens, or stack data committed; tests use fixtures and WebMock.
20
+ - **Breaking changes:** Public method signatures or documented behavior changed without version strategy and **CHANGELOG** / **README** updates as appropriate.
21
+
22
+ ### Major (strongly prefer fixing)
23
+
24
+ - **WebMock:** New HTTP paths or hosts not stubbed in **`spec/spec_helper.rb`**, causing flaky or network-dependent specs.
25
+ - **Error handling:** New failure modes do not use **`Contentstack::Error`** / **`ErrorMessages`** consistently with the rest of the client.
26
+ - **Dependencies:** **`contentstack.gemspec`** or **`Gemfile`** changes without a clear reason (security pins are documented in comments—preserve that intent).
27
+
28
+ ### Minor (nice to have)
29
+
30
+ - YARD or **README** examples for new public options
31
+ - Clear commit messages and PR description linking to internal tickets if applicable
32
+
33
+ ### Process notes
34
+
35
+ - Follow direct release flow **`development` -> `master`** (no `staging` handoff in the release path).
36
+ - Run **`bundle exec rspec`** locally; CI may not run the full suite on every PR in this repository.
37
+
38
+ ## References
39
+
40
+ - `skills/dev-workflow/SKILL.md` — branches and commands
41
+ - `skills/testing/SKILL.md` — fixtures and stubs
42
+ - `skills/contentstack-ruby-sdk/SKILL.md` — API surface
43
+ - [Reference PR pattern (Cursor rules + skills)](https://github.com/contentstack/contentstack-utils-swift/pull/36)
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: dev-workflow
3
+ description: Use when setting up the repo, running tests or docs, choosing branches, or aligning with release and CI expectations for contentstack-ruby.
4
+ ---
5
+
6
+ # Dev workflow – Contentstack Ruby SDK
7
+
8
+ ## When to use
9
+
10
+ - First-time setup or refreshing dependencies
11
+ - Running the test suite or generating YARD docs before a PR
12
+ - Choosing a base branch or understanding merge restrictions
13
+ - Bumping version or coordinating with gem release (see also `skills/framework/SKILL.md`)
14
+
15
+ ## Instructions
16
+
17
+ ### Environment
18
+
19
+ - Use Ruby **≥ 3.3**; match **`.ruby-version`** when using rbenv/asdf/chruby.
20
+ - From the repo root: `bundle install` (respects `Gemfile` + `contentstack.gemspec`).
21
+
22
+ ### Everyday commands
23
+
24
+ - Full test suite: `bundle exec rspec`
25
+ - One file: `bundle exec rspec spec/<name>_spec.rb`
26
+ - API docs: `bundle exec rake yard` (task defined in `rakefile.rb`; options in `.yardopts`)
27
+ - Build the gem locally: `gem build contentstack.gemspec`
28
+
29
+ ### Branches and PRs
30
+
31
+ - Default integration branch is typically **`development`** (confirm on GitHub). Release PRs go directly **`development` -> `master`**; `staging` is not part of the release promotion flow.
32
+ - Keep PRs focused; mention breaking API or Ruby version requirement changes in the description.
33
+
34
+ ### Before you push
35
+
36
+ - Run **`bundle exec rspec`**; ensure new behavior has specs and existing stubs in `spec/spec_helper.rb` stay consistent with CDN host patterns you use.
37
+
38
+ ## References
39
+
40
+ - `AGENTS.md` — stack summary and command table
41
+ - `skills/testing/SKILL.md` — RSpec and fixtures
42
+ - `skills/framework/SKILL.md` — gemspec, Bundler, HTTP concerns
43
+ - [contentstack/contentstack-ruby](https://github.com/contentstack/contentstack-ruby)
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: framework
3
+ description: Use when changing Bundler setup, gemspec, gem build/release, or HTTP/retry/proxy behavior in the CDA client.
4
+ ---
5
+
6
+ # Framework & packaging – Contentstack Ruby SDK
7
+
8
+ ## When to use
9
+
10
+ - Editing **`Gemfile`**, **`contentstack.gemspec`**, or **`Gemfile.lock`** (via `bundle install`)
11
+ - Changing **`Contentstack::API`** request sending, timeouts, retries, or proxy support
12
+ - Preparing **`gem build`** / release alignment with **`.github/workflows/release-gem.yml`**
13
+
14
+ ## Instructions
15
+
16
+ ### Bundler and gemspec
17
+
18
+ - **`contentstack.gemspec`**: declares **`required_ruby_version >= 3.3`**, runtime deps **`activesupport`**, **`contentstack_utils`** (~> 1.2), and dev deps **rspec**, **webmock**, **simplecov**, **yard**.
19
+ - **`Gemfile`**: `gemspec` plus **nokogiri** pin for transitive security alignment (see comment in file)—do not remove without verifying **`contentstack_utils`** / **nokogiri** constraints.
20
+
21
+ ### HTTP stack
22
+
23
+ - CDA calls are implemented in **`lib/contentstack/api.rb`** using **`Net::HTTP`**, **`URI`**, **ActiveSupport JSON**, with retry logic in **`fetch_retry`** and configurable **`timeout`**, **`retryDelay`**, **`retryLimit`**, **`errorRetry`** from **`Contentstack::Client`** options.
24
+ - **Live preview** and **proxy** paths are configured on the client and passed into **`API.init_api`**—keep option keys backward compatible.
25
+
26
+ ### Release automation
27
+
28
+ - **`.github/workflows/release-gem.yml`** runs on **GitHub release created**; it uses **`ruby/setup-ruby`** (workflow currently pins Ruby **2.7** for publish—aligning that pin with **`required_ruby_version`** is an org/infrastructure concern; do not change release secrets from the skill docs).
29
+
30
+ ### Local validation
31
+
32
+ - **`gem build contentstack.gemspec`** should succeed after dependency and require-path changes.
33
+ - After changing **`lib/`** load order or new files, run **`bundle exec rspec`** and smoke-require in **`irb -r contentstack`** if needed.
34
+
35
+ ## References
36
+
37
+ - `skills/contentstack-ruby-sdk/SKILL.md` — client options and public API
38
+ - `skills/dev-workflow/SKILL.md` — everyday commands
39
+ - `skills/testing/SKILL.md` — stubbing HTTP for tests
40
+ - [RubyGems guides](https://guides.rubygems.org/)
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: ruby-style
3
+ description: Use when editing Ruby in lib/ or spec/ and you need layout, naming, and idioms consistent with this gem.
4
+ ---
5
+
6
+ # Ruby style & layout – Contentstack Ruby SDK
7
+
8
+ ## When to use
9
+
10
+ - Adding new files under **`lib/contentstack/`** or **`spec/`**
11
+ - Refactoring while keeping style aligned with existing code
12
+ - Choosing where to place helpers (e.g. `lib/util.rb` vs. domain classes)
13
+
14
+ ## Instructions
15
+
16
+ ### Layout
17
+
18
+ - **`lib/contentstack.rb`**: top-level module, YARD overview, delegates to **`contentstack_utils`** for render helpers.
19
+ - **`lib/contentstack/*.rb`**: one main concept per file (`client`, `api`, `query`, etc.).
20
+ - **`lib/util.rb`**: refinements / utilities consumed via `using Utility` where already established—follow existing patterns before introducing new global monkey patches.
21
+ - **`spec/*_spec.rb`**: mirror behavior under test; shared setup belongs in **`spec/spec_helper.rb`** only when it is truly global (WebMock, SimpleCov, default stubs).
22
+
23
+ ### Conventions observed in this repo
24
+
25
+ - Prefer explicit validation in **`Contentstack::Client#initialize`** with **`Contentstack::Error`** for invalid configuration.
26
+ - Use **`ActiveSupport`** patterns (e.g. `present?`) where already used in **`Contentstack::API`** and client code—stay consistent within a file.
27
+ - Keep public method names stable; breaking renames require a major version strategy and **README** / **CHANGELOG** updates.
28
+
29
+ ### Naming
30
+
31
+ - Match existing spellings in public APIs (e.g. `retryDelay`, `retryLimit`) for backward compatibility even if Ruby style guides suggest snake_case for new APIs—when adding **new** options, prefer **snake_case** unless extending an existing options hash that is documented with camelCase keys.
32
+
33
+ ## References
34
+
35
+ - `skills/contentstack-ruby-sdk/SKILL.md` — public API boundaries
36
+ - `skills/testing/SKILL.md` — spec patterns
37
+ - `CHANGELOG.md` — record user-visible behavior changes
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: testing
3
+ description: Use when writing or fixing RSpec examples, WebMock stubs, JSON fixtures, SimpleCov, or env-based test helpers.
4
+ ---
5
+
6
+ # Testing – Contentstack Ruby SDK
7
+
8
+ ## When to use
9
+
10
+ - Adding specs under **`spec/`**
11
+ - Changing CDN hosts, paths, or headers used in **`Contentstack::API`**
12
+ - Updating global **`WebMock`** stubs in **`spec/spec_helper.rb`**
13
+ - Interpreting **SimpleCov** output under **`coverage/`**
14
+
15
+ ## Instructions
16
+
17
+ ### Runner and config
18
+
19
+ - Run **`bundle exec rspec`** from the repo root.
20
+ - **`spec/spec_helper.rb`** requires **WebMock/RSpec**, disables real network (`WebMock.disable_net_connect!(allow_localhost: true)`), starts **SimpleCov**, and requires **`contentstack`**.
21
+
22
+ ### Stubbing HTTP
23
+
24
+ - Default stubs live in **`config.before(:each)`** in **`spec/spec_helper.rb`** for hosts such as **`cdn.contentstack.io`**, **`eu-cdn.contentstack.com`**, **`custom-cdn.contentstack.com`**, and **`preview.contentstack.io`**.
25
+ - When adding endpoints or hosts, add matching **`stub_request`** entries and JSON fixtures under **`spec/fixtures/`** (reuse shape of real CDA responses where possible).
26
+
27
+ ### Fixtures
28
+
29
+ - Store static JSON under **`spec/fixtures/*.json`**; load with **`File.read`** relative to **`__dir__`** or **`File.dirname(__FILE__)`** as existing specs do.
30
+
31
+ ### Helpers
32
+
33
+ - **`create_client`** and **`create_preview_client`** in **`spec_helper`** build clients using **`ENV['API_KEY']`**, **`ENV['DELIVERY_TOKEN']`**, **`ENV['ENVIRONMENT']`**. Copy **`spec/.env.test.example`** to **`spec/.env.test`** (gitignored) for local runs without exporting env vars; CLI/env values already set take precedence. Tests use WebMock stubs and do not require live API calls.
34
+
35
+ ### Coverage
36
+
37
+ - **SimpleCov** runs on every **`rspec`** invocation; review **`coverage/index.html`** after substantive **`lib/`** changes.
38
+
39
+ ## References
40
+
41
+ - `skills/contentstack-ruby-sdk/SKILL.md` — which classes own behavior under test
42
+ - `skills/dev-workflow/SKILL.md` — commands
43
+ - [RSpec](https://rspec.info/), [WebMock](https://github.com/bblimke/webmock)
@@ -0,0 +1,10 @@
1
+ # Copy to spec/.env.test and fill in your stack credentials.
2
+ # spec/.env.test is gitignored — do not commit real tokens.
3
+ #
4
+ # bundle exec rspec
5
+
6
+ API_KEY=your_stack_api_key
7
+ DELIVERY_TOKEN=your_delivery_token
8
+ ENVIRONMENT=development
9
+ # Optional: only needed for custom CDN host tests
10
+ # HOST=cdn.contentstack.io
data/spec/query_spec.rb CHANGED
@@ -165,8 +165,13 @@ describe Contentstack::Query do
165
165
  expect(data.first.fields[:locale]).not_to be nil
166
166
  end
167
167
 
168
- it "should get data using `include_draft` method" do
169
- data = category_query.include_draft.fetch
168
+ it "warns when `include_draft` is called and does not send include_draft to the API" do
169
+ query = category_query
170
+ expect {
171
+ query.include_draft
172
+ }.to output(/Query#include_draft is deprecated/).to_stderr
173
+ expect(query.query).not_to have_key(:include_draft)
174
+ data = query.fetch
170
175
  expect(data.length).to eq 5
171
176
  end
172
177
 
data/spec/spec_helper.rb CHANGED
@@ -16,6 +16,8 @@
16
16
  require 'webmock/rspec'
17
17
  WebMock.disable_net_connect!(allow_localhost: true)
18
18
 
19
+ require_relative 'support/load_test_env'
20
+
19
21
  require 'simplecov'
20
22
  SimpleCov.start
21
23
 
@@ -0,0 +1,23 @@
1
+ # Loads optional local test credentials from spec/.env.test (gitignored).
2
+ # Existing ENV values are not overwritten, so CLI exports still take precedence.
3
+ module ContentstackTestEnv
4
+ ENV_FILE = File.expand_path("../.env.test", __dir__).freeze
5
+
6
+ def self.load!
7
+ return unless File.file?(ENV_FILE)
8
+
9
+ File.foreach(ENV_FILE) do |line|
10
+ line = line.strip
11
+ next if line.empty? || line.start_with?("#")
12
+
13
+ key, value = line.split("=", 2)
14
+ next if key.nil? || value.nil?
15
+
16
+ key = key.strip
17
+ value = value.strip.delete_prefix('"').delete_suffix('"')
18
+ ENV[key] = value unless ENV.key?(key) && !ENV[key].to_s.empty?
19
+ end
20
+ end
21
+ end
22
+
23
+ ContentstackTestEnv.load!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentstack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-06 00:00:00.000000000 Z
11
+ date: 2026-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -101,7 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".github/workflows/check-branch.yml"
104
+ - ".cursor/rules/README.md"
105
+ - ".github/workflows/back-merge-pr.yml"
106
+ - ".github/workflows/check-version-bump.yml"
105
107
  - ".github/workflows/codeql-analysis.yml"
106
108
  - ".github/workflows/issues-jira.yml"
107
109
  - ".github/workflows/policy-scan.yml"
@@ -110,6 +112,7 @@ files:
110
112
  - ".gitignore"
111
113
  - ".talismanrc"
112
114
  - ".yardopts"
115
+ - AGENTS.md
113
116
  - CHANGELOG.md
114
117
  - CODEOWNERS
115
118
  - CODE_OF_CONDUCT.md
@@ -134,6 +137,13 @@ files:
134
137
  - lib/contentstack/version.rb
135
138
  - lib/util.rb
136
139
  - rakefile.rb
140
+ - skills/README.md
141
+ - skills/code-review/SKILL.md
142
+ - skills/dev-workflow/SKILL.md
143
+ - skills/framework/SKILL.md
144
+ - skills/ruby-style/SKILL.md
145
+ - skills/testing/SKILL.md
146
+ - spec/.env.test.example
137
147
  - spec/asset_collection_spec.rb
138
148
  - spec/asset_spec.rb
139
149
  - spec/content_type_spec.rb
@@ -152,6 +162,7 @@ files:
152
162
  - spec/fixtures/sync_init.json
153
163
  - spec/query_spec.rb
154
164
  - spec/spec_helper.rb
165
+ - spec/support/load_test_env.rb
155
166
  - spec/sync_spec.rb
156
167
  homepage: https://github.com/contentstack/contentstack-ruby
157
168
  licenses:
@@ -1,20 +0,0 @@
1
- name: 'Check Branch'
2
-
3
- on:
4
- pull_request:
5
-
6
- jobs:
7
- check_branch:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - name: Comment PR
11
- if: github.base_ref == 'master' && github.head_ref != 'staging'
12
- uses: thollander/actions-comment-pull-request@v2
13
- with:
14
- message: |
15
- We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
16
- - name: Check branch
17
- if: github.base_ref == 'master' && github.head_ref != 'staging'
18
- run: |
19
- echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
20
- exit 1