Class: MistApi::InsightRogueAp

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

Overview

InsightRogueAp Model.

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, avg_rssi = nil, bssid = nil, channel = nil, num_aps = nil, delta_x = SKIP, delta_y = SKIP, seen_on_lan = SKIP, ssid = SKIP, times_heard = SKIP) ⇒ InsightRogueAp

Returns a new instance of InsightRogueAp.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 85

def initialize(ap_mac = nil, avg_rssi = nil, bssid = nil, channel = nil,
               num_aps = nil, delta_x = SKIP, delta_y = SKIP,
               seen_on_lan = SKIP, ssid = SKIP, times_heard = SKIP)
  @ap_mac = ap_mac
  @avg_rssi = avg_rssi
  @bssid = bssid
  @channel = channel
  @delta_x = delta_x unless delta_x == SKIP
  @delta_y = delta_y unless delta_y == SKIP
  @num_aps = num_aps
  @seen_on_lan = seen_on_lan unless seen_on_lan == SKIP
  @ssid = ssid unless ssid == SKIP
  @times_heard = times_heard unless times_heard == SKIP
end

Instance Attribute Details

#ap_macString

MAC of the device that had strongest signal strength for ssid/bssid pair

Returns:

  • (String)


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

def ap_mac
  @ap_mac
end

#avg_rssiFloat

Average signal strength of ap_mac for ssid/bssid pair

Returns:

  • (Float)


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

def avg_rssi
  @avg_rssi
end

#bssidString

BSSID of the network detected as threat

Returns:

  • (String)


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

def bssid
  @bssid
end

#channelString

Channel over which ap_mac heard ssid/bssid pair

Returns:

  • (String)


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

def channel
  @channel
end

#delta_xFloat

X position relative to the reporting AP (‘ap_mac`)

Returns:

  • (Float)


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

def delta_x
  @delta_x
end

#delta_yFloat

Y position relative to the reporting AP (‘ap_mac`)

Returns:

  • (Float)


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

def delta_y
  @delta_y
end

#num_apsInteger

Num of aps that heard the ssid/bssid pair

Returns:

  • (Integer)


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

def num_aps
  @num_aps
end

#seen_on_lanTrueClass | FalseClass

Whether the reporting AP see a wireless client (on LAN) connecting to it

Returns:

  • (TrueClass | FalseClass)


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

def seen_on_lan
  @seen_on_lan
end

#ssidString

SSID of the network detected as threat

Returns:

  • (String)


46
47
48
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 46

def ssid
  @ssid
end

#times_heardInteger

Represents number of times the pair was heard in the interval. Each count roughly corresponds to a minute.

Returns:

  • (Integer)


51
52
53
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 51

def times_heard
  @times_heard
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 101

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ap_mac = hash.key?('ap_mac') ? hash['ap_mac'] : nil
  avg_rssi = hash.key?('avg_rssi') ? hash['avg_rssi'] : nil
  bssid = hash.key?('bssid') ? hash['bssid'] : nil
  channel = hash.key?('channel') ? hash['channel'] : nil
  num_aps = hash.key?('num_aps') ? hash['num_aps'] : nil
  delta_x = hash.key?('delta_x') ? hash['delta_x'] : SKIP
  delta_y = hash.key?('delta_y') ? hash['delta_y'] : SKIP
  seen_on_lan = hash.key?('seen_on_lan') ? hash['seen_on_lan'] : SKIP
  ssid = hash.key?('ssid') ? hash['ssid'] : SKIP
  times_heard = hash.key?('times_heard') ? hash['times_heard'] : SKIP

  # Create object from extracted values.
  InsightRogueAp.new(ap_mac,
                     avg_rssi,
                     bssid,
                     channel,
                     num_aps,
                     delta_x,
                     delta_y,
                     seen_on_lan,
                     ssid,
                     times_heard)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ap_mac'] = 'ap_mac'
  @_hash['avg_rssi'] = 'avg_rssi'
  @_hash['bssid'] = 'bssid'
  @_hash['channel'] = 'channel'
  @_hash['delta_x'] = 'delta_x'
  @_hash['delta_y'] = 'delta_y'
  @_hash['num_aps'] = 'num_aps'
  @_hash['seen_on_lan'] = 'seen_on_lan'
  @_hash['ssid'] = 'ssid'
  @_hash['times_heard'] = 'times_heard'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 81

def self.nullables
  []
end

.optionalsObject

An array for optional fields



70
71
72
73
74
75
76
77
78
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 70

def self.optionals
  %w[
    delta_x
    delta_y
    seen_on_lan
    ssid
    times_heard
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



138
139
140
141
142
143
144
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 138

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac.inspect}, avg_rssi: #{@avg_rssi.inspect}, bssid:"\
  " #{@bssid.inspect}, channel: #{@channel.inspect}, delta_x: #{@delta_x.inspect}, delta_y:"\
  " #{@delta_y.inspect}, num_aps: #{@num_aps.inspect}, seen_on_lan: #{@seen_on_lan.inspect},"\
  " ssid: #{@ssid.inspect}, times_heard: #{@times_heard.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



130
131
132
133
134
135
# File 'lib/mist_api/models/insight_rogue_ap.rb', line 130

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ap_mac: #{@ap_mac}, avg_rssi: #{@avg_rssi}, bssid: #{@bssid}, channel:"\
  " #{@channel}, delta_x: #{@delta_x}, delta_y: #{@delta_y}, num_aps: #{@num_aps},"\
  " seen_on_lan: #{@seen_on_lan}, ssid: #{@ssid}, times_heard: #{@times_heard}>"
end