Sha256: df620a83251ca10cf7681257ae3e1a51ec942a97ada1f3b476916d23f336351e

Contents?: true

Size: 412 Bytes

Versions: 2

Compression:

Stored size: 412 Bytes

Contents

require 'fastly'
require 'uri'

module FastlyRails
  # A simple wrapper around the fastly-ruby client.
  class Client < DelegateClass(Fastly)
    def initialize(opts={})
      super(Fastly.new(opts))
    end

    def purge_by_key(key)
      client.require_key!
      client.post purge_url(key)
    end

    def purge_url(key)
      "/service/#{FastlyRails.service_id}/purge/#{URI.escape(key)}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fastly-rails-0.7.0 lib/fastly-rails/client.rb
fastly-rails-0.6.0 lib/fastly-rails/client.rb