Class: Renderful::CacheInvalidator
- Inherits:
-
Object
- Object
- Renderful::CacheInvalidator
- Defined in:
- lib/renderful/cache_invalidator.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ CacheInvalidator
constructor
A new instance of CacheInvalidator.
- #process_webhook(body) ⇒ Object
Constructor Details
#initialize(client) ⇒ CacheInvalidator
Returns a new instance of CacheInvalidator.
7 8 9 |
# File 'lib/renderful/cache_invalidator.rb', line 7 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/renderful/cache_invalidator.rb', line 5 def client @client end |
Instance Method Details
#process_webhook(body) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/renderful/cache_invalidator.rb', line 11 def process_webhook(body) return unless client.cache params = body.is_a?(String) ? JSON.parse(body) : body client.cache.delete(client.cache_key_for( content_type_id: params['sys']['contentType']['sys']['id'], entry_id: params['sys']['id'], )) end |