Sha256: 8d43a9bcac98553b6ec119c108bc46eb297fef2667f70b948c8b005e897a83e6
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
# Copyright © 2014, Evercam. module Evercam module Models # This method fetches a list of all models support within Evercam. def get_all_models data = handle_response(call("/models")) if !data.include?("vendors") message = "Invalid response received from server." @logger.error message raise EvercamError.new(message) end data["vendors"] end # This method fetches a list of models for a specified vendor. # # ==== Parameters # vendor:: The unique identifier for the vendor to fetch the list of # models for. def get_vendor_models(vendor) data = handle_response(call("/models/#{vendor}")) if !data.include?("vendors") || data["vendors"].empty? message = "Invalid response received from server." @logger.error message raise EvercamError.new(message) end data["vendors"].first end # This method fetches details for a specific model for a given vendor. # # ==== Parameters # vendor:: The unique identifier for the vendor who owns the model. # model:: The unique identifier for the model to fetch. def get_vendor_model(vendor, model) data = handle_response(call("/models/#{vendor}/#{model}")) if !data.include?("models") || data["models"].empty? message = "Invalid response received from server." @logger.error message raise EvercamError.new(message) end data["models"].first end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
evercam-0.1.2 | lib/evercam/models.rb |
evercam-0.1.1 | lib/evercam/models.rb |