Class: Verizon::DeviceLog

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

Overview

Device logging information.

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_id:, log_time:, log_type:, event_log:, binary_log_file_base64:, binary_log_filename:, additional_properties: nil) ⇒ DeviceLog

Returns a new instance of DeviceLog.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/verizon/models/device_log.rb', line 60

def initialize(device_id:, log_time:, log_type:, event_log:,
               binary_log_file_base64:, binary_log_filename:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @device_id = device_id
  @log_time = log_time
  @log_type = log_type
  @event_log = event_log
  @binary_log_file_base64 = binary_log_file_base64
  @binary_log_filename = binary_log_filename
  @additional_properties = additional_properties
end

Instance Attribute Details

#binary_log_file_base64String

Base64-encoded contents of binary log file.

Returns:

  • (String)


32
33
34
# File 'lib/verizon/models/device_log.rb', line 32

def binary_log_file_base64
  @binary_log_file_base64
end

#binary_log_filenameString

File name of binary log file.

Returns:

  • (String)


36
37
38
# File 'lib/verizon/models/device_log.rb', line 36

def binary_log_filename
  @binary_log_filename
end

#device_idString

Device IMEI.

Returns:

  • (String)


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

def device_id
  @device_id
end

#event_logString

Event log.

Returns:

  • (String)


28
29
30
# File 'lib/verizon/models/device_log.rb', line 28

def event_log
  @event_log
end

#log_timeDateTime

Time of log.

Returns:

  • (DateTime)


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

def log_time
  @log_time
end

#log_typeString

Log type (one of SoftwareUpdate, Event, UserNotification, AgentService, Wireless, WirelessWeb, MobileBroadbandModem, WindowsMDM).

Returns:

  • (String)


24
25
26
# File 'lib/verizon/models/device_log.rb', line 24

def log_type
  @log_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/verizon/models/device_log.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('deviceId') ? hash['deviceId'] : nil
  log_time = if hash.key?('logTime')
               (DateTimeHelper.from_rfc3339(hash['logTime']) if hash['logTime'])
             end
  log_type = hash.key?('logType') ? hash['logType'] : nil
  event_log = hash.key?('eventLog') ? hash['eventLog'] : nil
  binary_log_file_base64 =
    hash.key?('binaryLogFileBase64') ? hash['binaryLogFileBase64'] : nil
  binary_log_filename =
    hash.key?('binaryLogFilename') ? hash['binaryLogFilename'] : nil

  # 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.
  DeviceLog.new(device_id: device_id,
                log_time: log_time,
                log_type: log_type,
                event_log: event_log,
                binary_log_file_base64: binary_log_file_base64,
                binary_log_filename: binary_log_filename,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/verizon/models/device_log.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['device_id'] = 'deviceId'
  @_hash['log_time'] = 'logTime'
  @_hash['log_type'] = 'logType'
  @_hash['event_log'] = 'eventLog'
  @_hash['binary_log_file_base64'] = 'binaryLogFileBase64'
  @_hash['binary_log_filename'] = 'binaryLogFilename'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/verizon/models/device_log.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
# File 'lib/verizon/models/device_log.rb', line 51

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



122
123
124
125
126
127
128
# File 'lib/verizon/models/device_log.rb', line 122

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id.inspect}, log_time: #{@log_time.inspect}, log_type:"\
  " #{@log_type.inspect}, event_log: #{@event_log.inspect}, binary_log_file_base64:"\
  " #{@binary_log_file_base64.inspect}, binary_log_filename: #{@binary_log_filename.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_log_timeObject



108
109
110
# File 'lib/verizon/models/device_log.rb', line 108

def to_custom_log_time
  DateTimeHelper.to_rfc3339(log_time)
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
118
119
# File 'lib/verizon/models/device_log.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} device_id: #{@device_id}, log_time: #{@log_time}, log_type: #{@log_type},"\
  " event_log: #{@event_log}, binary_log_file_base64: #{@binary_log_file_base64},"\
  " binary_log_filename: #{@binary_log_filename}, additional_properties:"\
  " #{@additional_properties}>"
end