Class: Verizon::DeleteDevicesResult

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/delete_devices_result.rb

Overview

Response for a request made to delete a device.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(device_ids: SKIP, status: SKIP, message: SKIP, additional_properties: nil) ⇒ DeleteDevicesResult

Returns a new instance of DeleteDevicesResult.



50
51
52
53
54
55
56
57
58
59
# File 'lib/verizon/models/delete_devices_result.rb', line 50

def initialize(device_ids: SKIP, status: SKIP, message: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @device_ids = device_ids unless device_ids == SKIP
  @status = status unless status == SKIP
  @message = message unless message == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#device_idsObject

One object per device to be deleted. Each object must contain a kind and id element identifying the device.

Returns:

  • (Object)


15
16
17
# File 'lib/verizon/models/delete_devices_result.rb', line 15

def device_ids
  @device_ids
end

#messageString

Not present if status=Success. One of these messages if status=Failed:The device is not in deactivate state.The user does not have access to delete the device.

Returns:

  • (String)


25
26
27
# File 'lib/verizon/models/delete_devices_result.rb', line 25

def message
  @message
end

#statusString

“Success” if the device was deleted, or “Failed” if there was a problem.

Returns:

  • (String)


19
20
21
# File 'lib/verizon/models/delete_devices_result.rb', line 19

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/verizon/models/delete_devices_result.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_ids = hash.key?('deviceIds') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:DeleteDevicesResultDeviceIds), hash['deviceIds']
  ) : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  message = hash.key?('message') ? hash['message'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DeleteDevicesResult.new(device_ids: device_ids,
                          status: status,
                          message: message,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/verizon/models/delete_devices_result.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_ids'] = 'deviceIds'
  @_hash['status'] = 'status'
  @_hash['message'] = 'message'
  @_hash
end

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/verizon/models/delete_devices_result.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/verizon/models/delete_devices_result.rb', line 37

def self.optionals
  %w[
    device_ids
    status
    message
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



88
89
90
91
92
93
94
# File 'lib/verizon/models/delete_devices_result.rb', line 88

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
# File 'lib/verizon/models/delete_devices_result.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_ids: #{@device_ids.inspect}, status: #{@status.inspect}, message:"\
  " #{@message.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
# File 'lib/verizon/models/delete_devices_result.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} device_ids: #{@device_ids}, status: #{@status}, message: #{@message},"\
  " additional_properties: #{@additional_properties}>"
end