Sha256: 59cb9229a061b5ee18e8a8d148a94a7054b534816514396277b37348c5ff2158
Contents?: true
Size: 932 Bytes
Versions: 29
Compression:
Stored size: 932 Bytes
Contents
require 'net/https' module OpsManagerUiDrivers module Version13 class Api def initialize(host: nil, user: nil, password: nil) @host = host @user = user @password = password end def export_installation response = http.request(get('installation_asset_collection')) Tempfile.new('installation.zip').tap do |tempfile| tempfile.write(response.body) tempfile.close end 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 = 900 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
29 entries across 29 versions & 1 rubygems