Class: HighwindsAPI::Content

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/highwinds-api/content.rb

Class Method Summary collapse

Class Method Details

.purge_path(host_hash, path) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/highwinds-api/content.rb', line 17

def self.purge_path(host_hash, path)
  options = {
  :headers    =>  { 'Content-Type'  => 'application/xml', 
                    'Accept'        => 'application/xml' },
  :basic_auth =>  HighwindsAPI.credentials }
  res = nil
  path = [*path]
  path.each do |url|
    temp_res = self.delete("/#{host_hash}/cds/#{url.chomp('*')}", options)
    if res.nil? || res.response.code == "200"
      res = temp_res
    end
  end 
  res
end

.purge_url(url, recursive) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/highwinds-api/content.rb', line 9

def self.purge_url(url, recursive)
  options = {
  :headers    =>  { 'Content-Type'  => 'application/xml', 
                    'Accept'        => 'application/xml' },
  :basic_auth =>  HighwindsAPI.credentials }
  self.delete("?recursive=#{recursive}&url=#{url}", options)
end