class ProxmoxAPI::ApiPath

This class is used to collect api path before request

Public Class Methods

new(api) click to toggle source

@param [ProxmoxAPI] api ProxmoxAPI object to call when request is executed

# File lib/proxmox_api.rb, line 17
def initialize(api)
  raise ArgumentError, 'Not an instance of ProxmoxAPI' unless api.is_a? ProxmoxAPI

  @api = api
  @path = []
end

Public Instance Methods

[](index) click to toggle source
# File lib/proxmox_api.rb, line 28
def [](index)
  @path << index.to_s
  self
end
method_missing(method, *args) click to toggle source
# File lib/proxmox_api.rb, line 33
def method_missing(method, *args)
  return @api.__send__(:submit, method, to_s, *args) if REST_METHODS.any? { |rm| /^#{rm}!?$/.match? method }

  @path << method.to_s
  self
end
respond_to_missing?(*) click to toggle source
# File lib/proxmox_api.rb, line 40
def respond_to_missing?(*)
  true
end
to_s() click to toggle source
# File lib/proxmox_api.rb, line 24
def to_s
  @path.join('/')
end