class NasneChecker::Nasne
Attributes
host[R]
Public Class Methods
new(host)
click to toggle source
# File lib/nasne_checker/nasne.rb, line 8 def initialize(host) @host = host @clients = {} end
Public Instance Methods
hdd_detail()
click to toggle source
# File lib/nasne_checker/nasne.rb, line 34 def hdd_detail hdd = hdd_list[:HDD].select{ |info| info[:registerFlag] == 1 } hdd.map {|info| hdd_info(info[:id])[:HDD] } end
hdd_info(id)
click to toggle source
# File lib/nasne_checker/nasne.rb, line 30 def hdd_info(id) get('64210', '/status/HDDInfoGet', id: id).body end
hdd_list()
click to toggle source
# File lib/nasne_checker/nasne.rb, line 26 def hdd_list get('64210', '/status/HDDListGet').body end
reserved_list()
click to toggle source
# File lib/nasne_checker/nasne.rb, line 13 def reserved_list get( '64220', '/schedule/reservedListGet', searchCriteria: 0, filter: 0, startingIndex: 0, requestedCount: 0, sortCriteria: 0, withDescriptionLong: 0, withUserData: 1 ).body end
Private Instance Methods
client(port)
click to toggle source
# File lib/nasne_checker/nasne.rb, line 41 def client(port) @clients[port] ||= Faraday.new(url: "http://#{host}:#{port}") do |faraday| faraday.request :url_encoded faraday.response :raise_error faraday.response :multi_json, symbolize_keys: true faraday.adapter Faraday.default_adapter end end
get(port, path, query = nil)
click to toggle source
# File lib/nasne_checker/nasne.rb, line 50 def get(port, path, query = nil) client(port).get path, query end