Module: UnifiGem::Client::Guests
- Included in:
- UnifiGem::Client
- Defined in:
- lib/unifi_gem/client/guests.rb
Instance Method Summary collapse
- #authorize_guest(mac, minutes, up = nil, down = nil, mbytes = nil, ap_mac = nil) ⇒ Object
- #extend_guest_validity(guest_id) ⇒ Object
- #list_guests(within = 8760) ⇒ Object
- #set_guestlogin_settings(portal_enabled, portal_customized, redirect_enabled, redirect_url, x_password, expire_number, expire_unit, site_id) ⇒ Object
- #unauthorize_guest(mac) ⇒ Object
Instance Method Details
#authorize_guest(mac, minutes, up = nil, down = nil, mbytes = nil, ap_mac = nil) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/unifi_gem/client/guests.rb', line 45 def (mac, minutes, up = nil, down = nil, mbytes = nil, ap_mac = nil) body = { cmd: 'authorize-guest', mac: mac.downcase, minutes: minutes } body[:up] = up if up body[:down] = down if down body[:bytes] = mbytes if mbytes body[:ap_mac] = ap_mac if ap_mac response = self.class.post("/s/#{@site}/cmd/stamgr", { body: body.to_json }) response.parsed_response end |
#extend_guest_validity(guest_id) ⇒ Object
33 34 35 36 37 |
# File 'lib/unifi_gem/client/guests.rb', line 33 def extend_guest_validity(guest_id) body = { id: guest_id, cmd: 'extend' } response = self.class.get("/s/#{@site}/cmd/hotspot", { body: body.to_json }) response.parsed_response end |
#list_guests(within = 8760) ⇒ Object
7 8 9 10 11 |
# File 'lib/unifi_gem/client/guests.rb', line 7 def list_guests(within = 8760) body = { within: within } response = self.class.get("/s/#{@site}/stat/guest", { body: body.to_json }) response.parsed_response end |
#set_guestlogin_settings(portal_enabled, portal_customized, redirect_enabled, redirect_url, x_password, expire_number, expire_unit, site_id) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/unifi_gem/client/guests.rb', line 13 def set_guestlogin_settings(portal_enabled, portal_customized, redirect_enabled, redirect_url, x_password, expire_number, expire_unit, site_id) body = { portal_enabled: portal_enabled, portal_customized: portal_customized, redirect_enabled: redirect_enabled, redirect_url: redirect_url, x_password: x_password, expire_number: expire_number, expire_unit: expire_unit, site_id: site_id} response = self.class.get("/s/#{@site}/set/setting/guest_access", { body: body.to_json }) response.parsed_response end |
#unauthorize_guest(mac) ⇒ Object
39 40 41 42 43 |
# File 'lib/unifi_gem/client/guests.rb', line 39 def (mac) body = { cmd: 'unauthorize-guest', mac: mac.downcase } response = self.class.post("/s/#{@site}/cmd/stamgr", { body: body.to_json }) response.parsed_response end |