contentstack 0.8.0 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79cfe8aeaad0941d21a637ef8f87713cbaaf4a51376bb1969b45c59565536302
4
- data.tar.gz: bd4f522c7f22bafd7d0fa4b3aedd831545cf45be8d5ba66c13a02bd7e336cfb4
3
+ metadata.gz: 3c53e5f1e0ff64e24114c733c40b0d294a0b3670e9794cf98d85f7379a995216
4
+ data.tar.gz: 961ecab5684492aacdbeee5fdb281b7b8f70026bc138077cbcba1ef64a4fdfd6
5
5
  SHA512:
6
- metadata.gz: bf719d78118b2c1d1ebf10e1cc7ae47bf9b548f158b4d4399e0f1d4813fd39636eb7f0c92e1614a102ce880ce901dd09939bcbd31dd22617b4c78501a8d0d9ab
7
- data.tar.gz: 67262e37224ce8a9d0249b497a09caeefea1ed99a3ea5bcd63833fa78551774c824946f18a6b7a56916ba328db914dc7bbb4f7f05772ce2c2da7090a264b9947
6
+ metadata.gz: 3d394f96d11ed7b3c8bd3e0377c389df1c9b26f598d6d3089a5a022a1b2d0fdedebd4f4e854d2aeba2f14933ae3c8b7bd82a13a72e6a40dee5885d18a4881091
7
+ data.tar.gz: a3b2a7d25231364a60c7489b76bd4af81c28dd5d816686e2bf942e1224aba6af5a9777e91a8ccc54f14367a1c776de7bceeb11a655ab0884467b321d9db11163
@@ -8,13 +8,13 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
10
  - name: Comment PR
11
- if: github.base_ref == 'master' && github.head_ref != 'next'
11
+ if: github.base_ref == 'master' && github.head_ref != 'staging'
12
12
  uses: thollander/actions-comment-pull-request@v2
13
13
  with:
14
14
  message: |
15
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
16
  - name: Check branch
17
- if: github.base_ref == 'master' && github.head_ref != 'next'
17
+ if: github.base_ref == 'master' && github.head_ref != 'staging'
18
18
  run: |
19
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
20
  exit 1
@@ -0,0 +1,31 @@
1
+ name: Create Jira Ticket for Github Issue
2
+
3
+ on:
4
+ issues:
5
+ types: [opened]
6
+
7
+ jobs:
8
+ issue-jira:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+
12
+ - name: Login to Jira
13
+ uses: atlassian/gajira-login@master
14
+ env:
15
+ JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
16
+ JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
17
+ JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
18
+
19
+ - name: Create Jira Issue
20
+ id: create_jira
21
+ uses: atlassian/gajira-create@master
22
+ with:
23
+ project: ${{ secrets.JIRA_PROJECT }}
24
+ issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
25
+ summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}
26
+ description: |
27
+ *GitHub Issue:* ${{ github.event.issue.html_url }}
28
+
29
+ *Description:*
30
+ ${{ github.event.issue.body }}
31
+ fields: "${{ secrets.ISSUES_JIRA_FIELDS }}"
@@ -0,0 +1,46 @@
1
+ name: Checks the security policy and configurations
2
+ on:
3
+ pull_request:
4
+ types: [opened, synchronize, reopened]
5
+ jobs:
6
+ security-policy:
7
+ if: github.event.repository.visibility == 'public'
8
+ runs-on: ubuntu-latest
9
+ defaults:
10
+ run:
11
+ shell: bash
12
+ steps:
13
+ - uses: actions/checkout@master
14
+ - name: Checks for SECURITY.md policy file
15
+ run: |
16
+ if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi
17
+ security-license:
18
+ if: github.event.repository.visibility == 'public'
19
+ runs-on: ubuntu-latest
20
+ defaults:
21
+ run:
22
+ shell: bash
23
+ steps:
24
+ - uses: actions/checkout@master
25
+ - name: Checks for License file
26
+ run: |
27
+ expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
28
+ license_file_found=false
29
+ current_year=$(date +"%Y")
30
+
31
+ for license_file in "${expected_license_files[@]}"; do
32
+ if [ -f "$license_file" ]; then
33
+ license_file_found=true
34
+ # check the license file for the current year, if not exists, exit with error
35
+ if ! grep -q "$current_year" "$license_file"; then
36
+ echo "License file $license_file does not contain the current year."
37
+ exit 2
38
+ fi
39
+ break
40
+ fi
41
+ done
42
+
43
+ if [ "$license_file_found" = false ]; then
44
+ echo "No license file found. Please add a license file to the repository."
45
+ exit 1
46
+ fi
@@ -3,7 +3,7 @@ on:
3
3
  pull_request:
4
4
  types: [opened, synchronize, reopened]
5
5
  jobs:
6
- security:
6
+ security-sca:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
9
  - uses: actions/checkout@master
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ## Version 0.8.2
4
+ ### Date: 12th-January-2026
5
+ ### Improved error messages
6
+ -
7
+
8
+ ------------------------------------------------
9
+
10
+ ## Version 0.8.1
11
+ ### Date: 05th-January-2026
12
+ ### Security Bug
13
+ - Fixed snyk security issues and updated license year
14
+
15
+ ------------------------------------------------
16
+
3
17
  ## Version 0.8.0
4
18
  ### Date: 14th-May-2024
5
19
  ### Enhancement
data/CODEOWNERS CHANGED
@@ -1 +1,11 @@
1
- * @contentstack/security-admin
1
+ * @contentstack/devex-pr-reviewers
2
+
3
+ .github/workflows/sca-scan.yml @contentstack/security-admin
4
+
5
+ .github/workflows/codeql-anaylsis.yml @contentstack/security-admin
6
+
7
+ **/.snyk @contentstack/security-admin
8
+
9
+ .github/workflows/policy-scan.yml @contentstack/security-admin
10
+
11
+ .github/workflows/issues-jira.yml @contentstack/security-admin
data/Gemfile.lock CHANGED
@@ -1,48 +1,51 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- contentstack (0.8.0)
4
+ contentstack (0.8.1)
5
5
  activesupport (>= 3.2)
6
6
  contentstack_utils (~> 1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (7.1.3.2)
11
+ activesupport (7.2.3)
12
12
  base64
13
+ benchmark (>= 0.3)
13
14
  bigdecimal
14
- concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ concurrent-ruby (~> 1.0, >= 1.3.1)
15
16
  connection_pool (>= 2.2.5)
16
17
  drb
17
18
  i18n (>= 1.6, < 2)
19
+ logger (>= 1.4.2)
18
20
  minitest (>= 5.1)
19
- mutex_m
20
- tzinfo (~> 2.0)
21
- addressable (2.8.6)
22
- public_suffix (>= 2.0.2, < 6.0)
23
- base64 (0.2.0)
24
- bigdecimal (3.1.8)
25
- concurrent-ruby (1.2.3)
26
- connection_pool (2.4.1)
27
- contentstack_utils (1.2.0)
28
- activesupport (>= 3.2)
29
- nokogiri (~> 1.11)
30
- crack (1.0.0)
21
+ securerandom (>= 0.3)
22
+ tzinfo (~> 2.0, >= 2.0.5)
23
+ addressable (2.8.8)
24
+ public_suffix (>= 2.0.2, < 8.0)
25
+ base64 (0.3.0)
26
+ benchmark (0.5.0)
27
+ bigdecimal (4.0.1)
28
+ concurrent-ruby (1.3.6)
29
+ connection_pool (2.5.5)
30
+ contentstack_utils (1.2.1)
31
+ activesupport (>= 7.0)
32
+ nokogiri (>= 1.11)
33
+ crack (1.0.1)
31
34
  bigdecimal
32
35
  rexml
33
- diff-lcs (1.5.1)
34
- docile (1.4.0)
35
- drb (2.2.1)
36
- hashdiff (1.1.0)
37
- i18n (1.14.5)
36
+ diff-lcs (1.6.2)
37
+ docile (1.4.1)
38
+ drb (2.2.3)
39
+ hashdiff (1.2.1)
40
+ i18n (1.14.8)
38
41
  concurrent-ruby (~> 1.0)
39
- minitest (5.22.3)
40
- mutex_m (0.2.0)
41
- nokogiri (1.15.6-arm64-darwin)
42
+ logger (1.7.0)
43
+ minitest (5.27.0)
44
+ nokogiri (1.18.10-arm64-darwin)
42
45
  racc (~> 1.4)
43
- public_suffix (5.0.5)
44
- racc (1.7.3)
45
- rexml (3.2.6)
46
+ public_suffix (6.0.2)
47
+ racc (1.8.1)
48
+ rexml (3.4.4)
46
49
  rspec (3.10.0)
47
50
  rspec-core (~> 3.10.0)
48
51
  rspec-expectations (~> 3.10.0)
@@ -56,22 +59,25 @@ GEM
56
59
  diff-lcs (>= 1.2.0, < 2.0)
57
60
  rspec-support (~> 3.10.0)
58
61
  rspec-support (3.10.3)
62
+ securerandom (0.4.1)
59
63
  simplecov (0.21.2)
60
64
  docile (~> 1.1)
61
65
  simplecov-html (~> 0.11)
62
66
  simplecov_json_formatter (~> 0.1)
63
- simplecov-html (0.12.3)
67
+ simplecov-html (0.13.2)
64
68
  simplecov_json_formatter (0.1.4)
65
69
  tzinfo (2.0.6)
66
70
  concurrent-ruby (~> 1.0)
71
+ uri (1.1.1)
67
72
  webmock (3.11.3)
68
73
  addressable (>= 2.3.6)
69
74
  crack (>= 0.3.2)
70
75
  hashdiff (>= 0.4.0, < 2.0.0)
71
- yard (0.9.36)
76
+ yard (0.9.38)
72
77
 
73
78
  PLATFORMS
74
79
  arm64-darwin-22
80
+ arm64-darwin-24
75
81
 
76
82
  DEPENDENCIES
77
83
  contentstack!
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2012-2024 Contentstack. All Rights Reserved
3
+ Copyright (c) 2012-2026 Contentstack. All Rights Reserved
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -187,7 +187,7 @@ You can use advanced sync queries to fetch custom results while performing initi
187
187
 
188
188
  ## **The MIT License (MIT)**
189
189
 
190
- Copyright © 2012-2021 [Contentstack](https://www.contentstack.com). All Rights Reserved
190
+ Copyright © 2012-2026 [Contentstack](https://www.contentstack.com). All Rights Reserved
191
191
 
192
192
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
193
193
 
@@ -82,7 +82,7 @@ module Contentstack
82
82
  sleep(retryDelay_in_seconds.to_i) #sleep method requires time in seconds as parameter
83
83
  response = fetch_retry(path, query, (count + 1))
84
84
  else
85
- raise Contentstack::Error.new(response) #Retry Limit exceeded
85
+ raise Contentstack::Error.new(Contentstack::ErrorMessages.request_failed(response)) #Retry Limit exceeded
86
86
  end
87
87
  else
88
88
  to_render_content(response)
@@ -125,7 +125,7 @@ module Contentstack
125
125
  error_response = JSON.parse(response.string)
126
126
  error_status = {"status_code" => response.status[0], "status_message" => response.status[1]}
127
127
  error = error_response.merge(error_status)
128
- raise Contentstack::Error.new(error.to_s)
128
+ raise Contentstack::Error.new(Contentstack::ErrorMessages.request_error(error))
129
129
  end
130
130
  end
131
131
 
@@ -165,7 +165,7 @@ module Contentstack
165
165
  error_response = JSON.parse(response.string)
166
166
  error_status = {"status_code" => response.status[0], "status_message" => response.status[1]}
167
167
  error = error_response.merge(error_status)
168
- raise Contentstack::Error.new(error.to_s)
168
+ raise Contentstack::Error.new(Contentstack::ErrorMessages.request_error(error))
169
169
  end
170
170
  end
171
171
 
@@ -10,12 +10,12 @@ module Contentstack
10
10
  attr_reader :region, :host
11
11
  # Initialize "Contentstack" Client instance
12
12
  def initialize(api_key, delivery_token, environment, options={})
13
- raise Contentstack::Error.new("Api Key is not valid") if api_key.class != String
14
- raise Contentstack::Error.new("Api Key Field Should not be Empty") if api_key.empty?
15
- raise Contentstack::Error.new("Delivery Token is not valid") if delivery_token.class != String
16
- raise Contentstack::Error.new("Delivery Token Field Should not be Empty") if delivery_token.empty?
17
- raise Contentstack::Error.new("Envirnoment Field is not valid") if environment.class != String
18
- raise Contentstack::Error.new("Envirnoment Field Should not be Empty") if environment.empty?
13
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::API_KEY_INVALID) if api_key.class != String
14
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::API_KEY_REQUIRED) if api_key.empty?
15
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::DELIVERY_TOKEN_INVALID) if delivery_token.class != String
16
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::DELIVERY_TOKEN_REQUIRED) if delivery_token.empty?
17
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::ENVIRONMENT_INVALID) if environment.class != String
18
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::ENVIRONMENT_REQUIRED) if environment.empty?
19
19
  @region = options[:region].nil? ? Contentstack::Region::US : options[:region]
20
20
  # @host = options[:host].nil? ? get_default_region_hosts(@region) : options[:host] #removed for not supporting custom host with regions
21
21
  @host = get_host_by_region(@region, options) # Added new method for custom host support with different regions
@@ -32,8 +32,8 @@ module Contentstack
32
32
  "retryLimit"=> @retryLimit,
33
33
  "errorRetry" => @errorRetry
34
34
  }
35
- raise Contentstack::Error.new("Proxy URL Should not be Empty") if @proxy_details.present? && @proxy_details[:url].empty?
36
- raise Contentstack::Error.new("Proxy Port Should not be Empty") if @proxy_details.present? && @proxy_details[:port].empty?
35
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::PROXY_URL_REQUIRED) if @proxy_details.present? && @proxy_details[:url].empty?
36
+ raise Contentstack::Error.new(Contentstack::ErrorMessages::PROXY_PORT_REQUIRED) if @proxy_details.present? && @proxy_details[:port].empty?
37
37
  API.init_api(api_key, delivery_token, environment, @host, @branch, @live_preview, @proxy_details, retry_options)
38
38
  end
39
39
 
@@ -1,4 +1,24 @@
1
1
  module Contentstack
2
+ # Centralized error messages for the SDK
3
+ module ErrorMessages
4
+ API_KEY_INVALID = "API Key is invalid. Provide a valid API Key and try again."
5
+ API_KEY_REQUIRED = "API Key is required. Provide a valid API Key and try again."
6
+ DELIVERY_TOKEN_INVALID = "Delivery Token is invalid. Provide a valid Delivery Token and try again."
7
+ DELIVERY_TOKEN_REQUIRED = "Delivery Token is required. Provide a valid Delivery Token and try again."
8
+ ENVIRONMENT_INVALID = "Environment is invalid. Provide a valid Environment and try again."
9
+ ENVIRONMENT_REQUIRED = "Environment is required. Provide a valid Environment and try again."
10
+ PROXY_URL_REQUIRED = "Proxy URL is required. Provide a valid Proxy URL and try again."
11
+ PROXY_PORT_REQUIRED = "Proxy Port is required. Provide a valid Proxy Port and try again."
12
+
13
+ def self.request_failed(response)
14
+ "The request could not be completed due to #{response}. Review the details and try again."
15
+ end
16
+
17
+ def self.request_error(error)
18
+ "The request encountered an issue due to #{error}. Review the details and try again."
19
+ end
20
+ end
21
+
2
22
  class Error < StandardError
3
23
  def initialize(msg="Something Went Wrong.")
4
24
  super
@@ -1,3 +1,3 @@
1
1
  module Contentstack
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.2"
3
3
  end
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.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentstack
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2026-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -103,7 +103,8 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".github/workflows/check-branch.yml"
105
105
  - ".github/workflows/codeql-analysis.yml"
106
- - ".github/workflows/jira.yml"
106
+ - ".github/workflows/issues-jira.yml"
107
+ - ".github/workflows/policy-scan.yml"
107
108
  - ".github/workflows/release-gem.yml"
108
109
  - ".github/workflows/sca-scan.yml"
109
110
  - ".gitignore"
@@ -156,7 +157,7 @@ homepage: https://github.com/contentstack/contentstack-ruby
156
157
  licenses:
157
158
  - MIT
158
159
  metadata: {}
159
- post_install_message:
160
+ post_install_message:
160
161
  rdoc_options: []
161
162
  require_paths:
162
163
  - lib
@@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
173
  version: '0'
173
174
  requirements: []
174
175
  rubygems_version: 3.1.6
175
- signing_key:
176
+ signing_key:
176
177
  specification_version: 4
177
178
  summary: Contentstack Ruby client for the Content Delivery API
178
179
  test_files: []
@@ -1,28 +0,0 @@
1
- name: Create JIRA ISSUE
2
- on:
3
- pull_request:
4
- types: [opened]
5
- jobs:
6
- security:
7
- if: ${{ github.actor == 'dependabot[bot]' || github.actor == 'snyk-bot' || contains(github.event.pull_request.head.ref, 'snyk-fix-') || contains(github.event.pull_request.head.ref, 'snyk-upgrade-')}}
8
- runs-on: ubuntu-latest
9
- steps:
10
- - uses: actions/checkout@v2
11
- - name: Login into JIRA
12
- uses: atlassian/gajira-login@master
13
- env:
14
- JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
15
- JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
16
- JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
17
- - name: Create a JIRA Issue
18
- id: create
19
- uses: atlassian/gajira-create@master
20
- with:
21
- project: ${{ secrets.JIRA_PROJECT }}
22
- issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
23
- summary: |
24
- ${{ github.event.pull_request.title }}
25
- description: |
26
- PR: ${{ github.event.pull_request.html_url }}
27
-
28
- fields: "${{ secrets.JIRA_FIELDS }}"