Module: UnifiGem::Client::Wlan

Included in:
UnifiGem::Client
Defined in:
lib/unifi_gem/client/wlan.rb

Instance Method Summary collapse

Instance Method Details

#create_wlan(name, x_passphrase, usergroup_id, wlangroup_id, enabled = true, hide_ssid = false, is_guest = false, security = 'open', wpa_mode = 'wpa2', wpa_enc = 'ccmp', vlan_enabled = false, vlan = null, uapsd_enabled = false, schedule_enabled = false, schedule = []) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/unifi_gem/client/wlan.rb', line 13

def create_wlan(name,
                x_passphrase,
                usergroup_id,
                wlangroup_id,
                enabled = true,
                hide_ssid = false,
                is_guest = false,
                security = 'open',
                wpa_mode = 'wpa2',
                wpa_enc = 'ccmp',
                vlan_enabled = false,
                vlan = null,
                uapsd_enabled = false,
                schedule_enabled = false,
                schedule = [])
  body = { name: name,
           x_passphrase: x_passphrase,
           usergroup_id: usergroup_id,
           wlangroup_id: wlangroup_id,
           enabled: enabled,
           hide_ssid: hide_ssid,
           is_guest: is_guest,
           security: security,
           wpa_mode: wpa_mode,
           wpa_enc: wpa_enc,
           vlan_enabled: vlan_enabled,
           uapsd_enabled: uapsd_enabled,
           schedule_enabled: schedule_enabled,
           schedule: schedule }
  body[:vlan] = vlan if vlan && vlan_enabled
  response = self.class.get("/s/#{@site}/add/wlanconf", { body: body.to_json })
  response.parsed_response
end

#delete_wlan(wlan_id) ⇒ Object



7
8
9
10
11
# File 'lib/unifi_gem/client/wlan.rb', line 7

def delete_wlan(wlan_id)
  body = {}
  response = self.class.post("/s/#{@site}/del/wlanconf/#{wlan_id}", { body: body.to_json })
  response.parsed_response
end

#list_wlan_groupsObject



55
56
57
58
# File 'lib/unifi_gem/client/wlan.rb', line 55

def list_wlan_groups
  response = self.class.get("/s/#{@site}/list/wlangroup")
  response.parsed_response
end

#list_wlanconfObject



60
61
62
63
# File 'lib/unifi_gem/client/wlan.rb', line 60

def list_wlanconf
  response = self.class.get("/s/#{@site}/list/wlanconf")
  response.parsed_response
end

#set_wlansettings(wlan_id, x_passphrase, name = '') ⇒ Object



47
48
49
50
51
52
53
# File 'lib/unifi_gem/client/wlan.rb', line 47

def set_wlansettings(wlan_id, x_passphrase, name = '')
  body = {}
  body[:x_passphrase] = x_passphrase if x_passphrase
  body[:name] = name if name
  response = self.class.get("/s/#{@site}/upd/wlanconf/#{wlan_id}", { body: body.to_json })
  response.parsed_response
end