contentstack 0.1.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 => {})
@@ -146,9 +150,18 @@ RSpec.configure do |config|
146
150
  stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/category\/entries\/blt05056a2f5e0ebf76/).
147
151
  with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
148
152
  to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/category_entry.json'), :headers => {})
153
+
154
+ stub_request(:get, /cdn.contentstack.io\/v3\/stacks\/sync/).
155
+ with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
156
+ to_return(:status => 200, :body => File.read(File.dirname(__FILE__) + '/fixtures/sync_init.json'), :headers => {})
157
+
158
+ end
159
+
160
+ def create_client(delivery_token = ENV['DELIVERY_TOKEN'], api_key = ENV['API_KEY'], environment = ENV['ENVIRONMENT'], options = {})
161
+ Contentstack::Client.new(api_key, delivery_token, environment, options)
149
162
  end
150
163
 
151
- def create_client(delivery_token = ENV['ACCESS_TOKEN'], api_key = ENV['API_KEY'], environment = ENV['STACK_ENV'], options = {})
152
- Contentstack::Client.new(delivery_token, api_key, environment, options)
164
+ def render(content, entry)
165
+ Contentstack.render_content(content, ContentstackUtils::Model::Options.new(entry))
153
166
  end
154
167
  end
data/spec/sync_spec.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/contentstack.rb'
3
+ pagination_token = "token"
4
+ describe Contentstack::SyncResult do
5
+ let(:client) { create_client }
6
+
7
+ it "initial sync for Stack" do
8
+ @result = client.sync({init: true})
9
+ expect(@result.items.length).to be 100
10
+ expect(@result.skip).to be 0
11
+ expect(@result.limit).to be 100
12
+ expect(@result.total_count).to be 123
13
+ expect(@result.pagination_token).not_to be nil
14
+ expect(@result.sync_token).to be nil
15
+ pagination_token = @result.pagination_token
16
+ end
17
+
18
+ it "next paginated sync for Stack" do
19
+ @result = client.sync({pagination_token: pagination_token})
20
+ expect(@result.items.length).to be 100
21
+ expect(@result.skip).to be 0
22
+ expect(@result.limit).to be 100
23
+ expect(@result.total_count).to be 123
24
+ expect(@result.pagination_token).not_to be nil
25
+ expect(@result.sync_token).to be nil
26
+ end
27
+ end
metadata CHANGED
@@ -1,71 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentstack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-08 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 3.2.5
22
+ version: '6.2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ">"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 3.2.5
32
+ version: '6.2'
27
33
  - !ruby/object:Gem::Dependency
28
- name: rspec
34
+ name: contentstack_utils
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
31
40
  - - ">="
32
41
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
42
+ version: 1.0.1
43
+ type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
38
50
  - - ">="
39
51
  - !ruby/object:Gem::Version
40
- version: '0'
52
+ version: 1.0.1
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 3.10.0
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 3.10.0
41
67
  - !ruby/object:Gem::Dependency
42
68
  name: webmock
43
69
  requirement: !ruby/object:Gem::Requirement
44
70
  requirements:
45
- - - ">="
71
+ - - "~>"
46
72
  - !ruby/object:Gem::Version
47
- version: '0'
73
+ version: 3.11.0
48
74
  type: :development
49
75
  prerelease: false
50
76
  version_requirements: !ruby/object:Gem::Requirement
51
77
  requirements:
52
- - - ">="
78
+ - - "~>"
53
79
  - !ruby/object:Gem::Version
54
- version: '0'
80
+ version: 3.11.0
55
81
  - !ruby/object:Gem::Dependency
56
82
  name: simplecov
57
83
  requirement: !ruby/object:Gem::Requirement
58
84
  requirements:
59
- - - ">="
85
+ - - "~>"
60
86
  - !ruby/object:Gem::Version
61
- version: '0'
87
+ version: 0.21.1
62
88
  type: :development
63
89
  prerelease: false
64
90
  version_requirements: !ruby/object:Gem::Requirement
65
91
  requirements:
66
- - - ">="
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: 0.21.1
95
+ - !ruby/object:Gem::Dependency
96
+ name: yard
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: 0.9.26
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
67
107
  - !ruby/object:Gem::Version
68
- version: '0'
108
+ version: 0.9.26
69
109
  description: Contentstack Ruby client for the Content Delivery API
70
110
  email:
71
111
  - support@contentstack.com
@@ -75,6 +115,7 @@ extra_rdoc_files: []
75
115
  files:
76
116
  - ".gitignore"
77
117
  - ".yardopts"
118
+ - CHANGELOG.md
78
119
  - CODE_OF_CONDUCT.md
79
120
  - Gemfile
80
121
  - Gemfile.lock
@@ -84,30 +125,6 @@ files:
84
125
  - coverage/.last_run.json
85
126
  - coverage/.resultset.json
86
127
  - 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
128
  - coverage/index.html
112
129
  - lib/contentstack.rb
113
130
  - lib/contentstack/api.rb
@@ -120,6 +137,7 @@ files:
120
137
  - lib/contentstack/error.rb
121
138
  - lib/contentstack/query.rb
122
139
  - lib/contentstack/region.rb
140
+ - lib/contentstack/sync_result.rb
123
141
  - lib/contentstack/version.rb
124
142
  - lib/util.rb
125
143
  - rakefile.rb
@@ -131,14 +149,17 @@ files:
131
149
  - spec/entry_spec.rb
132
150
  - spec/fixtures/asset.json
133
151
  - spec/fixtures/asset_collection.json
152
+ - spec/fixtures/category_content_type.json
134
153
  - spec/fixtures/category_entry.json
135
154
  - spec/fixtures/category_entry_collection.json
136
155
  - spec/fixtures/category_entry_collection_without_count.json
137
156
  - spec/fixtures/content_types.json
138
157
  - spec/fixtures/product_entry.json
139
158
  - spec/fixtures/product_entry_collection.json
159
+ - spec/fixtures/sync_init.json
140
160
  - spec/query_spec.rb
141
161
  - spec/spec_helper.rb
162
+ - spec/sync_spec.rb
142
163
  homepage: https://github.com/contentstack/contentstack-ruby
143
164
  licenses:
144
165
  - MIT
@@ -158,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
179
  - !ruby/object:Gem::Version
159
180
  version: '0'
160
181
  requirements: []
161
- rubygems_version: 3.1.2
182
+ rubygems_version: 3.0.3
162
183
  signing_key:
163
184
  specification_version: 4
164
185
  summary: Contentstack Ruby client for the Content Delivery API