contentstack 0.0.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.
@@ -0,0 +1,3 @@
1
+ module Contentstack
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,107 @@
1
+ class Hash
2
+ def to_query(namespace = nil)
3
+ collect do |key, value|
4
+ value.to_query(namespace ? "#{namespace}[#{key}]" : key)
5
+ end.sort * '&'
6
+ end
7
+
8
+ def symbolize_keys
9
+ new_hash = {}
10
+ self.each do |key,value|
11
+ if [Hash, Array].include?(value.class)
12
+ new_hash[key.to_sym] = value.symbolize_keys
13
+ else
14
+ new_hash[key.to_sym] = value
15
+ end
16
+ end
17
+ new_hash
18
+ end
19
+ end
20
+
21
+ class Array
22
+ def to_query(key)
23
+ prefix = "#{key}[]"
24
+ collect { |value| value.to_query(prefix) }.join '&'
25
+ end
26
+
27
+ def symbolize_keys
28
+ collect do |entry|
29
+ if entry.class == Hash
30
+ entry.symbolize_keys
31
+ else
32
+ entry
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ class String
39
+ def to_query(key)
40
+ require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
41
+ "#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}"
42
+ end
43
+
44
+ def to_param
45
+ to_s
46
+ end
47
+ end
48
+
49
+ class Symbol
50
+ def to_query(key)
51
+ to_s.to_query(key)
52
+ end
53
+
54
+ def to_param
55
+ to_s
56
+ end
57
+ end
58
+
59
+ class NilClass
60
+ def to_query(key)
61
+ to_s.to_query(key)
62
+ end
63
+
64
+ def to_param
65
+ to_s
66
+ end
67
+ end
68
+
69
+ class TrueClass
70
+ def to_query(key)
71
+ to_s.to_query(key)
72
+ end
73
+
74
+ def to_query(val)
75
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
76
+ end
77
+ end
78
+
79
+ class FalseClass
80
+ def to_query(key)
81
+ to_s.to_query(key)
82
+ end
83
+
84
+ def to_query(val)
85
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
86
+ end
87
+ end
88
+
89
+ class Integer
90
+ def to_query(key)
91
+ to_s.to_query(key)
92
+ end
93
+
94
+ def to_query(val)
95
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
96
+ end
97
+ end
98
+
99
+ class Numeric
100
+ def to_query(key)
101
+ to_s.to_query(key)
102
+ end
103
+
104
+ def to_query(val)
105
+ "#{CGI.escape(val.to_param)}=#{CGI.escape(to_s)}"
106
+ end
107
+ end
@@ -0,0 +1,4 @@
1
+ require 'yard'
2
+ YARD::Rake::YardocTask.new do |t|
3
+ t.files = ["README.rdoc", 'lib/contentstack/*.rb', 'lib/contentstack.rb'] # optional
4
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+
4
+ describe Contentstack::AssetCollection do
5
+ let(:client) { create_client }
6
+
7
+ it "has attribute called `assets`" do
8
+ data = client.assets.fetch
9
+ expect(data.assets).not_to be nil
10
+ end
11
+
12
+ it "is instance of `Contentstack::AssetCollection`" do
13
+ data = client.assets.fetch
14
+ expect(data.class).to be Contentstack::AssetCollection
15
+ end
16
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+
4
+ describe Contentstack::Asset do
5
+ let(:client) { create_client }
6
+
7
+ it "has attribute called `uid`" do
8
+ @uid = "blt3ca1a3470787ba63"
9
+ @asset = client.asset(@uid).fetch
10
+ expect(@asset.uid).not_to be nil
11
+ end
12
+
13
+ it "should match uid" do
14
+ @uid = "blt3ca1a3470787ba63"
15
+ @asset = client.asset(@uid).fetch
16
+ expect(@asset.uid).to eq @uid
17
+ end
18
+
19
+ it "has attribute called `url`" do
20
+ @uid = "blt3ca1a3470787ba63"
21
+ @asset = client.asset(@uid).fetch
22
+ expect(@asset.url).not_to be nil
23
+ end
24
+
25
+ it "has attribute called `tags`" do
26
+ @uid = "blt3ca1a3470787ba63"
27
+ @asset = client.asset(@uid).fetch
28
+ expect(@asset.tags).not_to be nil
29
+ end
30
+
31
+ it "has attribute called `file_size`" do
32
+ @uid = "blt3ca1a3470787ba63"
33
+ @asset = client.asset(@uid).fetch
34
+ expect(@asset.file_size).not_to be nil
35
+ end
36
+
37
+ it "has attribute called `filename`" do
38
+ @uid = "blt3ca1a3470787ba63"
39
+ @asset = client.asset(@uid).fetch
40
+ expect(@asset.filename).not_to be nil
41
+ end
42
+
43
+ it "has attribute called `content_type`" do
44
+ @uid = "blt3ca1a3470787ba63"
45
+ @asset = client.asset(@uid).fetch
46
+ expect(@asset.content_type).not_to be nil
47
+ end
48
+ end
@@ -0,0 +1,64 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+
4
+ describe Contentstack::ContentType do
5
+ let(:client) { create_client }
6
+
7
+ describe "Fetch data from API" do
8
+ it "has class as Contentstack::ContentType" do
9
+ @data = client.content_types.first
10
+ expect(@data.class).to eq Contentstack::ContentType
11
+ end
12
+
13
+ it "has method called title with data" do
14
+ @data = client.content_types.first
15
+ expect(@data.title).not_to be nil
16
+ end
17
+
18
+ it "has method called uid with data" do
19
+ @data = client.content_types.first
20
+ expect(@data.uid).not_to be nil
21
+ end
22
+
23
+ it "has method called created_at with data" do
24
+ @data = client.content_types.first
25
+ expect(@data.created_at).not_to be nil
26
+ end
27
+
28
+ it "has method called updated_at with data" do
29
+ @data = client.content_types.first
30
+ expect(@data.updated_at).not_to be nil
31
+ end
32
+
33
+ it "has method called attributes with data" do
34
+ @data = client.content_types.first
35
+ expect(@data.attributes).not_to be nil
36
+ end
37
+ end
38
+
39
+ describe "Initialized using class" do
40
+ before(:each) do
41
+ @data = Contentstack::ContentType.new({uid: "DummyUID"})
42
+ end
43
+
44
+ it "has method called title without data" do
45
+ expect(@data.title).to be nil
46
+ end
47
+
48
+ it "has method called uid with data" do
49
+ expect(@data.uid).not_to be nil
50
+ end
51
+
52
+ it "has method called created_at without data" do
53
+ expect(@data.created_at).to be nil
54
+ end
55
+
56
+ it "has method called updated_at without data" do
57
+ expect(@data.updated_at).to be nil
58
+ end
59
+
60
+ it "has method called attributes without data" do
61
+ expect(@data.attributes).not_to be nil
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+
4
+ describe Contentstack do
5
+ let(:client) { create_client }
6
+
7
+ it "has a version number" do
8
+ expect(Contentstack::VERSION).not_to be nil
9
+ end
10
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+
4
+ describe Contentstack::EntryCollection do
5
+ let(:client) { create_client }
6
+
7
+ it "has no instance variable `count`" do
8
+ @data = client.content_type("category").query.fetch
9
+ @countdata = client.content_type("category").query.include_count.fetch
10
+ expect(@data.count).to be nil
11
+ end
12
+
13
+ it "has instance variable `count`" do
14
+ @data = client.content_type("category").query.fetch
15
+ @countdata = client.content_type("category").query.include_count.fetch
16
+ expect(@countdata.count).not_to be nil
17
+ end
18
+
19
+ it "has instance variable `entries`" do
20
+ @data = client.content_type("category").query.fetch
21
+ @countdata = client.content_type("category").query.include_count.fetch
22
+ expect(@data.entries).not_to be nil
23
+ end
24
+
25
+ it "has the same entry using `first` method" do
26
+ @data = client.content_type("category").query.fetch
27
+ @countdata = client.content_type("category").query.include_count.fetch
28
+ expect(@data.entries[0].uid).to eq @data.first.uid
29
+ end
30
+
31
+ it "has the same entry using `last` method" do
32
+ @data = client.content_type("category").query.fetch
33
+ @countdata = client.content_type("category").query.include_count.fetch
34
+ expect(@data.entries[-1].uid).to eq @data.last.uid
35
+ end
36
+
37
+ it "has the same entry using `get` method" do
38
+ @data = client.content_type("category").query.fetch
39
+ @countdata = client.content_type("category").query.include_count.fetch
40
+ expect(@data.entries[3].uid).to eq @data.get(3).uid
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+
4
+ describe Contentstack::Entry do
5
+ let(:client) { create_client }
6
+
7
+ it "Contentstack::EntryCollection should have Contentstack::Entry instance" do
8
+ data = client.content_type("category").query.fetch
9
+ expect(data.class).to eq Contentstack::EntryCollection
10
+ expect(data.first.class).to eq Contentstack::Entry
11
+ end
12
+
13
+ it "is an instance of Contentstack::Entry if single entry is fetched" do
14
+ data = client.content_type("category").entry("blt05056a2f5e0ebf76").fetch
15
+ expect(data.class).to eq Contentstack::Entry
16
+ end
17
+
18
+ it 'has a method `get` to get attributes data' do
19
+ uid = "blt05056a2f5e0ebf76"
20
+ data = client.content_type("category").entry(uid).fetch
21
+ expect(data.get('uid')).to eq uid
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ {"asset":{"uid":"blt3ca1a3470787ba63","created_at":"2017-09-07T01:31:59.139Z","updated_at":"2017-09-07T01:31:59.139Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/png","file_size":"241691","tags":["tag1","tag2"],"filename":"maybe.png","url":"https://images.contentstack.io/v3/assets/blt65b55da1cef1bf48/blt3ca1a3470787ba63/59b0a18f462a2934174020fe/download","ACL":{},"is_dir":false,"parent_uid":null,"_version":1,"title":"maybe.png","description":""}}
@@ -0,0 +1 @@
1
+ {"assets":[{"uid":"blt5651507f7bc2c163","created_at":"2017-09-10T20:27:00.488Z","updated_at":"2017-09-10T20:27:00.488Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"115545","tags":[],"filename":"Win Against Dortmund.jpg","url":"https://images.contentstack.io/v3/assets/blt65b55da1cef1bf48/blt5651507f7bc2c163/59b5a014c0eddd140d5a5312/download","ACL":{},"is_dir":false,"_version":1,"title":"Win Against Dortmund.jpg"},{"uid":"blt3ca1a3470787ba63","created_at":"2017-09-07T01:31:59.139Z","updated_at":"2017-09-07T01:31:59.139Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/png","file_size":"241691","tags":["tag1","tag2"],"filename":"maybe.png","url":"https://images.contentstack.io/v3/assets/blt65b55da1cef1bf48/blt3ca1a3470787ba63/59b0a18f462a2934174020fe/download","ACL":{},"is_dir":false,"parent_uid":null,"_version":1,"title":"maybe.png","description":""}]}
@@ -0,0 +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}}
@@ -0,0 +1 @@
1
+ {"entries":[{"title":"Home & Appliances","tags":[],"locale":"en-us","uid":"blt0acc4979c5cba20a","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:08:32.914Z","updated_at":"2017-09-28T06:08:32.914Z","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"]}},{"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,"_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"]}},{"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,"_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"]}},{"title":"Tablets","tags":[],"locale":"en-us","uid":"blt2b822dd8cf42229a","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:07:20.740Z","updated_at":"2017-09-28T06:07:20.740Z","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"]}},{"title":"Headphones","tags":[],"locale":"en-us","uid":"blt80de566b615e9573","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:07:07.673Z","updated_at":"2017-09-28T06:07:07.673Z","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"]}}],"count":5,"content_type":{"created_at":"2017-09-28T06:06:44.057Z","updated_at":"2017-09-28T06:06:49.125Z","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}],"last_activity":{"environments":[{"uid":"blt922581483b3573b4","details":[{"locale":"en-us","time":"2017-09-28T09:43:24.027Z"}]}]},"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":"blt249905a2fc79092e","read":true,"sub_acl":{"read":true}}]}},"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}}]}}}
@@ -0,0 +1 @@
1
+ {"entries":[{"title":"Home & Appliances","tags":[],"locale":"en-us","uid":"blt0acc4979c5cba20a","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:08:32.914Z","updated_at":"2017-09-28T06:08:32.914Z","ACL":{},"_version":1},{"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},{"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},{"title":"Tablets","tags":[],"locale":"en-us","uid":"blt2b822dd8cf42229a","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:07:20.740Z","updated_at":"2017-09-28T06:07:20.740Z","ACL":{},"_version":1},{"title":"Headphones","tags":[],"locale":"en-us","uid":"blt80de566b615e9573","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:07:07.673Z","updated_at":"2017-09-28T06:07:07.673Z","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}}]}}}
@@ -0,0 +1 @@
1
+ {"content_types":[{"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}}]}},{"created_at":"2017-09-28T06:06:44.057Z","updated_at":"2017-09-28T06:06:49.125Z","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}],"last_activity":{"environments":[{"uid":"blt922581483b3573b4","details":[{"locale":"en-us","time":"2017-09-28T09:43:24.027Z"}]}]},"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":"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}}]}}]}
@@ -0,0 +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}}
@@ -0,0 +1 @@
1
+ {"entries":[{"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"]}},{"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":[{"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":"Google Wifi System (Single Wifi Point) - Router Replacement For Whole Home Coverage","url":"/products/blt6c4014da5a782a25","price":"135","discounted_price":"129","featured_image":{"uid":"bltc36a363694b47c7e","created_at":"2017-09-28T06:18:06.662Z","updated_at":"2017-09-28T06:18:06.662Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"20474","tags":[],"filename":"google-wifi-1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltc36a363694b47c7e/59cc941e75d9f7760dfc33c3/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}},"product_images":[{"uid":"bltc36a363694b47c7e","created_at":"2017-09-28T06:18:06.662Z","updated_at":"2017-09-28T06:18:06.662Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"20474","tags":[],"filename":"google-wifi-1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltc36a363694b47c7e/59cc941e75d9f7760dfc33c3/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt4f3256793b06fc22","created_at":"2017-09-28T06:18:11.003Z","updated_at":"2017-09-28T06:18:11.003Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"22491","tags":[],"filename":"google-wifi-2.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt4f3256793b06fc22/59cc942395fd2a0a0daa740c/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-2.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blta5e2d50c8a37de30","created_at":"2017-09-28T06:18:14.842Z","updated_at":"2017-09-28T06:18:14.842Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"10662","tags":[],"filename":"google-wifi-3.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blta5e2d50c8a37de30/59cc9426259271800dd8b3e0/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-3.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}}],"description":"A new type of connected system that replaces your router for seamless Wi-Fi coverage throughout your home, helping eliminate dead zones and buffering. Network Assist technology keeps your connection fast by always selecting the clearest channel and fastest band for your devices.","tags":[],"locale":"en-us","uid":"blt6c4014da5a782a25","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:16:23.740Z","updated_at":"2017-09-28T06:18:40.456Z","ACL":{},"_version":2,"categories":["blt0acc4979c5cba20a"],"publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.028Z","user":"sys_bltcbfe73b68603b243"},"_publish_environment":"blt922581483b3573b4","_publish_locale":"en-us","_publish_scheduled":false}],"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,"_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"]}},{"title":"Google Wifi System (Single Wifi Point) - Router Replacement For Whole Home Coverage","url":"/products/blt6c4014da5a782a25","price":"135","discounted_price":"129","featured_image":{"uid":"bltc36a363694b47c7e","created_at":"2017-09-28T06:18:06.662Z","updated_at":"2017-09-28T06:18:06.662Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"20474","tags":[],"filename":"google-wifi-1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltc36a363694b47c7e/59cc941e75d9f7760dfc33c3/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}},"product_images":[{"uid":"bltc36a363694b47c7e","created_at":"2017-09-28T06:18:06.662Z","updated_at":"2017-09-28T06:18:06.662Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"20474","tags":[],"filename":"google-wifi-1.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/bltc36a363694b47c7e/59cc941e75d9f7760dfc33c3/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-1.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blt4f3256793b06fc22","created_at":"2017-09-28T06:18:11.003Z","updated_at":"2017-09-28T06:18:11.003Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"22491","tags":[],"filename":"google-wifi-2.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blt4f3256793b06fc22/59cc942395fd2a0a0daa740c/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-2.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}},{"uid":"blta5e2d50c8a37de30","created_at":"2017-09-28T06:18:14.842Z","updated_at":"2017-09-28T06:18:14.842Z","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","content_type":"image/jpeg","file_size":"10662","tags":[],"filename":"google-wifi-3.jpg","url":"https://images.contentstack.io/v3/assets/bltc46be1ce6b7e1e24/blta5e2d50c8a37de30/59cc9426259271800dd8b3e0/download","ACL":{},"is_dir":false,"_version":1,"title":"google-wifi-3.jpg","publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.012Z","user":"sys_bltcbfe73b68603b243"}}],"description":"A new type of connected system that replaces your router for seamless Wi-Fi coverage throughout your home, helping eliminate dead zones and buffering. Network Assist technology keeps your connection fast by always selecting the clearest channel and fastest band for your devices.","tags":[],"locale":"en-us","uid":"blt6c4014da5a782a25","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:16:23.740Z","updated_at":"2017-09-28T06:18:40.456Z","ACL":{},"_version":2,"categories":[{"title":"Home & Appliances","tags":[],"locale":"en-us","uid":"blt0acc4979c5cba20a","created_by":"sys_bltcbfe73b68603b243","updated_by":"sys_bltcbfe73b68603b243","created_at":"2017-09-28T06:08:32.914Z","updated_at":"2017-09-28T06:08:32.914Z","ACL":{},"_version":1,"publish_details":{"environment":"blt922581483b3573b4","locale":"en-us","time":"2017-09-28T09:43:24.027Z","user":"sys_bltcbfe73b68603b243"},"_publish_environment":"blt922581483b3573b4","_publish_locale":"en-us","_publish_scheduled":false}],"_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"]}}],"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}}]}}}
@@ -0,0 +1,188 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+
4
+ describe Contentstack::Query do
5
+ let(:client) { create_client }
6
+ let(:category_query) {client.content_type("category").query}
7
+ let(:product_query) {client.content_type("product").query}
8
+
9
+ it "should get data using `where` method" do
10
+ data = category_query.where({title: "Electronics"}).fetch
11
+ expect(data.length).to eq 5
12
+ end
13
+
14
+ it "should get data using `regex` method" do
15
+ data = category_query.regex("title", "App.*").fetch
16
+ expect(data.length).to eq 5
17
+ end
18
+
19
+ it "should get data using `less_than` method" do
20
+ data = product_query.less_than("price", 150).fetch
21
+ expect(data.length).to eq 3
22
+ end
23
+
24
+ it "should get data using `less_than_or_equal` method" do
25
+ data = product_query.less_than_or_equal("price", 166).fetch
26
+ expect(data.length).to eq 3
27
+ end
28
+
29
+ it "should get data using `greater_than` method" do
30
+ data = product_query.greater_than("price", 120).fetch
31
+ expect(data.length).to eq 3
32
+ end
33
+
34
+ it "should get data using `greater_than_or_equal` method" do
35
+ data = product_query.greater_than_or_equal("price", 166).fetch
36
+ expect(data.length).to eq 3
37
+ end
38
+
39
+ it "should get data using `not_equal_to` method" do
40
+ data = product_query.not_equal_to("price", 166).fetch
41
+ expect(data.length).to eq 3
42
+ end
43
+
44
+ it "should get data using `limit` method" do
45
+ data = category_query.limit(2).fetch
46
+ expect(data.length).to eq 5
47
+ end
48
+
49
+ it "should get data using `skip` method" do
50
+ data = category_query.skip(5).fetch
51
+ expect(data.length).to eq 5
52
+ end
53
+
54
+ it "should get data using `include_count` method" do
55
+ data = category_query.include_count.fetch
56
+ expect(data.count).not_to be nil
57
+ expect(data.count.class).to be Integer
58
+ end
59
+
60
+ it "should get data using `only` method with string parameter" do
61
+ data = category_query.only("title").fetch
62
+ expect(data.first.fields[:title]).not_to be nil
63
+ expect(data.first.fields[:uid]).not_to be nil
64
+ end
65
+
66
+ it "should get data using `only` method with array parameter" do
67
+ data = category_query.only(["title"]).fetch
68
+ expect(data.first.fields[:title]).not_to be nil
69
+ expect(data.first.fields[:uid]).not_to be nil
70
+ end
71
+
72
+ it "should get data using `except` method with string parameter" do
73
+ data = category_query.except("category_tags").fetch
74
+ expect(data.first.fields[:category_tags]).to be nil
75
+ end
76
+
77
+ it "should get data using `except` method with array parameter" do
78
+ data = category_query.except(["description"]).fetch
79
+ expect(data.first.fields[:description]).to be nil
80
+ end
81
+
82
+ it "should get data using `tags` method" do
83
+ data = category_query.tags(["tag1"]).fetch
84
+ expect(data.length).to eq 5
85
+ end
86
+
87
+ it "should get data using `contained_in` method" do
88
+ data = category_query.contained_in("title", ["Electronics", "Apparel"]).fetch
89
+ expect(data.length).to eq 5
90
+ expect(data.first.fields[:title]).to eq "Home & Appliances"
91
+ expect(data.last.fields[:title]).to eq "Headphones"
92
+ end
93
+
94
+ it "should get data using `not_contained_in` method" do
95
+ data = category_query.not_contained_in("title", ["Electronics", "Apparel"]).fetch
96
+ expect(data.length).to eq 5
97
+ end
98
+
99
+ it "should get data using `in` method" do
100
+ data = category_query.contained_in("title", ["Electronics", "Apparel"]).fetch
101
+ expect(data.length).to eq 5
102
+ end
103
+
104
+ it "should get data using `not_in` method" do
105
+ data = category_query.not_contained_in("title", ["Electronics", "Apparel"]).fetch
106
+ expect(data.length).to eq 5
107
+ end
108
+
109
+ it "should get data using `ascending` method" do
110
+ data = product_query.ascending("price").fetch
111
+ expect(data.first.fields[:title]).to eq "Motorola Moto X4"
112
+ end
113
+
114
+ it "should get data using `descending` method" do
115
+ data = product_query.descending("price").fetch
116
+ expect(data.first.fields[:title]).to eq "Motorola Moto X4"
117
+ end
118
+
119
+ it "should get data using `only` method for reference fields" do
120
+ data = product_query.include_reference('categories').only("categories", ["title", "description"]).fetch
121
+ expect(data.first.fields[:categories][0][:title]).to eq "Smartphones"
122
+ end
123
+
124
+ it "should get data using `except` method for reference fields" do
125
+ data = product_query.include_reference('categories').except("categories", "title").fetch
126
+ expect(data.first.fields[:categories][0][:title]).to eq 'Smartphones'
127
+ end
128
+
129
+ it "should get data using `include_schema` method" do
130
+ data = category_query.include_schema.fetch
131
+ expect(data.schema).not_to be nil
132
+ end
133
+
134
+ it "should get data using `include_content_type` method" do
135
+ data = category_query.include_content_type.fetch
136
+ expect(data.content_type).not_to be nil
137
+ end
138
+
139
+ it "should get data using `include_reference` method" do
140
+ data = product_query.include_reference('categories').fetch
141
+ puts data.first.get("categories.title")
142
+ expect(data.first.fields[:categories][0][:title]).not_to be nil
143
+ end
144
+
145
+ it "should get data using `include_owner` method" do
146
+ data = product_query.include_owner.fetch
147
+ expect(data.first.fields[:_owner]).not_to be nil
148
+ end
149
+
150
+ it "should get data using `include_draft` method" do
151
+ data = category_query.include_draft.fetch
152
+ expect(data.length).to eq 5
153
+ end
154
+
155
+ it "should get data using `search` method" do
156
+ data = category_query.search("App").fetch
157
+ expect(data.length).to eq 5
158
+ end
159
+
160
+ it "should get data using `count` method" do
161
+ data = category_query.count
162
+ expect(data).to eq 5
163
+ end
164
+
165
+ it "should get data using `exists` method" do
166
+ data = category_query.exists?('description').fetch
167
+ expect(data.length).to eq 5
168
+ end
169
+
170
+ it "should get data using `not_exists` method" do
171
+ data = product_query.not_exists?('banner_image').fetch
172
+ expect(data.length).to eq 3
173
+ end
174
+
175
+ it "should get data using `and` method" do
176
+ q1 = client.content_type("category").query.regex("title", "App.*")
177
+ q2 = client.content_type("category").query.where({"description"=>"Appliances Category"})
178
+ data = category_query.and([q1,q2]).fetch
179
+ expect(data.length).to eq 5
180
+ end
181
+
182
+ it "should get data using `or` method" do
183
+ q1 = client.content_type("category").query.regex("title", "App.*")
184
+ q2 = client.content_type("category").query.regex("description", "App*")
185
+ data = category_query.or([q1,q2]).fetch
186
+ expect(data.length).to eq 5
187
+ end
188
+ end