class Nodeum::Tape

Attributes

barcode[RW]
cleaning[RW]
date_in[RW]
date_move[RW]
ejected[RW]
force_import_type[RW]
free[RW]
hash[RW]
id[RW]
known[RW]
last_maintenance[RW]
last_repack[RW]
last_size_update[RW]
location[RW]
locked[RW]
max[RW]
mount_count[RW]
mounted[RW]
need_to_check[RW]
pool_id[RW]
repack_status[RW]
scratch[RW]
tape_library_id[RW]
type[RW]
write_protect[RW]

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/nodeum_sdk/models/tape.rb, line 90
def self.attribute_map
  {
    :'id' => :'id',
    :'tape_library_id' => :'tape_library_id',
    :'pool_id' => :'pool_id',
    :'barcode' => :'barcode',
    :'location' => :'location',
    :'type' => :'type',
    :'locked' => :'locked',
    :'scratch' => :'scratch',
    :'cleaning' => :'cleaning',
    :'write_protect' => :'write_protect',
    :'mounted' => :'mounted',
    :'ejected' => :'ejected',
    :'known' => :'known',
    :'mount_count' => :'mount_count',
    :'date_in' => :'date_in',
    :'date_move' => :'date_move',
    :'free' => :'free',
    :'max' => :'max',
    :'last_size_update' => :'last_size_update',
    :'last_maintenance' => :'last_maintenance',
    :'last_repack' => :'last_repack',
    :'repack_status' => :'repack_status',
    :'hash' => :'hash',
    :'force_import_type' => :'force_import_type',
    :'need_to_check' => :'need_to_check'
  }
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/nodeum_sdk/models/tape.rb, line 345
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/nodeum_sdk/models/tape.rb, line 159
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Nodeum::Tape` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Nodeum::Tape`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'tape_library_id')
    self.tape_library_id = attributes[:'tape_library_id']
  end

  if attributes.key?(:'pool_id')
    self.pool_id = attributes[:'pool_id']
  end

  if attributes.key?(:'barcode')
    self.barcode = attributes[:'barcode']
  end

  if attributes.key?(:'location')
    self.location = attributes[:'location']
  end

  if attributes.key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.key?(:'locked')
    self.locked = attributes[:'locked']
  end

  if attributes.key?(:'scratch')
    self.scratch = attributes[:'scratch']
  end

  if attributes.key?(:'cleaning')
    self.cleaning = attributes[:'cleaning']
  end

  if attributes.key?(:'write_protect')
    self.write_protect = attributes[:'write_protect']
  end

  if attributes.key?(:'mounted')
    self.mounted = attributes[:'mounted']
  end

  if attributes.key?(:'ejected')
    self.ejected = attributes[:'ejected']
  end

  if attributes.key?(:'known')
    self.known = attributes[:'known']
  end

  if attributes.key?(:'mount_count')
    self.mount_count = attributes[:'mount_count']
  end

  if attributes.key?(:'date_in')
    self.date_in = attributes[:'date_in']
  end

  if attributes.key?(:'date_move')
    self.date_move = attributes[:'date_move']
  end

  if attributes.key?(:'free')
    self.free = attributes[:'free']
  end

  if attributes.key?(:'max')
    self.max = attributes[:'max']
  end

  if attributes.key?(:'last_size_update')
    self.last_size_update = attributes[:'last_size_update']
  end

  if attributes.key?(:'last_maintenance')
    self.last_maintenance = attributes[:'last_maintenance']
  end

  if attributes.key?(:'last_repack')
    self.last_repack = attributes[:'last_repack']
  end

  if attributes.key?(:'repack_status')
    self.repack_status = attributes[:'repack_status']
  end

  if attributes.key?(:'hash')
    self.hash = attributes[:'hash']
  end

  if attributes.key?(:'force_import_type')
    self.force_import_type = attributes[:'force_import_type']
  end

  if attributes.key?(:'need_to_check')
    self.need_to_check = attributes[:'need_to_check']
  end
end
openapi_nullable() click to toggle source

List of attributes with nullable: true

# File lib/nodeum_sdk/models/tape.rb, line 152
def self.openapi_nullable
  Set.new([
  ])
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/nodeum_sdk/models/tape.rb, line 121
def self.openapi_types
  {
    :'id' => :'Integer',
    :'tape_library_id' => :'Integer',
    :'pool_id' => :'Integer',
    :'barcode' => :'String',
    :'location' => :'String',
    :'type' => :'String',
    :'locked' => :'Boolean',
    :'scratch' => :'Boolean',
    :'cleaning' => :'Boolean',
    :'write_protect' => :'Boolean',
    :'mounted' => :'Boolean',
    :'ejected' => :'Boolean',
    :'known' => :'Boolean',
    :'mount_count' => :'Integer',
    :'date_in' => :'String',
    :'date_move' => :'String',
    :'free' => :'Integer',
    :'max' => :'Integer',
    :'last_size_update' => :'String',
    :'last_maintenance' => :'String',
    :'last_repack' => :'String',
    :'repack_status' => :'Boolean',
    :'hash' => :'String',
    :'force_import_type' => :'Boolean',
    :'need_to_check' => :'Boolean'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/nodeum_sdk/models/tape.rb, line 300
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      tape_library_id == o.tape_library_id &&
      pool_id == o.pool_id &&
      barcode == o.barcode &&
      location == o.location &&
      type == o.type &&
      locked == o.locked &&
      scratch == o.scratch &&
      cleaning == o.cleaning &&
      write_protect == o.write_protect &&
      mounted == o.mounted &&
      ejected == o.ejected &&
      known == o.known &&
      mount_count == o.mount_count &&
      date_in == o.date_in &&
      date_move == o.date_move &&
      free == o.free &&
      max == o.max &&
      last_size_update == o.last_size_update &&
      last_maintenance == o.last_maintenance &&
      last_repack == o.last_repack &&
      repack_status == o.repack_status &&
      hash == o.hash &&
      force_import_type == o.force_import_type &&
      need_to_check == o.need_to_check
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/nodeum_sdk/models/tape.rb, line 373
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    Nodeum.const_get(type).build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/nodeum_sdk/models/tape.rb, line 442
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/nodeum_sdk/models/tape.rb, line 352
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/nodeum_sdk/models/tape.rb, line 332
def eql?(o)
  self == o
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/nodeum_sdk/models/tape.rb, line 275
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/nodeum_sdk/models/tape.rb, line 418
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/nodeum_sdk/models/tape.rb, line 424
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end
    
    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/nodeum_sdk/models/tape.rb, line 412
def to_s
  to_hash.to_s
end
type=(type) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] type Object to be assigned

# File lib/nodeum_sdk/models/tape.rb, line 290
def type=(type)
  validator = EnumAttributeValidator.new('String', ["unknown", "data", "cleaning", "diagnostic", "data_lto1", "data_lto2", "data_lto3", "data_lto4", "data_lto5", "data_lto6", "data_lto7", "data_lto8", "data_lto9", "data_lto10", "data_lto11", "data_lto12"])
  unless validator.valid?(type)
    fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
  end
  @type = type
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/nodeum_sdk/models/tape.rb, line 282
def valid?
  type_validator = EnumAttributeValidator.new('String', ["unknown", "data", "cleaning", "diagnostic", "data_lto1", "data_lto2", "data_lto3", "data_lto4", "data_lto5", "data_lto6", "data_lto7", "data_lto8", "data_lto9", "data_lto10", "data_lto11", "data_lto12"])
  return false unless type_validator.valid?(@type)
  true
end