class Moxprox::Ticket

Public Class Methods

login(host, username, password) click to toggle source
# File lib/moxprox/ticket.rb, line 3
def self.login(host, username, password)
  connection = Excon.new("https://#{host}:8006")
  res = connection.post(path: "/api2/json/access/ticket", query: { username: username, password: password })
  data = JSON.parse(res.body)
  self.new(connection, data["data"]["ticket"], data["data"]["CSRFPreventionToken"])
end

Public Instance Methods

headers() click to toggle source
# File lib/moxprox/ticket.rb, line 10
def headers
  { 'Cookie' => "PVEAuthCookie=#{ticket}", "CSRFPreventionToken" => csrf }
end