contentstack 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +6 -0
- data/LICENSE.txt +1 -1
- data/README.md +87 -24
- data/lib/contentstack/api.rb +5 -0
- data/lib/contentstack/client.rb +24 -2
- data/lib/contentstack/sync_result.rb +30 -0
- data/lib/contentstack/version.rb +1 -1
- data/spec/fixtures/sync_init.json +2975 -0
- data/spec/spec_helper.rb +7 -2
- data/spec/sync_spec.rb +27 -0
- metadata +9 -6
data/spec/spec_helper.rb
CHANGED
@@ -150,9 +150,14 @@ RSpec.configure do |config|
|
|
150
150
|
stub_request(:get, /cdn.contentstack.io\/v3\/content_types\/category\/entries\/blt05056a2f5e0ebf76/).
|
151
151
|
with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
|
152
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
|
+
|
153
158
|
end
|
154
159
|
|
155
|
-
def create_client(delivery_token = ENV['
|
156
|
-
Contentstack::Client.new(
|
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)
|
157
162
|
end
|
158
163
|
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,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.3.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:
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/contentstack/error.rb
|
98
98
|
- lib/contentstack/query.rb
|
99
99
|
- lib/contentstack/region.rb
|
100
|
+
- lib/contentstack/sync_result.rb
|
100
101
|
- lib/contentstack/version.rb
|
101
102
|
- lib/util.rb
|
102
103
|
- rakefile.rb
|
@@ -115,13 +116,15 @@ files:
|
|
115
116
|
- spec/fixtures/content_types.json
|
116
117
|
- spec/fixtures/product_entry.json
|
117
118
|
- spec/fixtures/product_entry_collection.json
|
119
|
+
- spec/fixtures/sync_init.json
|
118
120
|
- spec/query_spec.rb
|
119
121
|
- spec/spec_helper.rb
|
122
|
+
- spec/sync_spec.rb
|
120
123
|
homepage: https://github.com/contentstack/contentstack-ruby
|
121
124
|
licenses:
|
122
125
|
- MIT
|
123
126
|
metadata: {}
|
124
|
-
post_install_message:
|
127
|
+
post_install_message:
|
125
128
|
rdoc_options: []
|
126
129
|
require_paths:
|
127
130
|
- lib
|
@@ -136,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
139
|
- !ruby/object:Gem::Version
|
137
140
|
version: '0'
|
138
141
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
140
|
-
signing_key:
|
142
|
+
rubygems_version: 3.0.3
|
143
|
+
signing_key:
|
141
144
|
specification_version: 4
|
142
145
|
summary: Contentstack Ruby client for the Content Delivery API
|
143
146
|
test_files: []
|