wcc-contentful 1.1.1 → 1.2.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.
- checksums.yaml +4 -4
- data/app/controllers/wcc/contentful/webhook_controller.rb +2 -0
- data/app/jobs/wcc/contentful/webhook_enable_job.rb +1 -1
- data/lib/tasks/download_schema.rake +1 -1
- data/lib/wcc/contentful/active_record_shim.rb +2 -2
- data/lib/wcc/contentful/configuration.rb +31 -18
- data/lib/wcc/contentful/content_type_indexer.rb +2 -0
- data/lib/wcc/contentful/downloads_schema.rb +5 -4
- data/lib/wcc/contentful/engine.rb +2 -4
- data/lib/wcc/contentful/event.rb +4 -11
- data/lib/wcc/contentful/exceptions.rb +2 -3
- data/lib/wcc/contentful/indexed_representation.rb +3 -6
- data/lib/wcc/contentful/instrumentation.rb +2 -1
- data/lib/wcc/contentful/link.rb +1 -3
- data/lib/wcc/contentful/link_visitor.rb +2 -4
- data/lib/wcc/contentful/middleware/store/caching_middleware.rb +5 -9
- data/lib/wcc/contentful/middleware/store.rb +4 -6
- data/lib/wcc/contentful/model.rb +0 -6
- data/lib/wcc/contentful/model_api.rb +17 -12
- data/lib/wcc/contentful/model_builder.rb +8 -4
- data/lib/wcc/contentful/model_methods.rb +10 -12
- data/lib/wcc/contentful/model_singleton_methods.rb +4 -4
- data/lib/wcc/contentful/rich_text/node.rb +60 -0
- data/lib/wcc/contentful/rich_text.rb +105 -0
- data/lib/wcc/contentful/rspec.rb +1 -3
- data/lib/wcc/contentful/simple_client/response.rb +28 -34
- data/lib/wcc/contentful/simple_client.rb +11 -14
- data/lib/wcc/contentful/store/base.rb +5 -5
- data/lib/wcc/contentful/store/cdn_adapter.rb +11 -7
- data/lib/wcc/contentful/store/factory.rb +1 -1
- data/lib/wcc/contentful/store/memory_store.rb +2 -2
- data/lib/wcc/contentful/store/postgres_store.rb +15 -22
- data/lib/wcc/contentful/store/query.rb +2 -2
- data/lib/wcc/contentful/store/rspec_examples/include_param.rb +6 -4
- data/lib/wcc/contentful/store/rspec_examples/operators.rb +1 -1
- data/lib/wcc/contentful/sync_engine.rb +31 -15
- data/lib/wcc/contentful/sys.rb +2 -1
- data/lib/wcc/contentful/test/double.rb +3 -5
- data/lib/wcc/contentful/test/factory.rb +4 -6
- data/lib/wcc/contentful/version.rb +1 -1
- data/lib/wcc/contentful.rb +6 -8
- data/wcc-contentful.gemspec +6 -6
- metadata +13 -25
data/lib/wcc/contentful/sys.rb
CHANGED
@@ -11,7 +11,7 @@ WCC::Contentful::Sys =
|
|
11
11
|
:revision,
|
12
12
|
:context
|
13
13
|
) do
|
14
|
-
|
14
|
+
# rubocop:disable Lint/ConstantDefinitionInBlock
|
15
15
|
ATTRIBUTES = %i[
|
16
16
|
id
|
17
17
|
type
|
@@ -22,6 +22,7 @@ WCC::Contentful::Sys =
|
|
22
22
|
revision
|
23
23
|
context
|
24
24
|
].freeze
|
25
|
+
# rubocop:enable Lint/ConstantDefinitionInBlock
|
25
26
|
|
26
27
|
undef []=
|
27
28
|
ATTRIBUTES.each { |a| __send__(:undef_method, "#{a}=") }
|
@@ -8,9 +8,7 @@ module WCC::Contentful::Test::Double
|
|
8
8
|
# All attributes that are known to be required fields on the content type
|
9
9
|
# will return a default value based on the field type.
|
10
10
|
def contentful_double(const, **attrs)
|
11
|
-
unless const.respond_to?(:content_type_definition)
|
12
|
-
const = WCC::Contentful::Model.resolve_constant(const.to_s)
|
13
|
-
end
|
11
|
+
const = WCC::Contentful::Model.resolve_constant(const.to_s) unless const.respond_to?(:content_type_definition)
|
14
12
|
attrs.symbolize_keys!
|
15
13
|
|
16
14
|
bad_attrs = attrs.reject { |a| const.instance_methods.include?(a) }
|
@@ -45,7 +43,7 @@ module WCC::Contentful::Test::Double
|
|
45
43
|
sys: {
|
46
44
|
type: 'Link',
|
47
45
|
linkType: 'Space',
|
48
|
-
id: ENV
|
46
|
+
id: ENV.fetch('CONTENTFUL_SPACE_ID', nil)
|
49
47
|
}
|
50
48
|
},
|
51
49
|
id: SecureRandom.urlsafe_base64,
|
@@ -62,7 +60,7 @@ module WCC::Contentful::Test::Double
|
|
62
60
|
revision: rand(100),
|
63
61
|
locale: 'en-US'
|
64
62
|
},
|
65
|
-
fields: attrs.
|
63
|
+
fields: attrs.transform_values { |v| { 'en-US' => v } }
|
66
64
|
}
|
67
65
|
|
68
66
|
double(attrs)
|
@@ -8,9 +8,7 @@ module WCC::Contentful::Test::Factory
|
|
8
8
|
# All attributes that are known to be required fields on the content type
|
9
9
|
# will return a default value based on the field type.
|
10
10
|
def contentful_create(const, context = nil, **attrs)
|
11
|
-
unless const.respond_to?(:content_type_definition)
|
12
|
-
const = WCC::Contentful::Model.resolve_constant(const.to_s)
|
13
|
-
end
|
11
|
+
const = WCC::Contentful::Model.resolve_constant(const.to_s) unless const.respond_to?(:content_type_definition)
|
14
12
|
attrs = attrs.transform_keys { |a| a.to_s.camelize(:lower) }
|
15
13
|
|
16
14
|
id = attrs.delete('id')
|
@@ -59,7 +57,7 @@ module WCC::Contentful::Test::Factory
|
|
59
57
|
sys: {
|
60
58
|
type: 'Link',
|
61
59
|
linkType: 'Space',
|
62
|
-
id: ENV
|
60
|
+
id: ENV.fetch('CONTENTFUL_SPACE_ID', nil)
|
63
61
|
}
|
64
62
|
},
|
65
63
|
id: id || SecureRandom.urlsafe_base64,
|
@@ -86,8 +84,8 @@ module WCC::Contentful::Test::Factory
|
|
86
84
|
end
|
87
85
|
|
88
86
|
def contentful_fields(model)
|
89
|
-
WCC::Contentful::Test::Attributes.defaults(model).
|
90
|
-
|
87
|
+
WCC::Contentful::Test::Attributes.defaults(model).transform_values do |v|
|
88
|
+
{ 'en-US' => v }
|
91
89
|
end
|
92
90
|
end
|
93
91
|
|
data/lib/wcc/contentful.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'wcc/contentful/version'
|
4
4
|
|
5
5
|
require 'active_support'
|
6
|
-
require 'active_support/
|
6
|
+
require 'active_support/all'
|
7
7
|
|
8
8
|
require 'wcc/contentful/active_record_shim'
|
9
9
|
require 'wcc/contentful/configuration'
|
@@ -48,7 +48,7 @@ module WCC::Contentful
|
|
48
48
|
def logger
|
49
49
|
return Rails.logger if defined?(Rails)
|
50
50
|
|
51
|
-
@logger ||= Logger.new(
|
51
|
+
@logger ||= Logger.new($stderr)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -82,7 +82,7 @@ module WCC::Contentful
|
|
82
82
|
|
83
83
|
if configuration.update_schema_file == :always ||
|
84
84
|
(configuration.update_schema_file == :if_possible && Services.instance.management_client) ||
|
85
|
-
configuration.update_schema_file == :if_missing && !File.exist?(configuration.schema_file)
|
85
|
+
(configuration.update_schema_file == :if_missing && !File.exist?(configuration.schema_file))
|
86
86
|
|
87
87
|
begin
|
88
88
|
downloader = WCC::Contentful::DownloadsSchema.new
|
@@ -96,9 +96,7 @@ module WCC::Contentful
|
|
96
96
|
|
97
97
|
content_types =
|
98
98
|
begin
|
99
|
-
if File.exist?(configuration.schema_file)
|
100
|
-
JSON.parse(File.read(configuration.schema_file))['contentTypes']
|
101
|
-
end
|
99
|
+
JSON.parse(File.read(configuration.schema_file))['contentTypes'] if File.exist?(configuration.schema_file)
|
102
100
|
rescue JSON::ParserError
|
103
101
|
WCC::Contentful.logger.warn("Schema file invalid, ignoring it: #{configuration.schema_file}")
|
104
102
|
nil
|
@@ -119,8 +117,8 @@ module WCC::Contentful
|
|
119
117
|
end
|
120
118
|
|
121
119
|
unless content_types
|
122
|
-
raise InitializationError, 'Unable to load content types from schema file or API!' \
|
123
|
-
|
120
|
+
raise InitializationError, 'Unable to load content types from schema file or API! ' \
|
121
|
+
'Check your access token and space ID.'
|
124
122
|
end
|
125
123
|
|
126
124
|
# Set the schema on the default WCC::Contentful::Model
|
data/wcc-contentful.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'wcc/contentful/version'
|
|
6
6
|
|
7
7
|
doc_version = Gem::Version.new(WCC::Contentful::VERSION).release.to_s.sub(/\.\d+$/, '')
|
8
8
|
|
9
|
-
# rubocop:disable
|
9
|
+
# rubocop:disable Layout/LineLength
|
10
10
|
Gem::Specification.new do |spec|
|
11
11
|
spec.name = 'wcc-contentful'
|
12
12
|
spec.version = WCC::Contentful::VERSION
|
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.license = 'MIT'
|
20
20
|
|
21
21
|
spec.metadata = {
|
22
|
-
'documentation_uri' => "https://watermarkchurch.github.io/wcc-contentful/#{doc_version}/wcc-contentful"
|
22
|
+
'documentation_uri' => "https://watermarkchurch.github.io/wcc-contentful/#{doc_version}/wcc-contentful",
|
23
|
+
'rubygems_mfa_required' => 'true'
|
23
24
|
}
|
24
25
|
|
25
|
-
spec.required_ruby_version = '>= 2.
|
26
|
+
spec.required_ruby_version = '>= 2.7'
|
26
27
|
|
27
28
|
spec.files = Dir['app/**/*', 'config/**/*', 'lib/**/*'] +
|
28
29
|
%w[Rakefile README.md wcc-contentful.gemspec]
|
@@ -38,7 +39,6 @@ Gem::Specification.new do |spec|
|
|
38
39
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
39
40
|
spec.add_development_dependency 'rspec-instrumentation-matcher'
|
40
41
|
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
|
41
|
-
spec.add_development_dependency 'rubocop', '0.68'
|
42
42
|
spec.add_development_dependency 'simplecov', '~> 0.16.1'
|
43
43
|
spec.add_development_dependency 'vcr', '~> 5.0'
|
44
44
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
@@ -54,7 +54,7 @@ Gem::Specification.new do |spec|
|
|
54
54
|
spec.add_development_dependency 'generator_spec', '~> 0.9.4'
|
55
55
|
# spec.add_development_dependency 'rails', '~> 5.0'
|
56
56
|
# spec.add_development_dependency 'rspec-rails', '~> 3.7'
|
57
|
-
spec.add_development_dependency 'sqlite3', '~> 1.
|
57
|
+
spec.add_development_dependency 'sqlite3', '~> 1.4'
|
58
58
|
spec.add_development_dependency 'timecop', '~> 0.9.1'
|
59
59
|
|
60
60
|
# optional dependencies
|
@@ -68,4 +68,4 @@ Gem::Specification.new do |spec|
|
|
68
68
|
spec.add_dependency 'wcc-base', '~> 0.3.1'
|
69
69
|
spec.add_dependency 'wisper', '~> 2.0.0'
|
70
70
|
end
|
71
|
-
# rubocop:enable
|
71
|
+
# rubocop:enable Layout/LineLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wcc-contentful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
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: 2022-
|
11
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -136,20 +136,6 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.4.1
|
139
|
-
- !ruby/object:Gem::Dependency
|
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
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: simplecov
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -282,14 +268,14 @@ dependencies:
|
|
282
268
|
requirements:
|
283
269
|
- - "~>"
|
284
270
|
- !ruby/object:Gem::Version
|
285
|
-
version: 1.
|
271
|
+
version: '1.4'
|
286
272
|
type: :development
|
287
273
|
prerelease: false
|
288
274
|
version_requirements: !ruby/object:Gem::Requirement
|
289
275
|
requirements:
|
290
276
|
- - "~>"
|
291
277
|
- !ruby/object:Gem::Version
|
292
|
-
version: 1.
|
278
|
+
version: '1.4'
|
293
279
|
- !ruby/object:Gem::Dependency
|
294
280
|
name: timecop
|
295
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -461,6 +447,8 @@ files:
|
|
461
447
|
- lib/wcc/contentful/model_singleton_methods.rb
|
462
448
|
- lib/wcc/contentful/rails.rb
|
463
449
|
- lib/wcc/contentful/rake.rb
|
450
|
+
- lib/wcc/contentful/rich_text.rb
|
451
|
+
- lib/wcc/contentful/rich_text/node.rb
|
464
452
|
- lib/wcc/contentful/rspec.rb
|
465
453
|
- lib/wcc/contentful/services.rb
|
466
454
|
- lib/wcc/contentful/simple_client.rb
|
@@ -501,8 +489,9 @@ homepage: https://github.com/watermarkchurch/wcc-contentful/wcc-contentful
|
|
501
489
|
licenses:
|
502
490
|
- MIT
|
503
491
|
metadata:
|
504
|
-
documentation_uri: https://watermarkchurch.github.io/wcc-contentful/1.
|
505
|
-
|
492
|
+
documentation_uri: https://watermarkchurch.github.io/wcc-contentful/1.2/wcc-contentful
|
493
|
+
rubygems_mfa_required: 'true'
|
494
|
+
post_install_message:
|
506
495
|
rdoc_options: []
|
507
496
|
require_paths:
|
508
497
|
- lib
|
@@ -510,16 +499,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
510
499
|
requirements:
|
511
500
|
- - ">="
|
512
501
|
- !ruby/object:Gem::Version
|
513
|
-
version: '2.
|
502
|
+
version: '2.7'
|
514
503
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
515
504
|
requirements:
|
516
505
|
- - ">="
|
517
506
|
- !ruby/object:Gem::Version
|
518
507
|
version: '0'
|
519
508
|
requirements: []
|
520
|
-
|
521
|
-
|
522
|
-
signing_key:
|
509
|
+
rubygems_version: 3.1.6
|
510
|
+
signing_key:
|
523
511
|
specification_version: 4
|
524
512
|
summary: '[](https://rubygems.org/gems/wcc-contentful)
|
525
513
|
[](https://circleci.com/gh/watermarkchurch/wcc-contentful)
|