Class: Hbc::CurlPostDownloadStrategy

Inherits:
CurlDownloadStrategy show all
Defined in:
Library/Homebrew/cask/lib/hbc/download_strategy.rb

Instance Attribute Summary

Attributes inherited from AbstractDownloadStrategy

#cask, #name, #uri_object, #url, #version

Instance Method Summary collapse

Methods inherited from CurlDownloadStrategy

#_fetch, #cached_location, #clear_cache, #fetch, #tarball_path, #temporary_path

Methods inherited from AbstractDownloadStrategy

#cached_location, #clear_cache, #fetch, #initialize

Constructor Details

This class inherits a constructor from Hbc::AbstractDownloadStrategy

Instance Method Details

#cask_curl_argsObject



162
163
164
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 162

def cask_curl_args
  super.concat(post_args)
end

#post_argsObject



166
167
168
169
170
171
172
173
174
175
176
177
# File 'Library/Homebrew/cask/lib/hbc/download_strategy.rb', line 166

def post_args
  if uri_object.data
    # sort_by is for predictability between Ruby versions
    uri_object
      .data
      .sort_by(&:to_s)
      .map { |key, value| ["-d", "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"] }
      .flatten
  else
    ["-X", "POST"]
  end
end