wcc-contentful 0.3.0 → 1.0.0.pre.rc2
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 +5 -5
- data/.rspec +1 -1
- data/Guardfile +43 -0
- data/README.md +161 -11
- data/Rakefile +3 -6
- data/app/controllers/wcc/contentful/webhook_controller.rb +25 -24
- data/app/jobs/wcc/contentful/webhook_enable_job.rb +36 -2
- data/bin/console +4 -3
- data/bin/rails +2 -0
- data/config/routes.rb +1 -1
- data/doc +1 -0
- data/lib/tasks/download_schema.rake +12 -0
- data/lib/wcc/contentful.rb +69 -45
- data/lib/wcc/contentful/active_record_shim.rb +72 -0
- data/lib/wcc/contentful/configuration.rb +177 -46
- data/lib/wcc/contentful/content_type_indexer.rb +14 -0
- data/lib/wcc/contentful/downloads_schema.rb +112 -0
- data/lib/wcc/contentful/engine.rb +33 -14
- data/lib/wcc/contentful/event.rb +171 -0
- data/lib/wcc/contentful/events.rb +41 -0
- data/lib/wcc/contentful/exceptions.rb +3 -33
- data/lib/wcc/contentful/indexed_representation.rb +2 -2
- data/lib/wcc/contentful/instrumentation.rb +31 -0
- data/lib/wcc/contentful/link.rb +28 -0
- data/lib/wcc/contentful/link_visitor.rb +122 -0
- data/lib/wcc/contentful/middleware.rb +7 -0
- data/lib/wcc/contentful/middleware/store.rb +158 -0
- data/lib/wcc/contentful/middleware/store/caching_middleware.rb +114 -0
- data/lib/wcc/contentful/model.rb +37 -4
- data/lib/wcc/contentful/model_builder.rb +1 -0
- data/lib/wcc/contentful/model_methods.rb +40 -15
- data/lib/wcc/contentful/model_singleton_methods.rb +47 -30
- data/lib/wcc/contentful/rake.rb +4 -0
- data/lib/wcc/contentful/rspec.rb +46 -0
- data/lib/wcc/contentful/services.rb +61 -27
- data/lib/wcc/contentful/simple_client.rb +81 -25
- data/lib/wcc/contentful/simple_client/management.rb +43 -10
- data/lib/wcc/contentful/simple_client/response.rb +61 -22
- data/lib/wcc/contentful/simple_client/typhoeus_adapter.rb +17 -17
- data/lib/wcc/contentful/store.rb +7 -66
- data/lib/wcc/contentful/store/README.md +85 -0
- data/lib/wcc/contentful/store/base.rb +34 -119
- data/lib/wcc/contentful/store/cdn_adapter.rb +71 -12
- data/lib/wcc/contentful/store/factory.rb +186 -0
- data/lib/wcc/contentful/store/instrumentation.rb +55 -0
- data/lib/wcc/contentful/store/interface.rb +82 -0
- data/lib/wcc/contentful/store/memory_store.rb +27 -24
- data/lib/wcc/contentful/store/postgres_store.rb +268 -101
- data/lib/wcc/contentful/store/postgres_store/schema_1.sql +73 -0
- data/lib/wcc/contentful/store/postgres_store/schema_2.sql +21 -0
- data/lib/wcc/contentful/store/query.rb +246 -0
- data/lib/wcc/contentful/store/query/interface.rb +63 -0
- data/lib/wcc/contentful/store/rspec_examples.rb +48 -0
- data/lib/wcc/contentful/store/rspec_examples/basic_store.rb +629 -0
- data/lib/wcc/contentful/store/rspec_examples/include_param.rb +283 -0
- data/lib/wcc/contentful/store/rspec_examples/nested_queries.rb +342 -0
- data/lib/wcc/contentful/sync_engine.rb +181 -0
- data/lib/wcc/contentful/test.rb +7 -0
- data/lib/wcc/contentful/test/attributes.rb +56 -0
- data/lib/wcc/contentful/test/double.rb +76 -0
- data/lib/wcc/contentful/test/factory.rb +101 -0
- data/lib/wcc/contentful/version.rb +1 -1
- data/wcc-contentful.gemspec +28 -14
- metadata +248 -152
- data/.circleci/config.yml +0 -51
- data/.gitignore +0 -26
- data/.rubocop.yml +0 -242
- data/.rubocop_todo.yml +0 -19
- data/.travis.yml +0 -5
- data/CHANGELOG.md +0 -180
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -8
- data/LICENSE.txt +0 -21
- data/app/jobs/wcc/contentful/delayed_sync_job.rb +0 -63
- data/lib/generators/wcc/USAGE +0 -24
- data/lib/generators/wcc/model_generator.rb +0 -90
- data/lib/generators/wcc/templates/.keep +0 -0
- data/lib/generators/wcc/templates/Procfile +0 -3
- data/lib/generators/wcc/templates/contentful_shell_wrapper +0 -385
- data/lib/generators/wcc/templates/menu/generated_add_menus.ts +0 -192
- data/lib/generators/wcc/templates/menu/models/menu.rb +0 -23
- data/lib/generators/wcc/templates/menu/models/menu_button.rb +0 -23
- data/lib/generators/wcc/templates/page/generated_add_pages.ts +0 -50
- data/lib/generators/wcc/templates/page/models/page.rb +0 -23
- data/lib/generators/wcc/templates/release +0 -9
- data/lib/generators/wcc/templates/wcc_contentful.rb +0 -17
- data/lib/wcc/contentful/client_ext.rb +0 -28
- data/lib/wcc/contentful/graphql.rb +0 -14
- data/lib/wcc/contentful/graphql/builder.rb +0 -177
- data/lib/wcc/contentful/graphql/types.rb +0 -54
- data/lib/wcc/contentful/model/dropdown_menu.rb +0 -7
- data/lib/wcc/contentful/model/menu.rb +0 -6
- data/lib/wcc/contentful/model/menu_button.rb +0 -16
- data/lib/wcc/contentful/model/page.rb +0 -8
- data/lib/wcc/contentful/model/redirect.rb +0 -19
- data/lib/wcc/contentful/model_validators.rb +0 -121
- data/lib/wcc/contentful/model_validators/dsl.rb +0 -166
- data/lib/wcc/contentful/simple_client/http_adapter.rb +0 -24
- data/lib/wcc/contentful/store/lazy_cache_store.rb +0 -161
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wcc-contentful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.pre.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Watermark Dev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: byebug
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 11.0.1
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 11.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coveralls
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: dotenv
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,6 +52,20 @@ dependencies:
|
|
24
52
|
- - "~>"
|
25
53
|
- !ruby/object:Gem::Version
|
26
54
|
version: '2.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: erb_lint
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.26
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.0.26
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: httplog
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +86,14 @@ dependencies:
|
|
44
86
|
requirements:
|
45
87
|
- - "~>"
|
46
88
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
89
|
+
version: '13.0'
|
48
90
|
type: :development
|
49
91
|
prerelease: false
|
50
92
|
version_requirements: !ruby/object:Gem::Requirement
|
51
93
|
requirements:
|
52
94
|
- - "~>"
|
53
95
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
96
|
+
version: '13.0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: rspec
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,48 +108,76 @@ dependencies:
|
|
66
108
|
- - "~>"
|
67
109
|
- !ruby/object:Gem::Version
|
68
110
|
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-instrumentation-matcher
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: rspec_junit_formatter
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
72
128
|
requirements:
|
73
129
|
- - "~>"
|
74
130
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
131
|
+
version: 0.4.1
|
76
132
|
type: :development
|
77
133
|
prerelease: false
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
79
135
|
requirements:
|
80
136
|
- - "~>"
|
81
137
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
138
|
+
version: 0.4.1
|
83
139
|
- !ruby/object:Gem::Dependency
|
84
140
|
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.68'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.68'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
85
155
|
requirement: !ruby/object:Gem::Requirement
|
86
156
|
requirements:
|
87
157
|
- - "~>"
|
88
158
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
159
|
+
version: 0.16.1
|
90
160
|
type: :development
|
91
161
|
prerelease: false
|
92
162
|
version_requirements: !ruby/object:Gem::Requirement
|
93
163
|
requirements:
|
94
164
|
- - "~>"
|
95
165
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
166
|
+
version: 0.16.1
|
97
167
|
- !ruby/object:Gem::Dependency
|
98
168
|
name: vcr
|
99
169
|
requirement: !ruby/object:Gem::Requirement
|
100
170
|
requirements:
|
101
171
|
- - "~>"
|
102
172
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
173
|
+
version: '5.0'
|
104
174
|
type: :development
|
105
175
|
prerelease: false
|
106
176
|
version_requirements: !ruby/object:Gem::Requirement
|
107
177
|
requirements:
|
108
178
|
- - "~>"
|
109
179
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
180
|
+
version: '5.0'
|
111
181
|
- !ruby/object:Gem::Dependency
|
112
182
|
name: webmock
|
113
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +192,20 @@ dependencies:
|
|
122
192
|
- - "~>"
|
123
193
|
- !ruby/object:Gem::Version
|
124
194
|
version: '3.0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: wisper-rspec
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
125
209
|
- !ruby/object:Gem::Dependency
|
126
210
|
name: guard
|
127
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,61 +249,47 @@ dependencies:
|
|
165
249
|
- !ruby/object:Gem::Version
|
166
250
|
version: 1.3.0
|
167
251
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
252
|
+
name: guard-shell
|
169
253
|
requirement: !ruby/object:Gem::Requirement
|
170
254
|
requirements:
|
171
255
|
- - "~>"
|
172
256
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
257
|
+
version: 0.7.1
|
174
258
|
type: :development
|
175
259
|
prerelease: false
|
176
260
|
version_requirements: !ruby/object:Gem::Requirement
|
177
261
|
requirements:
|
178
262
|
- - "~>"
|
179
263
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
264
|
+
version: 0.7.1
|
181
265
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
266
|
+
name: generator_spec
|
183
267
|
requirement: !ruby/object:Gem::Requirement
|
184
268
|
requirements:
|
185
269
|
- - "~>"
|
186
270
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
271
|
+
version: 0.9.4
|
188
272
|
type: :development
|
189
273
|
prerelease: false
|
190
274
|
version_requirements: !ruby/object:Gem::Requirement
|
191
275
|
requirements:
|
192
276
|
- - "~>"
|
193
277
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
278
|
+
version: 0.9.4
|
195
279
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
280
|
+
name: sqlite3
|
197
281
|
requirement: !ruby/object:Gem::Requirement
|
198
282
|
requirements:
|
199
283
|
- - "~>"
|
200
284
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
285
|
+
version: 1.3.6
|
202
286
|
type: :development
|
203
287
|
prerelease: false
|
204
288
|
version_requirements: !ruby/object:Gem::Requirement
|
205
289
|
requirements:
|
206
290
|
- - "~>"
|
207
291
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: sqlite3
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
292
|
+
version: 1.3.6
|
223
293
|
- !ruby/object:Gem::Dependency
|
224
294
|
name: timecop
|
225
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,47 +305,33 @@ dependencies:
|
|
235
305
|
- !ruby/object:Gem::Version
|
236
306
|
version: 0.9.1
|
237
307
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
308
|
+
name: connection_pool
|
239
309
|
requirement: !ruby/object:Gem::Requirement
|
240
310
|
requirements:
|
241
|
-
- -
|
242
|
-
- !ruby/object:Gem::Version
|
243
|
-
version: 2.6.0
|
244
|
-
type: :development
|
245
|
-
prerelease: false
|
246
|
-
version_requirements: !ruby/object:Gem::Requirement
|
247
|
-
requirements:
|
248
|
-
- - '='
|
249
|
-
- !ruby/object:Gem::Version
|
250
|
-
version: 2.6.0
|
251
|
-
- !ruby/object:Gem::Dependency
|
252
|
-
name: contentful-management
|
253
|
-
requirement: !ruby/object:Gem::Requirement
|
254
|
-
requirements:
|
255
|
-
- - '='
|
311
|
+
- - "~>"
|
256
312
|
- !ruby/object:Gem::Version
|
257
|
-
version: 2.
|
313
|
+
version: '2.2'
|
258
314
|
type: :development
|
259
315
|
prerelease: false
|
260
316
|
version_requirements: !ruby/object:Gem::Requirement
|
261
317
|
requirements:
|
262
|
-
- -
|
318
|
+
- - "~>"
|
263
319
|
- !ruby/object:Gem::Version
|
264
|
-
version: 2.
|
320
|
+
version: '2.2'
|
265
321
|
- !ruby/object:Gem::Dependency
|
266
|
-
name:
|
322
|
+
name: faraday
|
267
323
|
requirement: !ruby/object:Gem::Requirement
|
268
324
|
requirements:
|
269
325
|
- - "~>"
|
270
326
|
- !ruby/object:Gem::Version
|
271
|
-
version: '
|
327
|
+
version: '0.9'
|
272
328
|
type: :development
|
273
329
|
prerelease: false
|
274
330
|
version_requirements: !ruby/object:Gem::Requirement
|
275
331
|
requirements:
|
276
332
|
- - "~>"
|
277
333
|
- !ruby/object:Gem::Version
|
278
|
-
version: '
|
334
|
+
version: '0.9'
|
279
335
|
- !ruby/object:Gem::Dependency
|
280
336
|
name: http
|
281
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -339,56 +395,46 @@ dependencies:
|
|
339
395
|
- !ruby/object:Gem::Version
|
340
396
|
version: '5'
|
341
397
|
- !ruby/object:Gem::Dependency
|
342
|
-
name:
|
398
|
+
name: wcc-base
|
343
399
|
requirement: !ruby/object:Gem::Requirement
|
344
400
|
requirements:
|
345
401
|
- - "~>"
|
346
402
|
- !ruby/object:Gem::Version
|
347
|
-
version: 0.
|
403
|
+
version: 0.3.1
|
348
404
|
type: :runtime
|
349
405
|
prerelease: false
|
350
406
|
version_requirements: !ruby/object:Gem::Requirement
|
351
407
|
requirements:
|
352
408
|
- - "~>"
|
353
409
|
- !ruby/object:Gem::Version
|
354
|
-
version: 0.
|
410
|
+
version: 0.3.1
|
355
411
|
- !ruby/object:Gem::Dependency
|
356
|
-
name:
|
412
|
+
name: wisper
|
357
413
|
requirement: !ruby/object:Gem::Requirement
|
358
414
|
requirements:
|
359
415
|
- - "~>"
|
360
416
|
- !ruby/object:Gem::Version
|
361
|
-
version: 0.
|
417
|
+
version: 2.0.0
|
362
418
|
type: :runtime
|
363
419
|
prerelease: false
|
364
420
|
version_requirements: !ruby/object:Gem::Requirement
|
365
421
|
requirements:
|
366
422
|
- - "~>"
|
367
423
|
- !ruby/object:Gem::Version
|
368
|
-
version: 0.
|
369
|
-
description: Contentful API wrapper library
|
424
|
+
version: 2.0.0
|
425
|
+
description: Contentful API wrapper library exposing an ActiveRecord-like interface
|
370
426
|
email:
|
371
427
|
- dev@watermark.org
|
372
428
|
executables: []
|
373
429
|
extensions: []
|
374
430
|
extra_rdoc_files: []
|
375
431
|
files:
|
376
|
-
- ".circleci/config.yml"
|
377
|
-
- ".gitignore"
|
378
432
|
- ".rspec"
|
379
|
-
- ".rubocop.yml"
|
380
|
-
- ".rubocop_todo.yml"
|
381
|
-
- ".travis.yml"
|
382
|
-
- CHANGELOG.md
|
383
|
-
- CODE_OF_CONDUCT.md
|
384
|
-
- Gemfile
|
385
433
|
- Guardfile
|
386
|
-
- LICENSE.txt
|
387
434
|
- README.md
|
388
435
|
- Rakefile
|
389
436
|
- app/controllers/wcc/contentful/application_controller.rb
|
390
437
|
- app/controllers/wcc/contentful/webhook_controller.rb
|
391
|
-
- app/jobs/wcc/contentful/delayed_sync_job.rb
|
392
438
|
- app/jobs/wcc/contentful/webhook_enable_job.rb
|
393
439
|
- bin/console
|
394
440
|
- bin/rails
|
@@ -396,61 +442,68 @@ files:
|
|
396
442
|
- bin/setup
|
397
443
|
- config/initializers/mime_types.rb
|
398
444
|
- config/routes.rb
|
399
|
-
-
|
400
|
-
- lib/
|
401
|
-
- lib/generators/wcc/templates/.keep
|
402
|
-
- lib/generators/wcc/templates/Procfile
|
403
|
-
- lib/generators/wcc/templates/contentful_shell_wrapper
|
404
|
-
- lib/generators/wcc/templates/menu/generated_add_menus.ts
|
405
|
-
- lib/generators/wcc/templates/menu/models/menu.rb
|
406
|
-
- lib/generators/wcc/templates/menu/models/menu_button.rb
|
407
|
-
- lib/generators/wcc/templates/page/generated_add_pages.ts
|
408
|
-
- lib/generators/wcc/templates/page/models/page.rb
|
409
|
-
- lib/generators/wcc/templates/release
|
410
|
-
- lib/generators/wcc/templates/wcc_contentful.rb
|
445
|
+
- doc
|
446
|
+
- lib/tasks/download_schema.rake
|
411
447
|
- lib/wcc/contentful.rb
|
412
|
-
- lib/wcc/contentful/
|
448
|
+
- lib/wcc/contentful/active_record_shim.rb
|
413
449
|
- lib/wcc/contentful/configuration.rb
|
414
450
|
- lib/wcc/contentful/content_type_indexer.rb
|
451
|
+
- lib/wcc/contentful/downloads_schema.rb
|
415
452
|
- lib/wcc/contentful/engine.rb
|
453
|
+
- lib/wcc/contentful/event.rb
|
454
|
+
- lib/wcc/contentful/events.rb
|
416
455
|
- lib/wcc/contentful/exceptions.rb
|
417
|
-
- lib/wcc/contentful/graphql.rb
|
418
|
-
- lib/wcc/contentful/graphql/builder.rb
|
419
|
-
- lib/wcc/contentful/graphql/types.rb
|
420
456
|
- lib/wcc/contentful/helpers.rb
|
421
457
|
- lib/wcc/contentful/indexed_representation.rb
|
458
|
+
- lib/wcc/contentful/instrumentation.rb
|
459
|
+
- lib/wcc/contentful/link.rb
|
460
|
+
- lib/wcc/contentful/link_visitor.rb
|
461
|
+
- lib/wcc/contentful/middleware.rb
|
462
|
+
- lib/wcc/contentful/middleware/store.rb
|
463
|
+
- lib/wcc/contentful/middleware/store/caching_middleware.rb
|
422
464
|
- lib/wcc/contentful/model.rb
|
423
|
-
- lib/wcc/contentful/model/dropdown_menu.rb
|
424
|
-
- lib/wcc/contentful/model/menu.rb
|
425
|
-
- lib/wcc/contentful/model/menu_button.rb
|
426
|
-
- lib/wcc/contentful/model/page.rb
|
427
|
-
- lib/wcc/contentful/model/redirect.rb
|
428
465
|
- lib/wcc/contentful/model_builder.rb
|
429
466
|
- lib/wcc/contentful/model_methods.rb
|
430
467
|
- lib/wcc/contentful/model_singleton_methods.rb
|
431
|
-
- lib/wcc/contentful/model_validators.rb
|
432
|
-
- lib/wcc/contentful/model_validators/dsl.rb
|
433
468
|
- lib/wcc/contentful/rails.rb
|
469
|
+
- lib/wcc/contentful/rake.rb
|
470
|
+
- lib/wcc/contentful/rspec.rb
|
434
471
|
- lib/wcc/contentful/services.rb
|
435
472
|
- lib/wcc/contentful/simple_client.rb
|
436
|
-
- lib/wcc/contentful/simple_client/http_adapter.rb
|
437
473
|
- lib/wcc/contentful/simple_client/management.rb
|
438
474
|
- lib/wcc/contentful/simple_client/response.rb
|
439
475
|
- lib/wcc/contentful/simple_client/typhoeus_adapter.rb
|
440
476
|
- lib/wcc/contentful/store.rb
|
477
|
+
- lib/wcc/contentful/store/README.md
|
441
478
|
- lib/wcc/contentful/store/base.rb
|
442
479
|
- lib/wcc/contentful/store/cdn_adapter.rb
|
443
|
-
- lib/wcc/contentful/store/
|
480
|
+
- lib/wcc/contentful/store/factory.rb
|
481
|
+
- lib/wcc/contentful/store/instrumentation.rb
|
482
|
+
- lib/wcc/contentful/store/interface.rb
|
444
483
|
- lib/wcc/contentful/store/memory_store.rb
|
445
484
|
- lib/wcc/contentful/store/postgres_store.rb
|
485
|
+
- lib/wcc/contentful/store/postgres_store/schema_1.sql
|
486
|
+
- lib/wcc/contentful/store/postgres_store/schema_2.sql
|
487
|
+
- lib/wcc/contentful/store/query.rb
|
488
|
+
- lib/wcc/contentful/store/query/interface.rb
|
489
|
+
- lib/wcc/contentful/store/rspec_examples.rb
|
490
|
+
- lib/wcc/contentful/store/rspec_examples/basic_store.rb
|
491
|
+
- lib/wcc/contentful/store/rspec_examples/include_param.rb
|
492
|
+
- lib/wcc/contentful/store/rspec_examples/nested_queries.rb
|
493
|
+
- lib/wcc/contentful/sync_engine.rb
|
446
494
|
- lib/wcc/contentful/sys.rb
|
495
|
+
- lib/wcc/contentful/test.rb
|
496
|
+
- lib/wcc/contentful/test/attributes.rb
|
497
|
+
- lib/wcc/contentful/test/double.rb
|
498
|
+
- lib/wcc/contentful/test/factory.rb
|
447
499
|
- lib/wcc/contentful/version.rb
|
448
500
|
- wcc-contentful.gemspec
|
449
|
-
homepage: https://github.com/watermarkchurch/wcc-contentful
|
501
|
+
homepage: https://github.com/watermarkchurch/wcc-contentful/wcc-contentful
|
450
502
|
licenses:
|
451
503
|
- MIT
|
452
|
-
metadata:
|
453
|
-
|
504
|
+
metadata:
|
505
|
+
documentation_uri: https://watermarkchurch.github.io/wcc-contentful/1.0/wcc-contentful
|
506
|
+
post_install_message:
|
454
507
|
rdoc_options: []
|
455
508
|
require_paths:
|
456
509
|
- lib
|
@@ -461,34 +514,37 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
461
514
|
version: '2.3'
|
462
515
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
463
516
|
requirements:
|
464
|
-
- - "
|
517
|
+
- - ">"
|
465
518
|
- !ruby/object:Gem::Version
|
466
|
-
version:
|
519
|
+
version: 1.3.1
|
467
520
|
requirements: []
|
468
|
-
rubyforge_project:
|
469
|
-
rubygems_version: 2.
|
470
|
-
signing_key:
|
521
|
+
rubyforge_project:
|
522
|
+
rubygems_version: 2.7.6.2
|
523
|
+
signing_key:
|
471
524
|
specification_version: 4
|
472
|
-
summary: '[](https://
|
473
|
-
[](https://rubygems.org/gems/wcc-contentful)
|
526
|
+
[](https://travis-ci.org/watermarkchurch/wcc-contentful)
|
527
|
+
[](https://coveralls.io/github/watermarkchurch/wcc-contentful?branch=master) Full
|
528
|
+
documentation: https://www.rubydoc.info/gems/wcc-contentful # WCC::Contentful ##
|
529
|
+
Installation Add this line to your application''s Gemfile: ```ruby gem ''wcc-contentful'',
|
530
|
+
require: ''wcc/contentful/rails'' ``` If you''re not using rails, exclude the `require:`
|
531
|
+
parameter. ```ruby gem ''wcc-contentful'' ``` And then execute: ``` $ bundle ```
|
532
|
+
Or install it yourself as: ``` $ gem install wcc-contentful ``` ## Configure Put
|
533
|
+
this in an initializer: ```ruby # config/initializers/wcc_contentful.rb WCC::Contentful.configure
|
534
|
+
do |config| config.access_token = <CONTENTFUL_ACCESS_TOKEN> config.space = <CONTENTFUL_SPACE_ID>
|
535
|
+
end WCC::Contentful.init! ``` All configuration options can be found [in the rubydoc](https://www.rubydoc.info/gems/wcc-contentful/WCC/Contentful/Configuration)
|
536
|
+
under {WCC::Contentful::Configuration} ## Usage ### WCC::Contentful::Model API The
|
537
|
+
WCC::Contentful::Model API exposes Contentful data as a set of dynamically generated
|
538
|
+
Ruby objects. These objects are based on the content types in your Contentful space. All
|
539
|
+
these objects are generated by `WCC::Contentful.init!` The following examples show
|
540
|
+
how to use this API to find entries of the `page` content type: ```ruby # Find
|
541
|
+
objects by id WCC::Contentful::Model::Page.find(''1E2ucWSdacxxf233sfa3'') # => #<WCC::Contentful::Model::Page:0x0000000005c71a78
|
542
|
+
@created_at=2018-04-16 18:41:17 UTC...> # Find objects by field WCC::Contentful::Model::Page.find_by(slug:
|
543
|
+
''/some-slug'') # => #<WCC::Contentful::Model::Page:0x0000000005c71a78 @created_at=2018-04-16
|
544
|
+
18:41:17 UTC...> # Use operators to filter by a field # must use full notation
|
545
|
+
for sys attributes (except ID) WCC::Contentful::Model::Page.find_all(''sys.created_at''
|
546
|
+
=> { lte: Date.today }) # => [#<WCC::Contentful::Model::Page:0x0000000005c71a78
|
547
|
+
@created_at=2018-04-16 18:41:17 UTC...>, ... ] # Nest queries to mimick joins WCC::Contentful::Model::Page.find_by(subpages:
|
492
548
|
{ slug: ''/some-slug'' }) # => #<WCC::Contentful::Model::Page:0x0000000005c71a78
|
493
549
|
@created_at=2018-04-16 18:41:17 UTC...> # Pass the preview flag to use the preview
|
494
550
|
client (must have set preview_token config param) preview_redirect = WCC::Contentful::Model::Redirect.find_by({
|
@@ -521,32 +577,72 @@ summary: '[](https://
|
|
521
577
|
# {"sys"=> ...} # "6Fwukxxkxa6qQCC04WCaqg"=> # {"sys"=> ...} # ...} ``` The
|
522
578
|
client handles Paging automatically within the lazy iterator returned by #items.
|
523
579
|
This lazy iterator does not respect the `limit` param - that param is only passed
|
524
|
-
through to the API to set the page size.
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
of the
|
580
|
+
through to the API to set the page size. If you truly want a limited subset of
|
581
|
+
response items, use [`response.items.take(n)`](https://ruby-doc.org/core-2.5.3/Enumerable.html#method-i-take) Entries
|
582
|
+
included via the `include` parameter are made available on the #includes field. This
|
583
|
+
is a hash of `<entry ID> => <raw entry>` and makes it easy to grab links. This
|
584
|
+
hash is added to lazily as you enumerate the pages. See the {WCC::Contentful::SimpleClient}
|
585
|
+
documentation for more details. ### Accessing the APIs within application code The
|
586
|
+
Model API is best exposed by defining your own model classes in the `app/models`
|
587
|
+
directory which inherit from the WCC::Contentful models. ```ruby # app/models/page.rb
|
588
|
+
class Page < WCC::Contentful::Model::Page # You can add additional methods here
|
589
|
+
end # app/controllers/pages_controller.rb class PagesController < ApplicationController
|
590
|
+
def show @page = Page.find_by(slug: params[:slug]) raise Exceptions::PageNotFoundError,
|
591
|
+
params[:slug] unless @page end end ``` The {WCC::Contentful::Services} singleton
|
592
|
+
gives access to the other configured services. You can also include the {WCC::Contentful::ServiceAccessors}
|
593
|
+
concern to define these services as attributes in a class. ```ruby class MyJob
|
594
|
+
< ApplicationJob include WCC::Contentful::ServiceAccessors def perform Page.find(...) store.find(...) client.entries(...)
|
595
|
+
end end ``` ## Architecture  ##
|
596
|
+
Test Helpers To use the test helpers, include the following in your rails_helper.rb: ```ruby
|
597
|
+
require ''wcc/contentful/rspec'' ``` This adds the following helpers to all your
|
598
|
+
specs: ```ruby ## # Builds a in-memory instance of the Contentful model for the
|
599
|
+
given content_type. # All attributes that are known to be required fields on the
|
600
|
+
content type # will return a default value based on the field type. instance = contentful_create(''my-content-type'',
|
601
|
+
my_field: ''some-value'') # => #<WCC::Contentful::Model::MyContentType:0x0000000005c71a78
|
602
|
+
@created_at=2018-04-16 18:41:17 UTC...> instance.my_field # => "some-value" instance.other_required_field
|
603
|
+
# => "default-value" instance.other_optional_field # => nil instance.not_a_field
|
604
|
+
# NoMethodError: undefined method `not_a_field'' for #<MyContentType:0x00007fbac81ee490> ##
|
605
|
+
# Builds a rspec double of the Contentful model for the given content_type. # All
|
606
|
+
attributes that are known to be required fields on the content type # will return
|
607
|
+
a default value based on the field type. dbl = contentful_double(''my-content-type'',
|
608
|
+
my_field: ''other-value'') # => #<Double (anonymous)> dbl.my_field # => "other-value" dbl.other_optional_field
|
609
|
+
# => nil dbl.not_a_field # => #<Double (anonymous)> received unexpected message
|
610
|
+
:not_a_field with (no args) ## # Builds out a fake Contentful entry for the given
|
611
|
+
content type, and then # stubs the Model API to return that content type for `.find`
|
612
|
+
and `.find_by` # query methods. stubbed = contentful_stub(''my-content-type'', id:
|
613
|
+
''1234'', my_field: ''test'') WCC::Contentful::Model.find(''1234'') == stubbed
|
614
|
+
# => true MyContentType.find(''1234'') == stubbed # => true MyContentType.find_by(my_field:
|
615
|
+
''test'') == stubbed # => true ``` ## Advanced Configuration Example Here''s an
|
616
|
+
example containing all the configuration options, and a sample setup for automatic
|
617
|
+
deployment to Heroku. This is intended to make you aware of what is possible, and
|
618
|
+
not as a general recommendation of what your setup should look like. ```ruby #
|
619
|
+
config/initializers/wcc_contentful.rb WCC::Contentful.configure do |config| config.access_token
|
620
|
+
= ENV[''CONTENTFUL_ACCESS_TOKEN''] config.space = ENV[''CONTENTFUL_SPACE_ID''] config.environment
|
621
|
+
= ENV[''CONTENTFUL_ENVIRONMENT''] config.preview_token = ENV[''CONTENTFUL_PREVIEW_ACCESS_TOKEN''] #
|
622
|
+
You may or may not want to provide this to your production server... config.management_token
|
623
|
+
= ENV[''CONTENTFUL_MANAGEMENT_TOKEN''] unless Rails.env.production? config.app_url
|
624
|
+
= "https://#{ENV[''HOSTNAME'']}" config.webhook_username = ''my-app-webhook'' config.webhook_password
|
625
|
+
= Rails.application.secrets.webhook_password config.webhook_jobs << MyOnWebhookJob config.store
|
626
|
+
= :lazy_sync, Rails.cache if Rails.env.production? # config.store = MyCustomStore.new #
|
627
|
+
Use a custom Faraday connection config.connection = Faraday.new do |builder| f.request
|
628
|
+
:retry f.request MyFaradayRequestAdapter.new ... end # OR implement some adapter
|
629
|
+
like this to use another HTTP client config.connection = MyNetHttpAdapter.new config.update_schema_file
|
630
|
+
= :never end WCC::Contentful.init! ``` For Heroku: ```yaml # Procfile web: bundle
|
631
|
+
exec rails s worker: bundle exec sidekiq release: bin/release ``` ```sh # bin/release
|
632
|
+
#!/bin/sh set -e echo "Migrating database..." bin/rake db:migrate echo "Migrating
|
633
|
+
contentful..." migrations_to_be_run=$( ... ) # somehow figure this out node_modules/.bin/contentful-migration
|
634
|
+
\ -s $CONTENTFUL_SPACE_ID -a $CONTENTFUL_MANAGEMENT_TOKEN \ -y -p "$migrations_to_be_run" echo
|
635
|
+
"Updating schema file..." rake wcc_contentful:download_schema ``` All configuration
|
636
|
+
options can be found [in the rubydoc](https://www.rubydoc.info/gems/wcc-contentful/WCC/Contentful/Configuration)
|
637
|
+
under {WCC::Contentful::Configuration} ## Development After checking out the
|
638
|
+
repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to
|
639
|
+
run the tests. You can also run `bin/console` for an interactive prompt that will
|
640
|
+
allow you to experiment. ## Contributing Bug reports and pull requests are welcome
|
641
|
+
on GitHub at https://github.com/watermarkchurch/wcc-contentful. This project is
|
642
|
+
intended to be a safe, welcoming space for collaboration, and contributors are expected
|
643
|
+
to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
644
|
+
conduct. ## License The gem is available as open source under the terms of the
|
645
|
+
[MIT License](http://opensource.org/licenses/MIT). ## Code of Conduct Everyone
|
550
646
|
interacting in the WCC::Contentful project''s codebases, issue trackers, chat rooms
|
551
647
|
and mailing lists is expected to follow the [code of conduct](https://github.com/watermarkchurch/wcc-contentful/blob/master/CODE_OF_CONDUCT.md).'
|
552
648
|
test_files: []
|