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

This method returns the last item post result



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

def self.purge_path(host_hash, path)
  paths =[*path]
  paths = paths.map {|single_path| single_path.start_with?('/') ? single_path : '/' << single_path }
  res=nil
  paths.each do |path|
    options = {
    :headers    =>  { 'Authorization'  => HighwindsAPI.get_token, 
                      'Content-Type' => 'application/json'},
    :body =>  {"list" => [{url: "http://cds.#{host_hash}.hwcdn.net#{path}", recursive: true }]}.to_json }
    res = self.post("/api/v1/accounts/#{}/purge", options)
  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    =>  { 'Authorization'  => HighwindsAPI.get_token,
    'Content-Type' => 'application/json'},
  :body =>  {"list" => [{url: url, recursive: recursive }]}.to_json }
  self.post("/api/v1/accounts/#{}/purge", options)
end