contentstack 0.0.4 → 0.4.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.
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(access_token = ENV['ACCESS_TOKEN'], api_key = ENV['API_KEY'], environment = ENV['STACK_ENV'], options = {})
152
- Contentstack::Client.new(access_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,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Contentstack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-03 00:00:00.000000000 Z
11
+ date: 2021-04-06 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
18
  - !ruby/object:Gem::Version
19
- version: 3.2.5
19
+ version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">"
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.5
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: contentstack_utils
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ">="
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: 3.10.0
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ">="
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: 3.10.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: webmock
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ">="
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: 3.11.0
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ">="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: 3.11.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: simplecov
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.21.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.21.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
60
88
  - !ruby/object:Gem::Version
61
- version: '0'
89
+ version: 0.9.26
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - ">="
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
- version: '0'
96
+ version: 0.9.26
69
97
  description: Contentstack Ruby client for the Content Delivery API
70
98
  email:
71
99
  - support@contentstack.com
@@ -75,37 +103,16 @@ extra_rdoc_files: []
75
103
  files:
76
104
  - ".gitignore"
77
105
  - ".yardopts"
106
+ - CHANGELOG.md
78
107
  - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - Gemfile.lock
79
110
  - LICENSE.txt
80
111
  - README.md
81
112
  - contentstack.gemspec
82
113
  - coverage/.last_run.json
83
114
  - coverage/.resultset.json
84
115
  - coverage/.resultset.json.lock
85
- - coverage/assets/0.10.2/application.css
86
- - coverage/assets/0.10.2/application.js
87
- - coverage/assets/0.10.2/colorbox/border.png
88
- - coverage/assets/0.10.2/colorbox/controls.png
89
- - coverage/assets/0.10.2/colorbox/loading.gif
90
- - coverage/assets/0.10.2/colorbox/loading_background.png
91
- - coverage/assets/0.10.2/favicon_green.png
92
- - coverage/assets/0.10.2/favicon_red.png
93
- - coverage/assets/0.10.2/favicon_yellow.png
94
- - coverage/assets/0.10.2/loading.gif
95
- - coverage/assets/0.10.2/magnify.png
96
- - coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
97
- - coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
98
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
99
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
100
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png
101
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
102
- - coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
103
- - coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
104
- - coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png
105
- - coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png
106
- - coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png
107
- - coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png
108
- - coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png
109
116
  - coverage/index.html
110
117
  - lib/contentstack.rb
111
118
  - lib/contentstack/api.rb
@@ -118,6 +125,7 @@ files:
118
125
  - lib/contentstack/error.rb
119
126
  - lib/contentstack/query.rb
120
127
  - lib/contentstack/region.rb
128
+ - lib/contentstack/sync_result.rb
121
129
  - lib/contentstack/version.rb
122
130
  - lib/util.rb
123
131
  - rakefile.rb
@@ -129,15 +137,18 @@ files:
129
137
  - spec/entry_spec.rb
130
138
  - spec/fixtures/asset.json
131
139
  - spec/fixtures/asset_collection.json
140
+ - spec/fixtures/category_content_type.json
132
141
  - spec/fixtures/category_entry.json
133
142
  - spec/fixtures/category_entry_collection.json
134
143
  - spec/fixtures/category_entry_collection_without_count.json
135
144
  - spec/fixtures/content_types.json
136
145
  - spec/fixtures/product_entry.json
137
146
  - spec/fixtures/product_entry_collection.json
147
+ - spec/fixtures/sync_init.json
138
148
  - spec/query_spec.rb
139
149
  - spec/spec_helper.rb
140
- homepage: https://github.com/builtio-contentstack/contentstack-ruby
150
+ - spec/sync_spec.rb
151
+ homepage: https://github.com/contentstack/contentstack-ruby
141
152
  licenses:
142
153
  - MIT
143
154
  metadata: {}
@@ -156,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
167
  - !ruby/object:Gem::Version
157
168
  version: '0'
158
169
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.5.2.3
170
+ rubygems_version: 3.0.3
161
171
  signing_key:
162
172
  specification_version: 4
163
173
  summary: Contentstack Ruby client for the Content Delivery API