contentstack 0.6.0 → 0.6.1
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/Gemfile.lock +6 -6
- data/lib/contentstack/api.rb +27 -3
- data/lib/contentstack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d052813dd2aa06d66dbda39f4c26d0a963721339e7ea33c35af69fa16bfba1
|
4
|
+
data.tar.gz: bd7612b96005d0382166828a3c386033d60ff27867cb5b9c66424758672a6116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd282b3954a34b18df200adea469dba22ba4ec56705a5682857efc45f7057979be6c5e7312d9b68a3e5e5a6e33057127eb6787a5e9bf04d7fc96ab008a0febac
|
7
|
+
data.tar.gz: fe7742a7f855b3d34cb510cefc839f07d6e4d8f2acc097701e757c0337842f530c292d13d20f814dae5becc63917b907beaa50102603b91d1262c17b8f8c5f6c
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
contentstack (0.
|
4
|
+
contentstack (0.5.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.5)
|
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.10.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
mini_portile2 (2.8.0)
|
31
|
-
minitest (5.
|
31
|
+
minitest (5.15.0)
|
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.4)
|
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.5.4)
|
65
65
|
|
66
66
|
PLATFORMS
|
67
67
|
ruby
|
data/lib/contentstack/api.rb
CHANGED
@@ -24,8 +24,13 @@ module Contentstack
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.live_preview_query(query= {})
|
27
|
-
@live_preview[:content_type_uid] = query[:content_type_uid]
|
28
|
-
@live_preview[:live_preview] = query[:live_preview]
|
27
|
+
@live_preview[:content_type_uid] = query[:content_type_uid] || query["content_type_uid"]
|
28
|
+
@live_preview[:live_preview] = query[:live_preview] || query["live_preview"]
|
29
|
+
@live_preview[:entry_uid] = query[:entry_uid] || query["entry_uid"]
|
30
|
+
if @live_preview[:content_type_uid].present? && @live_preview[:entry_uid].present?
|
31
|
+
path = "/content_types/#{@live_preview[:content_type_uid]}/entries/#{@live_preview[:entry_uid]}"
|
32
|
+
@live_preview_response = send_preview_request(path)
|
33
|
+
end
|
29
34
|
end
|
30
35
|
|
31
36
|
def self.fetch_content_types(uid="")
|
@@ -80,7 +85,7 @@ module Contentstack
|
|
80
85
|
raise Contentstack::Error.new(response) #Retry Limit exceeded
|
81
86
|
end
|
82
87
|
else
|
83
|
-
response
|
88
|
+
to_render_content(response)
|
84
89
|
end
|
85
90
|
end
|
86
91
|
|
@@ -184,5 +189,24 @@ module Contentstack
|
|
184
189
|
raise Contentstack::Error.new(error.to_s)
|
185
190
|
end
|
186
191
|
end
|
192
|
+
|
193
|
+
def self.to_render_content(resp)
|
194
|
+
if resp.class == Hash
|
195
|
+
if resp.key?('uid') && resp['uid'] == @live_preview[:entry_uid]
|
196
|
+
resp = resp.merge(@live_preview_response)
|
197
|
+
else
|
198
|
+
resp_keys = resp.keys
|
199
|
+
resp_keys.each {|key|
|
200
|
+
resp[key] = to_render_content(resp[key])
|
201
|
+
}
|
202
|
+
end
|
203
|
+
elsif resp.class == Array
|
204
|
+
resp.each_with_index {|value, index|
|
205
|
+
resp[index] = to_render_content(value)
|
206
|
+
}
|
207
|
+
end
|
208
|
+
resp
|
209
|
+
end
|
210
|
+
|
187
211
|
end
|
188
212
|
end
|
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.6.
|
4
|
+
version: 0.6.1
|
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-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|