class Fog::Proxmox::Collection
class Collection proxmox
Attributes
response[RW]
Public Instance Methods
all(_options = {})
click to toggle source
Returns detailed list of records
# File lib/fog/proxmox/models/collection.rb, line 54 def all(_options = {}) raise Fog::Proxmox::Errors::InterfaceNotImplemented, not_implemented('all') end
clear_ignored_attributes(object, attributes_ignored = [])
click to toggle source
clear attributes non persistent
# File lib/fog/proxmox/models/collection.rb, line 38 def clear_ignored_attributes(object, attributes_ignored = []) attributes_ignored.each { |attribute| object.delete_if { |key, _value| key == attribute } } object end
create(attributes = {})
click to toggle source
Proxmox object creation requires identity and return null
# File lib/fog/proxmox/models/collection.rb, line 48 def create(attributes = {}) object = new(attributes) object.create(attributes) end
destroy(_uuid)
click to toggle source
Destroys record given record's UUID
# File lib/fog/proxmox/models/collection.rb, line 75 def destroy(_uuid) raise Fog::Proxmox::Errors::InterfaceNotImplemented, not_implemented('destroy') end
find_by_id(uuid)
click to toggle source
# File lib/fog/proxmox/models/collection.rb, line 70 def find_by_id(uuid) get(uuid) end
get(_uuid)
click to toggle source
Gets record given record's UUID
# File lib/fog/proxmox/models/collection.rb, line 66 def get(_uuid) raise Fog::Proxmox::Errors::InterfaceNotImplemented, not_implemented('get') end
load_response(response, _index = nil, attributes_ignored = [])
click to toggle source
# File lib/fog/proxmox/models/collection.rb, line 29 def load_response(response, _index = nil, attributes_ignored = []) body = JSON.decode(response.body) objects = body['data'] clear && objects.each { |object| self << new(clear_ignored_attributes(object, attributes_ignored)) } self.response = response self end
not_implemented(method)
click to toggle source
# File lib/fog/proxmox/models/collection.rb, line 79 def not_implemented(method) "Method #{method} is not implemented" end
read(response, attribute)
click to toggle source
# File lib/fog/proxmox/models/collection.rb, line 43 def read(response, attribute) response.body[attribute] end
summary(options = {})
click to toggle source
Returns non detailed list of records, usually just subset of attributes, which makes this call more effective. Not all Proxmox services support non detailed list, so it delegates to :all by default.
# File lib/fog/proxmox/models/collection.rb, line 61 def summary(options = {}) all(options) end