class ZAWS::Newrelicapi::Data::Servers

Public Class Methods

new(shellout, newrelicapi) click to toggle source
# File lib/zaws/external/newrelicapi/data/servers.rb, line 6
def initialize(shellout, newrelicapi)
  @shellout=shellout
  @newrelicapi=newrelicapi
  @instance_hash=nil
end

Public Instance Methods

load(data, verbose) click to toggle source
# File lib/zaws/external/newrelicapi/data/servers.rb, line 16
def load(data, verbose)
  @instance_raw_data = data
  verbose.puts(@instance_raw_data) if verbose
  @instance_hash=data
end
validJSON() click to toggle source
# File lib/zaws/external/newrelicapi/data/servers.rb, line 12
def validJSON
  return (@instance_hash.nil?)
end
view(verbose) click to toggle source
# File lib/zaws/external/newrelicapi/data/servers.rb, line 22
def view(verbose)
  details = @newrelicapi.filestore.retrieve("serversjson")
  if details.nil?
    load(@newrelicapi.resource_servers.list.execute(verbose),verbose)
    @newrelicapi.filestore.store("serversjson",@instance_hash,Time.now + @newrelicapi.filestore.timeout)
  else
    load(details,verbose)
  end
  return @instance_raw_data
end