contentful_rails 0.2.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 020e69292f25bc884fa90c49bd9a1a8d7182e249
4
- data.tar.gz: 45d6590bc12f515276302ac8400b3d3b4c4b80fc
3
+ metadata.gz: 7f4e430813651dde714798c6d6a43f2db0d28bc3
4
+ data.tar.gz: c681e7e88ba6724ca0201b69055823a57a1c75ab
5
5
  SHA512:
6
- metadata.gz: 2aedf217e1096fcda85385e891706a39be4606bb5696ba3683af33aad0fb414b0f859316ad648fcc01d3dca246e1dac4efdf6847dfd2bc9c1daa644fc31e9955
7
- data.tar.gz: dd9de11844ecb8075a8f3a995d272e9ab6678ba9cb1853f44556cb3a7a8ad24716dfc004131935a410efbbfefda945561109a93b18932d286c4f93d905d0f706
6
+ metadata.gz: bf1d7c05c65e404b982d70172d682d63a52badba72945596c0a0a7a665852e13c3491906f8e8dbfe036d54f5b0dd8041f373ef81cfa469cb16bd66905d40a3a6
7
+ data.tar.gz: a64ad119a5ed38a6dfa9b4223e644e8464ad33be28a84471ebb6747ecde1e8ff38c0440b296ec58c4b3b6e67c533b803ee423faca34460e72d3783e057f26063
@@ -31,10 +31,18 @@ module ContentfulRails
31
31
  end
32
32
 
33
33
  initializer "subscribe_to_webhook_events", after: :add_entry_mappings do
34
- ActiveSupport::Notifications.subscribe(/Contentful.*Entry.*/) do |name, start, finish, id, payload|
34
+ ActiveSupport::Notifications.subscribe(/Contentful.*Entry\.publish/) do |name, start, finish, id, payload|
35
35
  content_type_id = payload[:sys][:contentType][:sys][:id]
36
36
  klass = ContentfulModel.configuration.entry_mapping[content_type_id]
37
- klass.send(:clear_cache_for, payload[:sys][:id])
37
+ # klass will be nil if the content model has been created in contentful but the model in rails hasn't been added
38
+ unless klass.nil?
39
+ klass.send(:clear_cache_for, payload[:sys][:id])
40
+ end
41
+
42
+ end
43
+
44
+ ActiveSupport::Notifications.subscribe(/Contentful.*Entry\.unpublish/) do |name, start, finish, id, payload|
45
+ ActionController::Base.new.expire_fragment(%r{.*#{payload[:sys][:id]}.*})
38
46
  end
39
47
  end
40
48
 
@@ -1,3 +1,3 @@
1
1
  module ContentfulRails
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Error Creative Studio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-10 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: contentful_model
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.6
19
+ version: 0.1.7
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: 0.1.6
26
+ version: 0.1.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement