Sha256: 8a05b7513d5276f822608b613825eceea2a997b28943ca251028ea3a2e5c108b
Contents?: true
Size: 821 Bytes
Versions: 3
Compression:
Stored size: 821 Bytes
Contents
#require File.join(File.dirname(__FILE__), '..','..','vendor','gems', 'environment') require 'sinatra/base' require 'akamai' module AkamaiBookmarklet class Application < Sinatra::Base set :views, File.join(File.dirname(__FILE__),'views') helpers do def publicize_cms_uri(uri) if uri =~ /cms.audi.com/i path = /^https\:\/\/cms\.audi\.com\/author\/(.*)\?(.*)$/i.match(uri)[1] "http://www.audiusa.com/#{path}" else uri end end end get '/bookmarklet' do halt 401 unless session[:cas_user] erb :'bookmarklet.html' end get '/purge.js' do uri = publicize_cms_uri(URI.decode(params[:uri])) puts "Purging #{uri}" @result = Akamai.new.purge(uri) erb :'purge.js' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
akamai_bookmarklet-0.1.2 | lib/application/application.rb |
akamai_bookmarklet-0.1.1 | lib/application/application.rb |
akamai_bookmarklet-0.1.0 | lib/application/application.rb |