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

#to_hash, #to_json

Constructor Details

#initialize(device_id = nil, log_time = nil, log_type = nil, event_log = nil, binary_log_file_base64 = nil, binary_log_filename = nil) ⇒ DeviceLog

Returns a new instance of DeviceLog.



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

def initialize(device_id = nil, log_time = nil, log_type = nil,
               event_log = nil, binary_log_file_base64 = nil,
               binary_log_filename = 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
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.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/verizon/models/device_log.rb', line 72

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 object from extracted values.
  DeviceLog.new(device_id,
                log_time,
                log_type,
                event_log,
                binary_log_file_base64,
                binary_log_filename)
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

#to_custom_log_timeObject



96
97
98
# File 'lib/verizon/models/device_log.rb', line 96

def to_custom_log_time
  DateTimeHelper.to_rfc3339(log_time)
end