Skip to content

Commit b4fa914

Browse files
authored
Merge pull request #15 from contentstack/embedded_items
Embedded items feature support added
2 parents 1b613fa + 341f31c commit b4fa914

File tree

8 files changed

+93
-52
lines changed

8 files changed

+93
-52
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ coverage
88
.DS_Store
99
.bundle/
1010
*/rspec_results.html
11-
vendor/
11+
vendor/

Gemfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
# Gemfile
22
source "https://rubygems.org"
3-
4-
gem "rspec"
5-
gem "webmock"
6-
gem "simplecov"
7-
gem "activesupport"
8-
gem "yard"
3+
gemspec

Gemfile.lock

Lines changed: 54 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,75 @@
1+
PATH
2+
remote: .
3+
specs:
4+
contentstack (0.2.0)
5+
activesupport (> 3.2.5)
6+
contentstack_utils (~> 1.0.0)
7+
18
GEM
29
remote: https://rubygems.org/
310
specs:
4-
activesupport (6.0.3.1)
11+
activesupport (6.1.3.1)
512
concurrent-ruby (~> 1.0, >= 1.0.2)
6-
i18n (>= 0.7, < 2)
7-
minitest (~> 5.1)
8-
tzinfo (~> 1.1)
9-
zeitwerk (~> 2.2, >= 2.2.2)
13+
i18n (>= 1.6, < 2)
14+
minitest (>= 5.1)
15+
tzinfo (~> 2.0)
16+
zeitwerk (~> 2.3)
1017
addressable (2.7.0)
1118
public_suffix (>= 2.0.2, < 5.0)
12-
concurrent-ruby (1.1.6)
13-
crack (0.4.3)
14-
safe_yaml (~> 1.0.0)
15-
diff-lcs (1.3)
16-
docile (1.3.2)
19+
concurrent-ruby (1.1.8)
20+
contentstack_utils (1.0.0)
21+
activesupport (~> 6.1.0)
22+
nokogiri (~> 1.11.0)
23+
crack (0.4.5)
24+
rexml
25+
diff-lcs (1.4.4)
26+
docile (1.3.5)
1727
hashdiff (1.0.1)
18-
i18n (1.8.2)
28+
i18n (1.8.10)
1929
concurrent-ruby (~> 1.0)
20-
minitest (5.14.1)
21-
public_suffix (4.0.4)
22-
rspec (3.9.0)
23-
rspec-core (~> 3.9.0)
24-
rspec-expectations (~> 3.9.0)
25-
rspec-mocks (~> 3.9.0)
26-
rspec-core (3.9.1)
27-
rspec-support (~> 3.9.1)
28-
rspec-expectations (3.9.1)
30+
minitest (5.14.4)
31+
nokogiri (1.11.2-arm64-darwin)
32+
racc (~> 1.4)
33+
public_suffix (4.0.6)
34+
racc (1.5.2)
35+
rexml (3.2.5)
36+
rspec (3.10.0)
37+
rspec-core (~> 3.10.0)
38+
rspec-expectations (~> 3.10.0)
39+
rspec-mocks (~> 3.10.0)
40+
rspec-core (3.10.1)
41+
rspec-support (~> 3.10.0)
42+
rspec-expectations (3.10.1)
2943
diff-lcs (>= 1.2.0, < 2.0)
30-
rspec-support (~> 3.9.0)
31-
rspec-mocks (3.9.1)
44+
rspec-support (~> 3.10.0)
45+
rspec-mocks (3.10.2)
3246
diff-lcs (>= 1.2.0, < 2.0)
33-
rspec-support (~> 3.9.0)
34-
rspec-support (3.9.2)
35-
safe_yaml (1.0.5)
36-
simplecov (0.18.5)
47+
rspec-support (~> 3.10.0)
48+
rspec-support (3.10.2)
49+
simplecov (0.21.2)
3750
docile (~> 1.1)
3851
simplecov-html (~> 0.11)
39-
simplecov-html (0.12.2)
40-
thread_safe (0.3.6)
41-
tzinfo (1.2.7)
42-
thread_safe (~> 0.1)
43-
webmock (3.8.3)
52+
simplecov_json_formatter (~> 0.1)
53+
simplecov-html (0.12.3)
54+
simplecov_json_formatter (0.1.2)
55+
tzinfo (2.0.4)
56+
concurrent-ruby (~> 1.0)
57+
webmock (3.11.3)
4458
addressable (>= 2.3.6)
4559
crack (>= 0.3.2)
4660
hashdiff (>= 0.4.0, < 2.0.0)
47-
yard (0.9.25)
48-
zeitwerk (2.3.0)
61+
yard (0.9.26)
62+
zeitwerk (2.4.2)
4963

5064
PLATFORMS
51-
ruby
65+
universal-darwin-19
5266

5367
DEPENDENCIES
54-
activesupport
55-
rspec
56-
simplecov
57-
webmock
58-
yard
68+
contentstack!
69+
rspec (~> 3.10.0)
70+
simplecov (~> 0.21.1)
71+
webmock (~> 3.11.0)
72+
yard (~> 0.9.26)
5973

6074
BUNDLED WITH
61-
2.1.4
75+
2.2.7

contentstack.gemspec

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ Gem::Specification.new do |s|
2121
s.require_paths = ["lib"]
2222

2323
s.add_dependency 'activesupport', "> 3.2.5"
24-
25-
s.add_development_dependency 'rspec'
26-
s.add_development_dependency 'webmock'
27-
s.add_development_dependency 'simplecov'
24+
s.add_dependency "contentstack_utils", "~> 1.0.0"
25+
26+
s.add_development_dependency 'rspec', '~> 3.10.0'
27+
s.add_development_dependency 'webmock', '~> 3.11.0'
28+
s.add_development_dependency 'simplecov', '~> 0.21.1'
29+
s.add_development_dependency 'yard', '~> 0.9.26'
2830
end

lib/contentstack.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require "contentstack/version"
44
require "contentstack/client"
55
require "contentstack/region"
6+
require "contentstack_utils"
67
require "util"
78

89

@@ -22,4 +23,7 @@
2223
# ==== Query entries
2324
# @stack.content_type('blog').query.regex('title', '.*hello.*').fetch
2425
module Contentstack
26+
def self.render_content(content, options)
27+
ContentstackUtils.render_content(content, options)
28+
end
2529
end

lib/contentstack/entry.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,19 @@ def include_fallback(flag=true)
152152
self
153153
end
154154

155+
# Include Embedded Objects (Entries and Assets) along with entry/entries details.
156+
#
157+
# Example
158+
#
159+
# @entry = @stack.content_type('product').entry(entry_uid)
160+
# @entry.include_embedded_items
161+
#
162+
# @return [Contentstack::Query]
163+
def include_embedded_items()
164+
@query[:include_embedded_items] = ['BASE']
165+
self
166+
end
167+
155168
#
156169
# @return [Contentstack::Query]
157170
def include(field_uids)

lib/contentstack/query.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,19 @@ def include_fallback(flag=true)
516516
self
517517
end
518518

519+
# Include Embedded Objects (Entries and Assets) along with entry/entries details.
520+
#
521+
# Example
522+
#
523+
# @query = @stack.content_type('product').query
524+
# @query.include_embedded_items
525+
#
526+
# @return [Contentstack::Query]
527+
def include_embedded_items()
528+
@query[:include_embedded_items] = ['BASE']
529+
self
530+
end
531+
519532
# Include objects in 'Draft' mode in response
520533
#
521534
# Example

lib/contentstack/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Contentstack
2-
VERSION = "0.3.0"
2+
VERSION = "0.5.0"
33
end

0 commit comments

Comments
 (0)