Sha256: 451d520d152e84b7bfc5587aeec9b82f6047394ed2cddfc78d61f33f843d62d2

Contents?: true

Size: 464 Bytes

Versions: 1

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

module Renderful
  class CacheInvalidator
    attr_reader :client

    def initialize(client)
      @client = client
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renderful-0.1.0 lib/renderful/cache_invalidator.rb