contentstack 0.5.1 → 0.6.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/codeql-analysis.yml +68 -0
- data/.github/workflows/sast-scan.yml +11 -0
- data/.github/workflows/sca-scan.yml +13 -0
- data/.github/workflows/secrets-scan.yml +11 -0
- data/Gemfile.lock +6 -6
- data/lib/contentstack/api.rb +93 -10
- data/lib/contentstack/client.rb +21 -1
- data/lib/contentstack/query.rb +11 -2
- data/lib/contentstack/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d05c5b008fe472ff0f8440f69c7226645ef13db5b6d6d75b1de0d4d2cf9dcec
|
4
|
+
data.tar.gz: 015ec71ca2e816f17f6f274e992b5273a04a5303e0eb1a67a1b6449743b8847f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 380dee7e9afb6047034eff28239631bdeb6aacb964e1665aeee80dc9116c769c477f1f0c33a36dc0c701ec987df207e3fd1e747ba7edd37fc9a87de69590323e
|
7
|
+
data.tar.gz: 9d686de63a036bb5a5c159540148d8d3c305fca02967aaf4dd9ab1d5aeb1e038199ed1575a8f57a2ab15bf14e62d3bcc999dfe07f7587084e1e507d827746b54
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: "CodeQL"
|
13
|
+
|
14
|
+
on:
|
15
|
+
pull_request:
|
16
|
+
# The branches below must be a subset of the branches above
|
17
|
+
branches: '*'
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
analyze:
|
21
|
+
name: Analyze
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
permissions:
|
24
|
+
actions: read
|
25
|
+
contents: read
|
26
|
+
security-events: write
|
27
|
+
|
28
|
+
strategy:
|
29
|
+
fail-fast: false
|
30
|
+
matrix:
|
31
|
+
language: [ 'ruby' ]
|
32
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
33
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
34
|
+
|
35
|
+
steps:
|
36
|
+
- name: Checkout repository
|
37
|
+
uses: actions/checkout@v3
|
38
|
+
|
39
|
+
# Initializes the CodeQL tools for scanning.
|
40
|
+
- name: Initialize CodeQL
|
41
|
+
uses: github/codeql-action/init@v2
|
42
|
+
with:
|
43
|
+
languages: ${{ matrix.language }}
|
44
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
45
|
+
# By default, queries listed here will override any specified in a config file.
|
46
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
47
|
+
|
48
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
49
|
+
# queries: security-extended,security-and-quality
|
50
|
+
|
51
|
+
|
52
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
53
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
54
|
+
- name: Autobuild
|
55
|
+
uses: github/codeql-action/autobuild@v2
|
56
|
+
|
57
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
58
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
59
|
+
|
60
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
61
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
62
|
+
|
63
|
+
# - run: |
|
64
|
+
# echo "Run, Build Application using script"
|
65
|
+
# ./location_of_script_within_repo/buildscript.sh
|
66
|
+
|
67
|
+
- name: Perform CodeQL Analysis
|
68
|
+
uses: github/codeql-action/analyze@v2
|
@@ -0,0 +1,11 @@
|
|
1
|
+
name: SAST Scan
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
types: [opened, synchronize, reopened]
|
5
|
+
jobs:
|
6
|
+
security:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Horusec Scan
|
11
|
+
run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/src horuszup/horusec-cli:latest horusec start -p /src -P $(pwd)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
name: Source Composition Analysis Scan
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
types: [opened, synchronize, reopened]
|
5
|
+
jobs:
|
6
|
+
security:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@master
|
10
|
+
- name: Run Snyk to check for vulnerabilities
|
11
|
+
uses: snyk/actions/node@master
|
12
|
+
env:
|
13
|
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
contentstack (0.
|
4
|
+
contentstack (0.6.0)
|
5
5
|
activesupport (>= 3.2, < 6.2)
|
6
6
|
contentstack_utils (~> 1.0, >= 1.0.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (6.1.
|
11
|
+
activesupport (6.1.6.1)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
@@ -25,10 +25,10 @@ GEM
|
|
25
25
|
diff-lcs (1.4.4)
|
26
26
|
docile (1.4.0)
|
27
27
|
hashdiff (1.0.1)
|
28
|
-
i18n (1.
|
28
|
+
i18n (1.12.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
mini_portile2 (2.8.0)
|
31
|
-
minitest (5.
|
31
|
+
minitest (5.16.2)
|
32
32
|
nokogiri (1.13.4)
|
33
33
|
mini_portile2 (~> 2.8.0)
|
34
34
|
racc (~> 1.4)
|
@@ -54,14 +54,14 @@ GEM
|
|
54
54
|
simplecov_json_formatter (~> 0.1)
|
55
55
|
simplecov-html (0.12.3)
|
56
56
|
simplecov_json_formatter (0.1.3)
|
57
|
-
tzinfo (2.0.
|
57
|
+
tzinfo (2.0.5)
|
58
58
|
concurrent-ruby (~> 1.0)
|
59
59
|
webmock (3.11.3)
|
60
60
|
addressable (>= 2.3.6)
|
61
61
|
crack (>= 0.3.2)
|
62
62
|
hashdiff (>= 0.4.0, < 2.0.0)
|
63
63
|
yard (0.9.26)
|
64
|
-
zeitwerk (2.
|
64
|
+
zeitwerk (2.6.0)
|
65
65
|
|
66
66
|
PLATFORMS
|
67
67
|
ruby
|
data/lib/contentstack/api.rb
CHANGED
@@ -7,7 +7,7 @@ require 'util'
|
|
7
7
|
module Contentstack
|
8
8
|
class API
|
9
9
|
using Utility
|
10
|
-
def self.init_api(api_key, delivery_token, environment, host, branch, live_preview)
|
10
|
+
def self.init_api(api_key, delivery_token, environment, host, branch, live_preview, proxy, retry_options)
|
11
11
|
@host = host
|
12
12
|
@api_version = '/v3'
|
13
13
|
@environment = environment
|
@@ -16,6 +16,11 @@ module Contentstack
|
|
16
16
|
@branch = branch
|
17
17
|
@headers = {environment: @environment}
|
18
18
|
@live_preview = live_preview
|
19
|
+
@proxy_details = proxy
|
20
|
+
@timeout = retry_options["timeout"]
|
21
|
+
@retryDelay = retry_options["retryDelay"]
|
22
|
+
@retryLimit = retry_options["retryLimit"]
|
23
|
+
@errorRetry = retry_options["errorRetry"]
|
19
24
|
end
|
20
25
|
|
21
26
|
def self.live_preview_query(query= {})
|
@@ -29,7 +34,7 @@ module Contentstack
|
|
29
34
|
else
|
30
35
|
path = "/content_types"
|
31
36
|
end
|
32
|
-
|
37
|
+
fetch_retry(path, {})
|
33
38
|
end
|
34
39
|
|
35
40
|
def self.fetch_entries(content_type, query)
|
@@ -38,7 +43,7 @@ module Contentstack
|
|
38
43
|
send_preview_request(path, query)
|
39
44
|
else
|
40
45
|
path = "/content_types/#{content_type}/entries"
|
41
|
-
|
46
|
+
fetch_retry(path, query)
|
42
47
|
end
|
43
48
|
end
|
44
49
|
|
@@ -48,22 +53,37 @@ module Contentstack
|
|
48
53
|
send_preview_request(path, query)
|
49
54
|
else
|
50
55
|
path = "/content_types/#{content_type}/entries/#{entry_uid}"
|
51
|
-
|
56
|
+
fetch_retry(path, query)
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
60
|
def self.get_assets(asset_uid=nil)
|
56
61
|
path = "/assets"
|
57
62
|
path += "/#{asset_uid}" if !asset_uid.nil?
|
58
|
-
|
63
|
+
fetch_retry(path)
|
59
64
|
end
|
60
65
|
|
61
66
|
def self.get_sync_items(query)
|
62
67
|
path = "/stacks/sync"
|
63
|
-
|
68
|
+
fetch_retry(path, query)
|
64
69
|
end
|
65
70
|
|
66
71
|
private
|
72
|
+
def self.fetch_retry(path, query=nil, count=0)
|
73
|
+
response = send_request(path, query)
|
74
|
+
if @errorRetry.include?(response["status_code"].to_i)
|
75
|
+
if count < @retryLimit
|
76
|
+
retryDelay_in_seconds = @retryDelay / 1000 #converting retry_delay from milliseconds into seconds
|
77
|
+
sleep(retryDelay_in_seconds.to_i) #sleep method requires time in seconds as parameter
|
78
|
+
response = fetch_retry(path, query, (count + 1))
|
79
|
+
else
|
80
|
+
raise Contentstack::Error.new(response) #Retry Limit exceeded
|
81
|
+
end
|
82
|
+
else
|
83
|
+
response
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
67
87
|
def self.send_request(path, q=nil)
|
68
88
|
q ||= {}
|
69
89
|
|
@@ -75,12 +95,44 @@ module Contentstack
|
|
75
95
|
"api_key" => @api_key,
|
76
96
|
"access_token"=> @access_token,
|
77
97
|
"user_agent"=> "ruby-sdk/#{Contentstack::VERSION}",
|
78
|
-
"x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}"
|
98
|
+
"x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}",
|
99
|
+
"read_timeout" => @timeout
|
79
100
|
}
|
80
101
|
if !@branch.nil? && !@branch.empty?
|
81
102
|
params["branch"] = @branch
|
82
103
|
end
|
83
|
-
|
104
|
+
|
105
|
+
begin
|
106
|
+
if @proxy_details.empty?
|
107
|
+
ActiveSupport::JSON.decode(URI.open("#{@host}#{@api_version}#{path}#{query}", params).read)
|
108
|
+
elsif @proxy_details.present? && @proxy_details[:url].present? && @proxy_details[:port].present? && @proxy_details[:username].present? && @proxy_details[:password].present?
|
109
|
+
proxy_uri = URI.parse("http://#{@proxy_details[:url]}:#{@proxy_details[:port]}/")
|
110
|
+
proxy_username = @proxy_details[:username]
|
111
|
+
proxy_password = @proxy_details[:password]
|
112
|
+
|
113
|
+
if !@branch.nil? && !@branch.empty?
|
114
|
+
ActiveSupport::JSON.decode(URI.open("#{@host}#{@api_version}#{path}#{query}", :proxy_http_basic_authentication => [proxy_uri, proxy_username, proxy_password], "api_key" => @api_key, "access_token"=> @access_token, "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout, "branch" => @branch).read)
|
115
|
+
else
|
116
|
+
ActiveSupport::JSON.decode(URI.open("#{@host}#{@api_version}#{path}#{query}", :proxy_http_basic_authentication => [proxy_uri, proxy_username, proxy_password], "api_key" => @api_key, "access_token"=> @access_token, "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout).read)
|
117
|
+
end
|
118
|
+
elsif @proxy_details.present? && @proxy_details[:url].present? && @proxy_details[:port].present? && @proxy_details[:username].empty? && @proxy_details[:password].empty?
|
119
|
+
proxy_uri = URI.parse("http://#{@proxy_details[:url]}:#{@proxy_details[:port]}/")
|
120
|
+
|
121
|
+
if !@branch.nil? && !@branch.empty?
|
122
|
+
ActiveSupport::JSON.decode(URI.open("#{@host}#{@api_version}#{path}#{query}", "proxy" => proxy_uri, "api_key" => @api_key, "access_token"=> @access_token, "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout, "branch" => @branch).read)
|
123
|
+
else
|
124
|
+
ActiveSupport::JSON.decode(URI.open("#{@host}#{@api_version}#{path}#{query}", "proxy" => proxy_uri, "api_key" => @api_key, "access_token"=> @access_token, "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout).read)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
rescue OpenURI::HTTPError => error
|
128
|
+
response = error.io
|
129
|
+
#response.status
|
130
|
+
# => ["503", "Service Unavailable"]
|
131
|
+
error_response = JSON.parse(response.string)
|
132
|
+
error_status = {"status_code" => response.status[0], "status_message" => response.status[1]}
|
133
|
+
error = error_response.merge(error_status)
|
134
|
+
raise Contentstack::Error.new(error.to_s)
|
135
|
+
end
|
84
136
|
end
|
85
137
|
|
86
138
|
def self.send_preview_request(path, q=nil)
|
@@ -94,12 +146,43 @@ module Contentstack
|
|
94
146
|
"api_key" => @api_key,
|
95
147
|
"authorization" => @live_preview[:management_token],
|
96
148
|
"user_agent"=> "ruby-sdk/#{Contentstack::VERSION}",
|
97
|
-
"x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}"
|
149
|
+
"x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}",
|
150
|
+
"read_timeout" => @timeout
|
98
151
|
}
|
99
152
|
if !@branch.nil? && !@branch.empty?
|
100
153
|
params["branch"] = @branch
|
101
154
|
end
|
102
|
-
|
155
|
+
begin
|
156
|
+
if @proxy_details.empty?
|
157
|
+
ActiveSupport::JSON.decode(URI.open("#{preview_host}#{@api_version}#{path}#{query}",params).read)
|
158
|
+
elsif @proxy_details.present? && @proxy_details[:url].present? && @proxy_details[:port].present? && @proxy_details[:username].present? && @proxy_details[:password].present?
|
159
|
+
proxy_uri = URI.parse("http://#{@proxy_details[:url]}:#{@proxy_details[:port]}/")
|
160
|
+
proxy_username = @proxy_details[:username]
|
161
|
+
proxy_password = @proxy_details[:password]
|
162
|
+
|
163
|
+
if !@branch.nil? && !@branch.empty?
|
164
|
+
ActiveSupport::JSON.decode(URI.open("#{preview_host}#{@api_version}#{path}#{query}", :proxy_http_basic_authentication => [proxy_uri, proxy_username, proxy_password], "api_key" => @api_key, "authorization" => @live_preview[:management_token], "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout, "branch" => @branch).read)
|
165
|
+
else
|
166
|
+
ActiveSupport::JSON.decode(URI.open("#{preview_host}#{@api_version}#{path}#{query}", :proxy_http_basic_authentication => [proxy_uri, proxy_username, proxy_password], "api_key" => @api_key, "authorization" => @live_preview[:management_token], "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout).read)
|
167
|
+
end
|
168
|
+
elsif @proxy_details.present? && @proxy_details[:url].present? && @proxy_details[:port].present? && @proxy_details[:username].empty? && @proxy_details[:password].empty?
|
169
|
+
proxy_uri = URI.parse("http://#{@proxy_details[:url]}:#{@proxy_details[:port]}/")
|
170
|
+
|
171
|
+
if !@branch.nil? && !@branch.empty?
|
172
|
+
ActiveSupport::JSON.decode(URI.open("#{preview_host}#{@api_version}#{path}#{query}", "proxy" => proxy_uri, "api_key" => @api_key, "authorization" => @live_preview[:management_token], "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout, "branch" => @branch).read)
|
173
|
+
else
|
174
|
+
ActiveSupport::JSON.decode(URI.open("#{preview_host}#{@api_version}#{path}#{query}", "proxy" => proxy_uri, "api_key" => @api_key, "authorization" => @live_preview[:management_token], "user_agent"=> "ruby-sdk/#{Contentstack::VERSION}", "x-user-agent" => "ruby-sdk/#{Contentstack::VERSION}", "read_timeout" => @timeout).read)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
rescue OpenURI::HTTPError => error
|
178
|
+
response = error.io
|
179
|
+
#response.status
|
180
|
+
# => ["503", "Service Unavailable"]
|
181
|
+
error_response = JSON.parse(response.string)
|
182
|
+
error_status = {"status_code" => response.status[0], "status_message" => response.status[1]}
|
183
|
+
error = error_response.merge(error_status)
|
184
|
+
raise Contentstack::Error.new(error.to_s)
|
185
|
+
end
|
103
186
|
end
|
104
187
|
end
|
105
188
|
end
|
data/lib/contentstack/client.rb
CHANGED
@@ -3,17 +3,37 @@ require 'contentstack/content_type'
|
|
3
3
|
require 'contentstack/asset_collection'
|
4
4
|
require 'contentstack/sync_result'
|
5
5
|
require 'util'
|
6
|
+
require 'contentstack/error'
|
6
7
|
module Contentstack
|
7
8
|
class Client
|
8
9
|
using Utility
|
9
10
|
attr_reader :region, :host
|
10
11
|
# Initialize "Contentstack" Client instance
|
11
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?
|
12
19
|
@region = options[:region].nil? ? Contentstack::Region::US : options[:region]
|
13
20
|
@host = options[:host].nil? ? get_default_region_hosts(@region) : options[:host]
|
14
21
|
@live_preview = !options.key?(:live_preview) ? {} : options[:live_preview]
|
15
22
|
@branch = options[:branch].nil? ? "" : options[:branch]
|
16
|
-
|
23
|
+
@proxy_details = options[:proxy].nil? ? "" : options[:proxy]
|
24
|
+
@timeout = options[:timeout].nil? ? 3000 : options[:timeout]
|
25
|
+
@retryDelay = options[:retryDelay].nil? ? 3000 : options[:retryDelay]
|
26
|
+
@retryLimit = options[:retryLimit].nil? ? 5 : options[:retryLimit]
|
27
|
+
@errorRetry = options[:errorRetry].nil? ? [408, 429] : options[:errorRetry]
|
28
|
+
retry_options = {
|
29
|
+
"timeout" => @timeout.to_s,
|
30
|
+
"retryDelay"=> @retryDelay,
|
31
|
+
"retryLimit"=> @retryLimit,
|
32
|
+
"errorRetry" => @errorRetry
|
33
|
+
}
|
34
|
+
raise Contentstack::Error.new("Proxy URL Should not be Empty") if @proxy_details.present? && @proxy_details[:url].empty?
|
35
|
+
raise Contentstack::Error.new("Proxy Port Should not be Empty") if @proxy_details.present? && @proxy_details[:port].empty?
|
36
|
+
API.init_api(api_key, delivery_token, environment, @host, @branch, @live_preview, @proxy_details, retry_options)
|
17
37
|
end
|
18
38
|
|
19
39
|
def content_types
|
data/lib/contentstack/query.rb
CHANGED
@@ -249,10 +249,14 @@ module Contentstack
|
|
249
249
|
# @param [String] field_uid UID of the field for which query should be executed
|
250
250
|
# @param [String] values The possible values for the key's object
|
251
251
|
#
|
252
|
-
# Example
|
252
|
+
# Example 1 - Array Equals Operator Within Group
|
253
253
|
# @query = @stack.content_type('category').query
|
254
254
|
# @query.contained_in("title", ["Electronics", "Apparel"])
|
255
255
|
#
|
256
|
+
# Example 2 - Array Equals Operator Within Modular Blocks
|
257
|
+
# @query = @stack.content_type('category').query
|
258
|
+
# @query.contained_in("additional_info.deals.deal_name", ["Christmas Deal", "Summer Deal"])
|
259
|
+
#
|
256
260
|
# @return [Contentstack::Query]
|
257
261
|
def contained_in(field_uid, values)
|
258
262
|
add_query_hash({:"#{field_uid}" => {"$in" => values}})
|
@@ -264,10 +268,14 @@ module Contentstack
|
|
264
268
|
# @param [String] field_uid UID of the field for which query should be executed
|
265
269
|
# @param [String] values The possible values for the key's object
|
266
270
|
#
|
267
|
-
# Example
|
271
|
+
# Example 1 - Array Not-equals Operator Within Group
|
268
272
|
# @query = @stack.content_type('category').query
|
269
273
|
# @query.not_contained_in("title", ["Electronics", "Apparel"])
|
270
274
|
#
|
275
|
+
# Example 2 - Array Not-equals Operator Within Modular Blocks
|
276
|
+
# @query = @stack.content_type('category').query
|
277
|
+
# @query.not_contained_in("additional_info.deals.deal_name", ["Christmas Deal", "Summer Deal"])
|
278
|
+
#
|
271
279
|
# @return [Contentstack::Query]
|
272
280
|
def not_contained_in(field_uid, values)
|
273
281
|
add_query_hash({:"#{field_uid}" => {"$nin" => values}})
|
@@ -377,6 +385,7 @@ module Contentstack
|
|
377
385
|
# @param [String] code The locale code of the entry
|
378
386
|
#
|
379
387
|
# Example
|
388
|
+
# Change language method
|
380
389
|
# @query = @stack.content_type('category').query
|
381
390
|
# @query.locale('en-us')
|
382
391
|
#
|
data/lib/contentstack/version.rb
CHANGED
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentstack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -113,6 +113,10 @@ executables: []
|
|
113
113
|
extensions: []
|
114
114
|
extra_rdoc_files: []
|
115
115
|
files:
|
116
|
+
- ".github/workflows/codeql-analysis.yml"
|
117
|
+
- ".github/workflows/sast-scan.yml"
|
118
|
+
- ".github/workflows/sca-scan.yml"
|
119
|
+
- ".github/workflows/secrets-scan.yml"
|
116
120
|
- ".gitignore"
|
117
121
|
- ".talismanrc"
|
118
122
|
- ".yardopts"
|
@@ -178,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
182
|
- !ruby/object:Gem::Version
|
179
183
|
version: '0'
|
180
184
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.1.6
|
182
186
|
signing_key:
|
183
187
|
specification_version: 4
|
184
188
|
summary: Contentstack Ruby client for the Content Delivery API
|