Sha256: 5395036db2af34fd89e873229684f0f8b521f610c2783d641a0f53264ecabc19

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 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(*args)
      Fastly::Service.new({id: FastlyRails.service_id}, FastlyRails.client).purge_by_key(*args)
    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.8.0 lib/fastly-rails/client.rb
fastly-rails-0.7.1 lib/fastly-rails/client.rb