module OneviewSDK::API300
Module for API v300
Constants
- DEFAULT_VARIANT
- SUPPORTED_VARIANTS
Public Class Methods
const_missing(const)
click to toggle source
Helps redirect resources to the correct API300
variant
# File lib/oneview-sdk/resource/api300.rb, line 56 def self.const_missing(const) api300_module = OneviewSDK::API300.const_get(@variant.to_s) api300_module.const_get(const) rescue NameError raise NameError, "The #{const} method or resource does not exist for OneView API300 variant #{@variant}." end
resource_named(type, variant = @variant)
click to toggle source
Get resource class that matches the type given @param [String] type Name of the desired class type @param [String] variant Variant (C7000
or Synergy
) @return [Class] Resource
class or nil if not found
# File lib/oneview-sdk/resource/api300.rb, line 24 def self.resource_named(type, variant = @variant) raise "API300 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s) new_type = type.to_s.downcase.gsub(/[ -_]/, '') api_module = OneviewSDK::API300.const_get(variant) api_module.constants.each do |c| klass = api_module.const_get(c) next unless klass.is_a?(Class) name = klass.name.split('::').last.downcase.delete('_').delete('-') return klass if new_type =~ /^#{name}[s]?$/ end nil end
variant()
click to toggle source
Get the current API300
variant
# File lib/oneview-sdk/resource/api300.rb, line 38 def self.variant @variant end
variant=(variant)
click to toggle source
Sets the API300
variant
# File lib/oneview-sdk/resource/api300.rb, line 49 def self.variant=(variant) raise "API300 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant) @variant_updated = true @variant = variant end
variant_updated?()
click to toggle source
Has the API300
variant been set by the user? @return [TrueClass, FalseClass]
# File lib/oneview-sdk/resource/api300.rb, line 44 def self.variant_updated? @variant_updated end