Class: MistApi::StatsUnconnectedClient

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/stats_unconnected_client.rb

Overview

Unconnected clients statistics

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(ap_mac = nil, mac = nil, manufacture = nil, rssi = nil, y = nil, last_seen = SKIP, map_id = SKIP, x = SKIP) ⇒ StatsUnconnectedClient

Returns a new instance of StatsUnconnectedClient.



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 75

def initialize(ap_mac = nil, mac = nil, manufacture = nil, rssi = nil,
               y = nil, last_seen = SKIP, map_id = SKIP, x = SKIP)
  @ap_mac = ap_mac
  @last_seen = last_seen unless last_seen == SKIP
  @mac = mac
  @manufacture = manufacture
  @map_id = map_id unless map_id == SKIP
  @rssi = rssi
  @x = x unless x == SKIP
  @y = y
end

Instance Attribute Details

#ap_macString

MAC address of the AP that heard the client

Returns:

  • (String)


14
15
16
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 14

def ap_mac
  @ap_mac
end

#last_seenFloat

Last seen timestamp

Returns:

  • (Float)


18
19
20
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 18

def last_seen
  @last_seen
end

#macString

MAC address of the (unconnected) client

Returns:

  • (String)


22
23
24
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 22

def mac
  @mac
end

#manufactureString

Device manufacture, through fingerprinting or OUI

Returns:

  • (String)


26
27
28
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 26

def manufacture
  @manufacture
end

#map_idUUID | String

Map_id of the client (if known), or null

Returns:

  • (UUID | String)


30
31
32
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 30

def map_id
  @map_id
end

#rssiInteger

Client RSSI observed by the AP that heard the client (in dBm)

Returns:

  • (Integer)


34
35
36
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 34

def rssi
  @rssi
end

#xFloat

X (in pixels) of user location on the map (if known)

Returns:

  • (Float)


38
39
40
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 38

def x
  @x
end

#yFloat

Y (in pixels) of user location on the map (if known)

Returns:

  • (Float)


42
43
44
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 42

def y
  @y
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ap_mac = hash.key?('ap_mac') ? hash['ap_mac'] : nil
  mac = hash.key?('mac') ? hash['mac'] : nil
  manufacture = hash.key?('manufacture') ? hash['manufacture'] : nil
  rssi = hash.key?('rssi') ? hash['rssi'] : nil
  y = hash.key?('y') ? hash['y'] : nil
  last_seen = hash.key?('last_seen') ? hash['last_seen'] : SKIP
  map_id = hash.key?('map_id') ? hash['map_id'] : SKIP
  x = hash.key?('x') ? hash['x'] : SKIP

  # Create object from extracted values.
  StatsUnconnectedClient.new(ap_mac,
                             mac,
                             manufacture,
                             rssi,
                             y,
                             last_seen,
                             map_id,
                             x)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap_mac'] = 'ap_mac'
  @_hash['last_seen'] = 'last_seen'
  @_hash['mac'] = 'mac'
  @_hash['manufacture'] = 'manufacture'
  @_hash['map_id'] = 'map_id'
  @_hash['rssi'] = 'rssi'
  @_hash['x'] = 'x'
  @_hash['y'] = 'y'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
71
72
73
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 68

def self.nullables
  %w[
    last_seen
    map_id
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 59

def self.optionals
  %w[
    last_seen
    map_id
    x
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



120
121
122
123
124
125
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 120

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac.inspect}, last_seen: #{@last_seen.inspect}, mac:"\
  " #{@mac.inspect}, manufacture: #{@manufacture.inspect}, map_id: #{@map_id.inspect}, rssi:"\
  " #{@rssi.inspect}, x: #{@x.inspect}, y: #{@y.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



113
114
115
116
117
# File 'lib/mist_api/models/stats_unconnected_client.rb', line 113

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac}, last_seen: #{@last_seen}, mac: #{@mac}, manufacture:"\
  " #{@manufacture}, map_id: #{@map_id}, rssi: #{@rssi}, x: #{@x}, y: #{@y}>"
end