contentstack 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/CODE_OF_CONDUCT.md +1 -2
- data/Gemfile +2 -1
- data/Gemfile.lock +5 -3
- data/README.md +32 -9
- data/lib/contentstack/api.rb +2 -2
- data/lib/contentstack/content_type.rb +1 -1
- data/lib/contentstack/entry.rb +167 -2
- data/lib/contentstack/query.rb +14 -0
- data/lib/contentstack/version.rb +1 -1
- data/spec/content_type_spec.rb +5 -0
- data/spec/entry_spec.rb +69 -3
- data/spec/fixtures/category_content_type.json +1 -0
- data/spec/fixtures/category_entry.json +1 -1
- data/spec/fixtures/product_entry.json +1 -1
- data/spec/query_spec.rb +5 -0
- data/spec/spec_helper.rb +5 -1
- metadata +7 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8db58fb5abb9e50621e9dee01807c0a610c77fd1f96e41a8afcbd9f0f3d50b56
|
4
|
+
data.tar.gz: c6b2bcfed51c03ee8d669f91b30a6bafb8b223675a7cc58463e91360f3b8c6af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76f239f753e82d643744e9a450ceb91ccf67507c6245320d21f284bcbe5aa18b9a0972f8a12b0f8e032ceeb7fcd3ac6caa73576d59cb584bafb25e1d76381f57
|
7
|
+
data.tar.gz: 443dfc52fc3a77252880ce1052660a4ddc1ce145bf264ae17a161f84c0235e1e7688bcd7d7518b50760f8e2a47ecd691fc1499ec6f3d25884fa7422c072a2101
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
## CHANGELOG
|
2
|
+
------------------------------------------------
|
3
|
+
|
4
|
+
## Version 0.2.0
|
5
|
+
|
6
|
+
### New Features
|
7
|
+
- Entry
|
8
|
+
- locale - function for passing locale is added
|
9
|
+
- only - function for getting only specified field
|
10
|
+
- except - function for getting field except specified field
|
11
|
+
- include_reference - function for including reference in entry
|
12
|
+
- include_schema - function for including schema along with entry added
|
13
|
+
- include_content_type - function for including content type details along with entry added
|
14
|
+
- include_owner - function for getting owner of entry
|
15
|
+
- include_fallback - function for getting published fallback locale content, if specified locale content is not published
|
16
|
+
|
17
|
+
- Query
|
18
|
+
- include_fallback - function for getting published fallback locale content, if specified locale content is not published
|
19
|
+
|
20
|
+
|
21
|
+
------------------------------------------------
|
22
|
+
|
23
|
+
## Version 0.1.0
|
24
|
+
|
25
|
+
### Bug
|
26
|
+
- Stack Tokens Moved to Headers
|
27
|
+
|
28
|
+
------------------------------------------------
|
29
|
+
|
30
|
+
## Version 0.0.4
|
31
|
+
|
32
|
+
### Enhancement
|
33
|
+
- Region support added
|
34
|
+
|
35
|
+
------------------------------------------------
|
36
|
+
|
37
|
+
## Version 0.0.3
|
38
|
+
|
39
|
+
### Enhancement
|
40
|
+
- Query - function for passing locale is added.
|
41
|
+
|
42
|
+
------------------------------------------------
|
43
|
+
|
44
|
+
## Version 0.0.1
|
45
|
+
|
46
|
+
- Initial release
|
47
|
+
|
48
|
+
------------------------------------------------
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -22,8 +22,7 @@ include:
|
|
22
22
|
|
23
23
|
Examples of unacceptable behavior by participants include:
|
24
24
|
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
27
26
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
27
|
* Public or private harassment
|
29
28
|
* Publishing others' private information, such as a physical or electronic
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (6.0.
|
4
|
+
activesupport (6.0.3.1)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 0.7, < 2)
|
7
7
|
minitest (~> 5.1)
|
8
8
|
tzinfo (~> 1.1)
|
9
|
-
zeitwerk (~> 2.2)
|
9
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
10
10
|
addressable (2.7.0)
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
12
12
|
concurrent-ruby (1.1.6)
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
hashdiff (1.0.1)
|
18
18
|
i18n (1.8.2)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
|
-
minitest (5.14.
|
20
|
+
minitest (5.14.1)
|
21
21
|
public_suffix (4.0.4)
|
22
22
|
rspec (3.9.0)
|
23
23
|
rspec-core (~> 3.9.0)
|
@@ -44,6 +44,7 @@ GEM
|
|
44
44
|
addressable (>= 2.3.6)
|
45
45
|
crack (>= 0.3.2)
|
46
46
|
hashdiff (>= 0.4.0, < 2.0.0)
|
47
|
+
yard (0.9.25)
|
47
48
|
zeitwerk (2.3.0)
|
48
49
|
|
49
50
|
PLATFORMS
|
@@ -54,6 +55,7 @@ DEPENDENCIES
|
|
54
55
|
rspec
|
55
56
|
simplecov
|
56
57
|
webmock
|
58
|
+
yard
|
57
59
|
|
58
60
|
BUNDLED WITH
|
59
61
|
2.1.4
|
data/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# **Ruby SDK for Contentstack**
|
3
2
|
|
4
3
|
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest. [Read More](https://www.contentstack.com/).
|
@@ -22,16 +21,13 @@ Or you can run this command in your terminal (you might need administrator privi
|
|
22
21
|
To start using the SDK in your application, you will need to initialize the stack by providing the values for the keys given in the code snippet below.
|
23
22
|
|
24
23
|
# with default region
|
25
|
-
client = Contentstack::Client.new("
|
24
|
+
client = Contentstack::Client.new("api_key", "delivery_token", "enviroment_name")
|
26
25
|
|
27
26
|
# with specific region
|
28
|
-
client = Contentstack::Client.new("
|
27
|
+
client = Contentstack::Client.new("api_key", "delivery_token", "enviroment_name",{"region": Contentstack::Region::EU})
|
29
28
|
|
30
29
|
# with custom host
|
31
|
-
client = Contentstack::Client.new("
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
client = Contentstack::Client.new("api_key", "delivery_token", "enviroment_name",{"host": "https://custom-cdn.contentstack.com"})
|
35
31
|
|
36
32
|
## **Key Concepts for using Contentstack**
|
37
33
|
|
@@ -57,11 +53,11 @@ A publishing environment corresponds to one or more deployment servers or a cont
|
|
57
53
|
|
58
54
|
## **Contentstack Ruby SDK: 5-minute Quickstart**
|
59
55
|
|
60
|
-
### **Initializing your SDK
|
56
|
+
### **Initializing your SDK**
|
61
57
|
|
62
58
|
To initialize the SDK, you need to provide values for the keys given in the snippet below:
|
63
59
|
|
64
|
-
stack = Contentstack::Client.new("
|
60
|
+
stack = Contentstack::Client.new("api_key", "delivery_token", "enviroment_name")
|
65
61
|
|
66
62
|
To get the API credentials mentioned above, log in to your Contentstack account and then in your top panel navigation, go to Settings > Stack to view the API Key and Access Token.
|
67
63
|
|
@@ -75,12 +71,39 @@ To fetch a specific entry from a content type, use the following query:
|
|
75
71
|
|
76
72
|
entry = stack.content_type(<<CONTENT_TYPE_UID>>).entry(<<ENTRY_UID>>);
|
77
73
|
|
74
|
+
### Get Multiple Entries
|
75
|
+
To retrieve multiple entries of a content type, specify the content type UID. You can also specify search parameters to filter results:
|
76
|
+
|
77
|
+
@query = @stack.content_type('blog').query
|
78
|
+
@entries = @query.where('title', 'welcome')
|
79
|
+
.include_schema
|
80
|
+
.include_count
|
81
|
+
.fetch
|
82
|
+
puts "Total Entries -- #{@entries.count}"
|
83
|
+
@entries.each{|entry| puts "#{entry.get('title')}" }
|
84
|
+
To retrieve localized versions of entries, you can use the query attribute:
|
85
|
+
|
86
|
+
entry = @stack.content_type('content_type_uid').query.locale('locale_code').fetch()
|
87
|
+
|
88
|
+
> Note: Currently, the above query works in case of retrieving localized versions of multiple entries only.
|
89
|
+
|
78
90
|
## **Advanced Queries**
|
79
91
|
|
80
92
|
You can query for content types, entries, assets and more using our Ruby API Reference.
|
81
93
|
|
82
94
|
[Ruby API Reference Doc](http://www.rubydoc.info/gems/contentstack)
|
83
95
|
|
96
|
+
### Paginating Responses
|
97
|
+
In a single instance, the [Get Multiple Entries](https://www.contentstack.com/docs/developers/ruby/get-started-with-ruby-sdk/#get-multiple-entries) query will retrieve only the first 100 items of the specified content type. You can paginate and retrieve the rest of the items in batches using the [skip](https://www.rubydoc.info/gems/contentstack/Contentstack/Query#skip-instance_method) and [limit](https://www.rubydoc.info/gems/contentstack/Contentstack/Query#limit-instance_method) parameters in subsequent requests.
|
98
|
+
|
99
|
+
@stack = Contentstack::Client.new("api_key", "delivery_token", "environment")
|
100
|
+
@entries = @stack.content_type('category').query
|
101
|
+
.limit(20)
|
102
|
+
.skip(50)
|
103
|
+
.fetch
|
104
|
+
|
105
|
+
> Note: Currently, the Ruby SDK does not support multiple content types referencing in a single query. For more information on how to query entries and assets, refer the Queries section of our Content Delivery API documentation.
|
106
|
+
|
84
107
|
## **Working with Images**
|
85
108
|
|
86
109
|
We have introduced Image Delivery APIs that let you retrieve images and then manipulate and optimize them for your digital properties. It lets you perform a host of other actions such as crop, trim, resize, rotate, overlay, and so on.
|
data/lib/contentstack/api.rb
CHANGED
@@ -29,9 +29,9 @@ module Contentstack
|
|
29
29
|
send_request(path, query)
|
30
30
|
end
|
31
31
|
|
32
|
-
def self.fetch_entry(content_type, entry_uid)
|
32
|
+
def self.fetch_entry(content_type, entry_uid, query)
|
33
33
|
path = "/content_types/#{content_type}/entries/#{entry_uid}"
|
34
|
-
send_request(path)
|
34
|
+
send_request(path, query)
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.get_assets(asset_uid=nil)
|
data/lib/contentstack/entry.rb
CHANGED
@@ -2,14 +2,178 @@ require 'active_support/core_ext'
|
|
2
2
|
|
3
3
|
module Contentstack
|
4
4
|
class Entry
|
5
|
-
attr_reader :fields, :content_type, :uid, :owner
|
5
|
+
attr_reader :fields, :content_type, :uid, :owner, :query, :schema, :content_type
|
6
6
|
def initialize(attrs, content_type_uid=nil)
|
7
7
|
setup(attrs, content_type_uid)
|
8
8
|
end
|
9
9
|
|
10
|
+
# Get entries from the specified locale.
|
11
|
+
#
|
12
|
+
# @param [String] code The locale code of the entry
|
13
|
+
#
|
14
|
+
# Example
|
15
|
+
# @entry = @stack.content_type('category').entry(entry_uid)
|
16
|
+
# @entry.locale('en-us')
|
17
|
+
#
|
18
|
+
# @return [Contentstack::Entry]
|
19
|
+
def locale(code)
|
20
|
+
@query[:locale] = code
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
# Specifies an array of 'only' keys in BASE object that would be 'included' in the response.
|
25
|
+
#
|
26
|
+
# @param [Array] fields Array of the 'only' reference keys to be included in response.
|
27
|
+
# @param [Array] fields_with_base Can be used to denote 'only' fields of the reference class
|
28
|
+
#
|
29
|
+
# Example
|
30
|
+
# # Include only title and description field in response
|
31
|
+
# @entry = @stack.content_type('category').entry(entry_uid)
|
32
|
+
# @entry.only(['title', 'description'])
|
33
|
+
#
|
34
|
+
# # Query product and include only the title and description from category reference
|
35
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
36
|
+
# @entry.include_reference('category')
|
37
|
+
# .only('category', ['title', 'description'])
|
38
|
+
#
|
39
|
+
# @return [Contentstack::Entry]
|
40
|
+
def only(fields, fields_with_base=nil)
|
41
|
+
q = {}
|
42
|
+
if [Array, String].include?(fields_with_base.class)
|
43
|
+
fields_with_base = [fields_with_base] if fields_with_base.class == String
|
44
|
+
q[fields.to_sym] = fields_with_base
|
45
|
+
else
|
46
|
+
fields = [fields] if fields.class == String
|
47
|
+
q = {BASE: fields}
|
48
|
+
end
|
49
|
+
|
50
|
+
@query[:only] = q
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
# Specifies list of field uids that would be 'excluded' from the response.
|
55
|
+
#
|
56
|
+
# @param [Array] fields Array of field uid which get 'excluded' from the response.
|
57
|
+
# @param [Array] fields_with_base Can be used to denote 'except' fields of the reference class
|
58
|
+
#
|
59
|
+
# Example
|
60
|
+
# # Exclude 'description' field in response
|
61
|
+
# @entry = @stack.content_type('category').entry(entry_uid)
|
62
|
+
# @entry.except(['description'])
|
63
|
+
#
|
64
|
+
# # Query product and exclude the 'description' from category reference
|
65
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
66
|
+
# @entry.include_reference('category')
|
67
|
+
# .except('category', ['description'])
|
68
|
+
#
|
69
|
+
# @return [Contentstack::Entry]
|
70
|
+
def except(fields, fields_with_base=nil)
|
71
|
+
q = {}
|
72
|
+
if [Array, String].include?(fields_with_base.class)
|
73
|
+
fields_with_base = [fields_with_base] if fields_with_base.class == String
|
74
|
+
q[fields.to_sym] = fields_with_base
|
75
|
+
else
|
76
|
+
fields = [fields] if fields.class == String
|
77
|
+
q = {BASE: fields}
|
78
|
+
end
|
79
|
+
|
80
|
+
@query[:except] = q
|
81
|
+
self
|
82
|
+
end
|
83
|
+
|
84
|
+
# Add a constraint that requires a particular reference key details.
|
85
|
+
#
|
86
|
+
# @param [String/Array] reference_field_uids Pass string or array of reference fields that must be included in the response
|
87
|
+
#
|
88
|
+
# Example
|
89
|
+
#
|
90
|
+
# # Include reference of 'category'
|
91
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
92
|
+
# @entry.include_reference('category')
|
93
|
+
#
|
94
|
+
# # Include reference of 'category' and 'reviews'
|
95
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
96
|
+
# @entry.include_reference(['category', 'reviews'])
|
97
|
+
#
|
98
|
+
# @return [Contentstack::Entry]
|
99
|
+
def include_reference(reference_field_uids)
|
100
|
+
self.include(reference_field_uids)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Include schemas of all returned objects along with objects themselves.
|
104
|
+
#
|
105
|
+
# Example
|
106
|
+
#
|
107
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
108
|
+
# @entry.include_schema
|
109
|
+
#
|
110
|
+
# @return [Contentstack::Entry]
|
111
|
+
def include_schema(flag=true)
|
112
|
+
@query[:include_schema] = flag
|
113
|
+
self
|
114
|
+
end
|
115
|
+
|
116
|
+
# Include object owner's profile in the objects data.
|
117
|
+
#
|
118
|
+
# Example
|
119
|
+
#
|
120
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
121
|
+
# @entry.include_owner
|
122
|
+
#
|
123
|
+
# @return [Contentstack::Entry]
|
124
|
+
def include_owner(flag=true)
|
125
|
+
@query[:include_owner] = flag
|
126
|
+
self
|
127
|
+
end
|
128
|
+
|
129
|
+
# Include object's content_type in response
|
130
|
+
#
|
131
|
+
# Example
|
132
|
+
#
|
133
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
134
|
+
# @entry.include_content_type
|
135
|
+
#
|
136
|
+
# @return [Contentstack::Entry]
|
137
|
+
def include_content_type(flag=true)
|
138
|
+
@query[:include_content_type] = flag
|
139
|
+
self
|
140
|
+
end
|
141
|
+
|
142
|
+
# Include the fallback locale publish content, if specified locale content is not publish.
|
143
|
+
#
|
144
|
+
# Example
|
145
|
+
#
|
146
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
147
|
+
# @entry.include_fallback
|
148
|
+
#
|
149
|
+
# @return [Contentstack::Entry]
|
150
|
+
def include_fallback(flag=true)
|
151
|
+
@query[:include_fallback] = flag
|
152
|
+
self
|
153
|
+
end
|
154
|
+
|
155
|
+
#
|
156
|
+
# @return [Contentstack::Query]
|
157
|
+
def include(field_uids)
|
158
|
+
field_uids = [field_uids] if field_uids.class == String
|
159
|
+
@query[:include] ||= []
|
160
|
+
@query[:include] = @query[:include] | field_uids
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
164
|
+
# Execute entry
|
165
|
+
#
|
166
|
+
# Example
|
167
|
+
#
|
168
|
+
# @entry = @stack.content_type('product').entry(entry_uid)
|
169
|
+
# @entry.fetch
|
170
|
+
#
|
171
|
+
# @return [Contentstack::EntryCollection]
|
10
172
|
def fetch
|
11
|
-
entry = API.fetch_entry(@content_type, self.fields[:uid])
|
173
|
+
entry = API.fetch_entry(@content_type, self.fields[:uid], @query)
|
12
174
|
setup(entry["entry"])
|
175
|
+
@schema = entry["schema"].symbolize_keys if entry["schema"]
|
176
|
+
@content_type = entry["content_type"].symbolize_keys if entry["content_type"]
|
13
177
|
self
|
14
178
|
end
|
15
179
|
|
@@ -24,6 +188,7 @@ module Contentstack
|
|
24
188
|
@content_type = content_type_uid if !content_type_uid.blank?
|
25
189
|
@owner = attrs[:_owner] if attrs[:_owner]
|
26
190
|
@uid = attrs[:uid]
|
191
|
+
@query = {}
|
27
192
|
end
|
28
193
|
end
|
29
194
|
end
|
data/lib/contentstack/query.rb
CHANGED
@@ -502,6 +502,20 @@ module Contentstack
|
|
502
502
|
self
|
503
503
|
end
|
504
504
|
|
505
|
+
|
506
|
+
# Include the fallback locale publish content, if specified locale content is not publish.
|
507
|
+
#
|
508
|
+
# Example
|
509
|
+
#
|
510
|
+
# @query = @stack.content_type('product').query
|
511
|
+
# @query.include_fallback
|
512
|
+
#
|
513
|
+
# @return [Contentstack::Query]
|
514
|
+
def include_fallback(flag=true)
|
515
|
+
@query[:include_fallback] = flag
|
516
|
+
self
|
517
|
+
end
|
518
|
+
|
505
519
|
# Include objects in 'Draft' mode in response
|
506
520
|
#
|
507
521
|
# Example
|
data/lib/contentstack/version.rb
CHANGED
data/spec/content_type_spec.rb
CHANGED
@@ -46,6 +46,11 @@ describe Contentstack::ContentType do
|
|
46
46
|
@data = client.content_types.first
|
47
47
|
expect(@data.attributes).not_to be nil
|
48
48
|
end
|
49
|
+
|
50
|
+
it "Should get content type from uid" do
|
51
|
+
@data = client.content_type("category").fetch
|
52
|
+
expect(@data.attributes).not_to be nil
|
53
|
+
end
|
49
54
|
end
|
50
55
|
|
51
56
|
describe "Initialized using class" do
|
data/spec/entry_spec.rb
CHANGED
@@ -3,6 +3,10 @@ require_relative '../lib/contentstack.rb'
|
|
3
3
|
|
4
4
|
describe Contentstack::Entry do
|
5
5
|
let(:client) { create_client }
|
6
|
+
let(:uid) { "blt05056a2f5e0ebf76" }
|
7
|
+
|
8
|
+
let(:category) {client.content_type("category").entry(uid)}
|
9
|
+
let(:product) {client.content_type("product").entry(uid)}
|
6
10
|
|
7
11
|
it "Contentstack::EntryCollection should have Contentstack::Entry instance" do
|
8
12
|
data = client.content_type("category").query.fetch
|
@@ -11,13 +15,75 @@ describe Contentstack::Entry do
|
|
11
15
|
end
|
12
16
|
|
13
17
|
it "is an instance of Contentstack::Entry if single entry is fetched" do
|
14
|
-
data =
|
18
|
+
data = category.fetch
|
15
19
|
expect(data.class).to eq Contentstack::Entry
|
16
20
|
end
|
17
21
|
|
18
22
|
it 'has a method `get` to get attributes data' do
|
19
|
-
|
20
|
-
data = client.content_type("category").entry(uid).fetch
|
23
|
+
data = category.fetch
|
21
24
|
expect(data.get('uid')).to eq uid
|
22
25
|
end
|
26
|
+
|
27
|
+
it "should set locale the in the request entry" do
|
28
|
+
data = category.locale('en-us')
|
29
|
+
expect(data.query[:locale]).to eq 'en-us'
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should get data using `only` method with string parameter" do
|
33
|
+
data = category.fetch
|
34
|
+
expect(data.fields[:title]).not_to be nil
|
35
|
+
expect(data.fields[:uid]).not_to be nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should get data using `only` method with array parameter" do
|
39
|
+
data = category.only(["title"]).fetch
|
40
|
+
expect(data.fields[:title]).not_to be nil
|
41
|
+
expect(data.fields[:uid]).not_to be nil
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should get data using `except` method with string parameter" do
|
45
|
+
data = category.except("category_tags").fetch
|
46
|
+
expect(data.fields[:category_tags]).to be nil
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should get data using `except` method with array parameter" do
|
50
|
+
data = category.except(["description"]).fetch
|
51
|
+
expect(data.fields[:description]).to be nil
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should get data using `only` method for reference fields" do
|
55
|
+
data = product.include_reference('categories').only("categories", ["title", "description"]).fetch
|
56
|
+
expect(data.fields[:categories][0][:title]).to eq "Smartphones"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should get data using `except` method for reference fields" do
|
60
|
+
data = product.include_reference('categories').except("categories", "title").fetch
|
61
|
+
expect(data.fields[:categories][0][:title]).to eq 'Smartphones'
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should get data using `include_schema` method" do
|
65
|
+
data = category.include_schema.fetch
|
66
|
+
expect(data.schema).not_to be nil
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should get data using `include_owner` method" do
|
70
|
+
data = product.include_owner.fetch
|
71
|
+
expect(data.fields[:_owner]).not_to be nil
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should get data using `include_owner` method" do
|
75
|
+
data = product.include_fallback.fetch
|
76
|
+
expect(data.fields[:locale]).not_to be nil
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should get data using `include_content_type` method" do
|
80
|
+
data = category.include_content_type.fetch
|
81
|
+
expect(data.content_type).not_to be nil
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should get data using `include_reference` method" do
|
85
|
+
data = product.include_reference('categories').fetch
|
86
|
+
puts data.get("categories.title")
|
87
|
+
expect(data.fields[:categories][0][:title]).not_to be nil
|
88
|
+
end
|
23
89
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"content_type":{"created_at":"2017-09-28T06:04:02.500Z","updated_at":"2017-09-28T07:13:13.612Z","title":"Product","uid":"product","inbuilt_class":false,"schema":[{"display_name":"Title","uid":"title","data_type":"text","mandatory":true,"unique":true,"field_metadata":{"_default":true},"multiple":false},{"display_name":"URL","uid":"url","data_type":"text","mandatory":false,"field_metadata":{"_default":true},"multiple":false,"unique":false},{"data_type":"text","display_name":"Price","uid":"price","field_metadata":{"description":"","default_value":""},"format":"","error_messages":{"format":""},"multiple":false,"mandatory":false,"unique":false},{"data_type":"text","display_name":"Discounted Price","uid":"discounted_price","field_metadata":{"description":"","default_value":""},"format":"","error_messages":{"format":""},"multiple":false,"mandatory":false,"unique":false},{"data_type":"file","display_name":"Featured Image","uid":"featured_image","extensions":[],"field_metadata":{"description":"","rich_text_type":"standard"},"multiple":false,"mandatory":false,"unique":false},{"data_type":"file","display_name":"Product Images","uid":"product_images","extensions":[],"field_metadata":{"description":"","rich_text_type":"standard"},"multiple":true,"mandatory":false,"unique":false},{"data_type":"text","display_name":"Description","uid":"description","field_metadata":{"description":"","default_value":"","multiline":true},"format":"","error_messages":{"format":""},"multiple":false,"mandatory":false,"unique":false},{"data_type":"reference","display_name":"Categories","reference_to":"category","field_metadata":{"ref_multiple":true},"uid":"categories","multiple":false,"mandatory":false,"unique":false},{"data_type":"reference","display_name":"Related Products","reference_to":"product","field_metadata":{"ref_multiple":true},"uid":"related_products","mandatory":false,"multiple":false,"unique":false}],"last_activity":{"environments":[{"uid":"blt922581483b3573b4","details":[{"locale":"en-us","time":"2017-09-28T09:43:24.028Z"}]}]},"maintain_revisions":true,"description":"","options":{"is_page":true,"singleton":false,"title":"title","sub_title":[],"url_pattern":"/:unique_id","url_prefix":"/products/"},"abilities":{"get_one_object":true,"get_all_objects":true,"create_object":true,"update_object":true,"delete_object":true,"delete_all_objects":true},"DEFAULT_ACL":{"others":{"read":false,"create":false},"users":[{"uid":"blt249905a2fc79092e","read":true,"sub_acl":{"read":true}}]},"SYS_ACL":{"others":{"read":false,"create":false,"update":false,"delete":false,"sub_acl":{"read":false,"create":false,"update":false,"delete":false,"publish":false}},"roles":[{"uid":"bltdbf78d599f92b0c9","read":true,"create":false,"update":false,"delete":false,"sub_acl":{"read":true,"create":true,"update":true,"delete":true,"publish":true}},{"uid":"blt344db9f3f8011ce2","read":true,"create":true,"update":true,"delete":true,"sub_acl":{"read":true,"create":true,"update":true,"delete":true,"publish":true}}]}}}
|
@@ -1 +1 @@
|
|
1
|
-
{"entry":{"title":"Apple Products","tags":[],"locale":"en-us","uid":"blt05056a2f5e0ebf76","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:08:21.276Z","updated_at":"2017-09-28T06:08:21.276Z","ACL":{},"_version":1}}
|
1
|
+
{"entry":{"title":"Apple Products","tags":[],"locale":"en-us","uid":"blt05056a2f5e0ebf76","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:08:21.276Z","updated_at":"2017-09-28T06:08:21.276Z","ACL":{},"_version":1}, "schema":[{"display_name":"Title","uid":"title","data_type":"text","mandatory":true,"unique":true,"field_metadata":{"_default":true},"multiple":false},{"data_type":"text","display_name":"Description","uid":"description","field_metadata":{"description":"","default_value":"","multiline":true},"format":"","error_messages":{"format":""},"multiple":false,"mandatory":false,"unique":false}],"content_type":{"created_at":"2017-08-28T11:26:16.005Z","updated_at":"2017-08-28T11:26:28.217Z","title":"Category","uid":"category","inbuilt_class":false,"schema":[{"display_name":"Title","uid":"title","data_type":"text","mandatory":true,"unique":true,"field_metadata":{"_default":true},"multiple":false},{"data_type":"text","display_name":"Description","uid":"description","field_metadata":{"description":"","default_value":"","multiline":true},"format":"","error_messages":{"format":""},"multiple":false,"mandatory":false,"unique":false}],"last_activity":{"environments":[{"uid":"bltc5173a61bc94f944","details":[{"locale":"en-us","time":"2017-09-28T09:37:14.441Z"}]}]},"maintain_revisions":true,"description":"","options":{"is_page":false,"singleton":false,"title":"title","sub_title":[]},"abilities":{"get_one_object":true,"get_all_objects":true,"create_object":true,"update_object":true,"delete_object":true,"delete_all_objects":true},"DEFAULT_ACL":{"others":{"read":false,"create":false},"users":[{"uid":"blt8360496f808a5408","read":true,"sub_acl":{"read":true}}]}}}
|
@@ -1 +1 @@
|
|
1
|
-
{"entry":{"title":"Motorola Moto X4","url":"/products/blt70d3d8c86c566079","price":"500","discounted_price":"450","featured_image":{"uid":"bltcf9489a3cf1eaa00","created_at":"2017-09-28T07:02:20.745Z","updated_at":"2017-09-28T07:02:20.745Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"311812","tags":[],"filename":"1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltcf9489a3cf1eaa00/59cc9e7c75d9f7760dfc33eb/download","ACL":{},"is_dir":false,"_version":1,"title":"1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},"product_images":[{"uid":"bltcf9489a3cf1eaa00","created_at":"2017-09-28T07:02:20.745Z","updated_at":"2017-09-28T07:02:20.745Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"311812","tags":[],"filename":"1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltcf9489a3cf1eaa00/59cc9e7c75d9f7760dfc33eb/download","ACL":{},"is_dir":false,"_version":1,"title":"1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt49a8b46c6839be12","created_at":"2017-09-28T07:02:30.108Z","updated_at":"2017-09-28T07:02:30.108Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"4226","tags":[],"filename":"2.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt49a8b46c6839be12/59cc9e86462a293417404402/download","ACL":{},"is_dir":false,"_version":1,"title":"2.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"bltb545ae58b0ab72bb","created_at":"2017-09-28T07:02:32.375Z","updated_at":"2017-09-28T07:02:32.375Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"5755","tags":[],"filename":"3.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltb545ae58b0ab72bb/59cc9e8895fd2a0a0daa742a/download","ACL":{},"is_dir":false,"_version":1,"title":"3.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt6af2dddde9d35e3c","created_at":"2017-09-28T07:02:36.507Z","updated_at":"2017-09-28T07:02:36.507Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"312464","tags":[],"filename":"4.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt6af2dddde9d35e3c/59cc9e8c75d9f7760dfc33f1/download","ACL":{},"is_dir":false,"_version":1,"title":"4.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}}],"description":"dual cameras.\nsingular design.\nAdvanced dual rear cameras for your best photos yet. Plus, a beautiful contoured glass and metal frame with an IP68 water resistance rating.* Coming soon.","categories":[{"title":"Smartphones","tags":[],"locale":"en-us","uid":"bltccd0ea06c1da94fd","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:07:37.132Z","updated_at":"2017-09-28T06:07:37.132Z","ACL":{},"_version":1,"publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.932Z","user":"sys_bltcbfe73b68603b243"},"_publish_environment":"blt922581483b3573b4","_publish_locale":"en-us","_publish_scheduled":false}],"related_products":[{"title":"OnePlus 3T A3000 64GB Gunmetal","url":"/products/bltc37f44d9bc85f3ec","price":"539","discounted_price":"499","featured_image":{"uid":"blt2f02748d62b5d9df","created_at":"2017-09-28T06:56:13.016Z","updated_at":"2017-09-28T06:56:13.016Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"40674","tags":[],"filename":"one-plus-three-1x.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt2f02748d62b5d9df/59cc9d0d95fd2a0a0daa7424/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-three-1x.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:37.885Z","user":"sys_bltcbfe73b68603b243"}},"product_images":[{"uid":"blt2f02748d62b5d9df","created_at":"2017-09-28T06:56:13.016Z","updated_at":"2017-09-28T06:56:13.016Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"40674","tags":[],"filename":"one-plus-three-1x.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt2f02748d62b5d9df/59cc9d0d95fd2a0a0daa7424/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-three-1x.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:37.885Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"bltf061d797179b0013","created_at":"2017-09-28T06:56:20.954Z","updated_at":"2017-09-28T06:56:20.954Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"13187","tags":[],"filename":"one-plus-3-2.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltf061d797179b0013/59cc9d1475d9f7760dfc33e5/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-3-2.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:31.431Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt7469869415aa6d33","created_at":"2017-09-28T06:56:24.656Z","updated_at":"2017-09-28T06:56:24.656Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"27485","tags":[],"filename":"one-plus-3-3.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt7469869415aa6d33/59cc9d183ef8e08c0d90ce29/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-3-3.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:26.882Z","user":"sys_bltcbfe73b68603b243"}}],"description":"Snapdragon 821 6gb RAM Unlocked Smartphone","categories":["bltccd0ea06c1da94fd"],"related_products":["blt6c4014da5a782a25"],"tags":[],"locale":"en-us","uid":"bltc37f44d9bc85f3ec","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:57:55.574Z","updated_at":"2017-09-28T06:57:55.574Z","ACL":{},"_version":1,"publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.933Z","user":"sys_bltcbfe73b68603b243"},"_publish_environment":"blt922581483b3573b4","_publish_locale":"en-us","_publish_scheduled":false}],"tags":[],"locale":"en-us","uid":"blt70d3d8c86c566079","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T07:03:11.350Z","updated_at":"2017-09-28T07:03:11.350Z","ACL":{},"_version":1}}
|
1
|
+
{"entry":{"title":"Motorola Moto X4","url":"/products/blt70d3d8c86c566079","price":"500","discounted_price":"450","featured_image":{"uid":"bltcf9489a3cf1eaa00","created_at":"2017-09-28T07:02:20.745Z","updated_at":"2017-09-28T07:02:20.745Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"311812","tags":[],"filename":"1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltcf9489a3cf1eaa00/59cc9e7c75d9f7760dfc33eb/download","ACL":{},"is_dir":false,"_version":1,"title":"1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},"product_images":[{"uid":"bltcf9489a3cf1eaa00","created_at":"2017-09-28T07:02:20.745Z","updated_at":"2017-09-28T07:02:20.745Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"311812","tags":[],"filename":"1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltcf9489a3cf1eaa00/59cc9e7c75d9f7760dfc33eb/download","ACL":{},"is_dir":false,"_version":1,"title":"1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt49a8b46c6839be12","created_at":"2017-09-28T07:02:30.108Z","updated_at":"2017-09-28T07:02:30.108Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"4226","tags":[],"filename":"2.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt49a8b46c6839be12/59cc9e86462a293417404402/download","ACL":{},"is_dir":false,"_version":1,"title":"2.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"bltb545ae58b0ab72bb","created_at":"2017-09-28T07:02:32.375Z","updated_at":"2017-09-28T07:02:32.375Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"5755","tags":[],"filename":"3.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltb545ae58b0ab72bb/59cc9e8895fd2a0a0daa742a/download","ACL":{},"is_dir":false,"_version":1,"title":"3.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt6af2dddde9d35e3c","created_at":"2017-09-28T07:02:36.507Z","updated_at":"2017-09-28T07:02:36.507Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"312464","tags":[],"filename":"4.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt6af2dddde9d35e3c/59cc9e8c75d9f7760dfc33f1/download","ACL":{},"is_dir":false,"_version":1,"title":"4.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.919Z","user":"sys_bltcbfe73b68603b243"}}],"description":"dual cameras.\nsingular design.\nAdvanced dual rear cameras for your best photos yet. Plus, a beautiful contoured glass and metal frame with an IP68 water resistance rating.* Coming soon.","categories":[{"title":"Smartphones","tags":[],"locale":"en-us","uid":"bltccd0ea06c1da94fd","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:07:37.132Z","updated_at":"2017-09-28T06:07:37.132Z","ACL":{},"_version":1,"publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.932Z","user":"sys_bltcbfe73b68603b243"},"_publish_environment":"blt922581483b3573b4","_publish_locale":"en-us","_publish_scheduled":false}],"related_products":[{"title":"OnePlus 3T A3000 64GB Gunmetal","url":"/products/bltc37f44d9bc85f3ec","price":"539","discounted_price":"499","featured_image":{"uid":"blt2f02748d62b5d9df","created_at":"2017-09-28T06:56:13.016Z","updated_at":"2017-09-28T06:56:13.016Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"40674","tags":[],"filename":"one-plus-three-1x.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt2f02748d62b5d9df/59cc9d0d95fd2a0a0daa7424/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-three-1x.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:37.885Z","user":"sys_bltcbfe73b68603b243"}},"product_images":[{"uid":"blt2f02748d62b5d9df","created_at":"2017-09-28T06:56:13.016Z","updated_at":"2017-09-28T06:56:13.016Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"40674","tags":[],"filename":"one-plus-three-1x.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt2f02748d62b5d9df/59cc9d0d95fd2a0a0daa7424/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-three-1x.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:37.885Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"bltf061d797179b0013","created_at":"2017-09-28T06:56:20.954Z","updated_at":"2017-09-28T06:56:20.954Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"13187","tags":[],"filename":"one-plus-3-2.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltf061d797179b0013/59cc9d1475d9f7760dfc33e5/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-3-2.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:31.431Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt7469869415aa6d33","created_at":"2017-09-28T06:56:24.656Z","updated_at":"2017-09-28T06:56:24.656Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"27485","tags":[],"filename":"one-plus-3-3.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt7469869415aa6d33/59cc9d183ef8e08c0d90ce29/download","ACL":{},"is_dir":false,"_version":1,"title":"one-plus-3-3.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:42:26.882Z","user":"sys_bltcbfe73b68603b243"}}],"description":"Snapdragon 821 6gb RAM Unlocked Smartphone","categories":["bltccd0ea06c1da94fd"],"related_products":["blt6c4014da5a782a25"],"tags":[],"locale":"en-us","uid":"bltc37f44d9bc85f3ec","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:57:55.574Z","updated_at":"2017-09-28T06:57:55.574Z","ACL":{},"_version":1,"publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:28:47.933Z","user":"sys_bltcbfe73b68603b243"},"_publish_environment":"blt922581483b3573b4","_publish_locale":"en-us","_publish_scheduled":false}],"tags":[],"locale":"en-us","uid":"blt70d3d8c86c566079","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T07:03:11.350Z","updated_at":"2017-09-28T07:03:11.350Z","ACL":{},"_version":1, "_owner":{"uid":"sys_bltcbfe73b68603b243","created_at":"2012-11-26T09:45:10.000Z","updated_at":"2017-09-15T16:06:07.920Z","email":"rohit.sharma@raweng.com","username":"rohit.sharma_blt50c79ab1","first_name":"Rohit","last_name":"Sharma","company":"raw engineering inc.","plan_id":["cms_plan"],"org_uid":["blt821f82ffcc171fed"]}}}
|
data/spec/query_spec.rb
CHANGED
@@ -147,6 +147,11 @@ describe Contentstack::Query do
|
|
147
147
|
expect(data.first.fields[:_owner]).not_to be nil
|
148
148
|
end
|
149
149
|
|
150
|
+
it "should get data using `include_owner` method" do
|
151
|
+
data = product_query.include_fallback.fetch
|
152
|
+
expect(data.first.fields[:locale]).not_to be nil
|
153
|
+
end
|
154
|
+
|
150
155
|
it "should get data using `include_draft` method" do
|
151
156
|
data = category_query.include_draft.fetch
|
152
157
|
expect(data.length).to eq 5
|
data/spec/spec_helper.rb
CHANGED
@@ -118,7 +118,11 @@ RSpec.configure do |config|
|
|
118
118
|
stub_request(:get, /cdn.contentstack.io\/v3\/content_types/).
|
119
119
|
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
120
120
|
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/content_types.json'), :headers => {})
|
121
|
-
|
121
|
+
|
122
|
+
stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/category/).
|
123
|
+
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
124
|
+
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/category_content_type.json'), :headers => {})
|
125
|
+
|
122
126
|
stub_request(:get, /cdn.contentstack.io\/v3\/assets/).
|
123
127
|
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
124
128
|
to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/asset_collection.json'), :headers => {})
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentstack
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05
|
11
|
+
date: 2020-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".yardopts"
|
78
|
+
- CHANGELOG.md
|
78
79
|
- CODE_OF_CONDUCT.md
|
79
80
|
- Gemfile
|
80
81
|
- Gemfile.lock
|
@@ -84,30 +85,6 @@ files:
|
|
84
85
|
- coverage/.last_run.json
|
85
86
|
- coverage/.resultset.json
|
86
87
|
- coverage/.resultset.json.lock
|
87
|
-
- coverage/assets/0.10.2/application.css
|
88
|
-
- coverage/assets/0.10.2/application.js
|
89
|
-
- coverage/assets/0.10.2/colorbox/border.png
|
90
|
-
- coverage/assets/0.10.2/colorbox/controls.png
|
91
|
-
- coverage/assets/0.10.2/colorbox/loading.gif
|
92
|
-
- coverage/assets/0.10.2/colorbox/loading_background.png
|
93
|
-
- coverage/assets/0.10.2/favicon_green.png
|
94
|
-
- coverage/assets/0.10.2/favicon_red.png
|
95
|
-
- coverage/assets/0.10.2/favicon_yellow.png
|
96
|
-
- coverage/assets/0.10.2/loading.gif
|
97
|
-
- coverage/assets/0.10.2/magnify.png
|
98
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
99
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
100
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
101
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
102
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
103
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
104
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
105
|
-
- coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
106
|
-
- coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png
|
107
|
-
- coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png
|
108
|
-
- coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png
|
109
|
-
- coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png
|
110
|
-
- coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png
|
111
88
|
- coverage/index.html
|
112
89
|
- lib/contentstack.rb
|
113
90
|
- lib/contentstack/api.rb
|
@@ -131,6 +108,7 @@ files:
|
|
131
108
|
- spec/entry_spec.rb
|
132
109
|
- spec/fixtures/asset.json
|
133
110
|
- spec/fixtures/asset_collection.json
|
111
|
+
- spec/fixtures/category_content_type.json
|
134
112
|
- spec/fixtures/category_entry.json
|
135
113
|
- spec/fixtures/category_entry_collection.json
|
136
114
|
- spec/fixtures/category_entry_collection_without_count.json
|
@@ -143,7 +121,7 @@ homepage: https://github.com/contentstack/contentstack-ruby
|
|
143
121
|
licenses:
|
144
122
|
- MIT
|
145
123
|
metadata: {}
|
146
|
-
post_install_message:
|
124
|
+
post_install_message:
|
147
125
|
rdoc_options: []
|
148
126
|
require_paths:
|
149
127
|
- lib
|
@@ -159,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
137
|
version: '0'
|
160
138
|
requirements: []
|
161
139
|
rubygems_version: 3.1.2
|
162
|
-
signing_key:
|
140
|
+
signing_key:
|
163
141
|
specification_version: 4
|
164
142
|
summary: Contentstack Ruby client for the Content Delivery API
|
165
143
|
test_files: []
|