Sha256: f77f3e9f53a15b188299a1f9c023fea961e151839c54324e1a4f65f86d137960
Contents?: true
Size: 987 Bytes
Versions: 19
Compression:
Stored size: 987 Bytes
Contents
require 'net/https' module OpsManagerUiDrivers module Version14 class Api def initialize(host: nil, user: nil, password: nil) @host = host @user = user @password = password end def export_installation tmpfile = Tempfile.new('installation.zip') http.request(get('installation_asset_collection')) do |response| response.read_body do |chunk| tmpfile.write(chunk) end end tmpfile.close tmpfile end private def http uri = URI(@host) Net::HTTP.new(uri.host, uri.port).tap do |http| http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.read_timeout = 1800 end end def get(endpoint) uri = URI("#{@host}/api/#{endpoint}") Net::HTTP::Get.new(uri.request_uri).tap do |get| get.basic_auth(@user, @password) end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems