Sha256: cfd9607a5a1ad06088f36c74ca33890b25f1207658b2512371ae2382cb70ec44

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

require 'capistrano'
require 'capistrano/cloudflare/version'
require 'json'
require 'net/http'
require 'rake'

module Capistrano
  module CloudFlare
    def self.send_request(options = {})
      uri = URI('https://www.cloudflare.com/api_json.html')
      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true
      request = Net::HTTP::Post.new(uri.request_uri)
      request.set_form_data({
        :v     => 1,
        :a     => 'fpurge_ts',
        :z     => options[:domain],
        :tkn   => options[:api_key],
        :email => options[:email]

      })
      response = JSON.parse(http.request(request).body)
    end
  end
end

load File.expand_path('../tasks/cloudflare.rake', __FILE__)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-cloudflare-1.0.0 lib/capistrano/cloudflare.rb