module UnifiGem::Client::Vouchers
Public Instance Methods
create_voucher(options = {})
click to toggle source
# File lib/unifi_gem/client/vouchers.rb, line 7 def create_voucher(options = {}) body = { cmd: 'create-voucher', expire: options[:expire] ||= 120, n: options[:amount] ||= 1, quota: options[:quota] ||= 1 } body[:note] = options[:note] if options[:note] body[:up] = options[:up] if options[:up] body[:down] = options[:down] if options[:down] body[:bytes] = options[:bytes] if options[:bytes] response = self.class.post("/s/#{@site}/cmd/hotspot", { body: body.to_json } ) response.parsed_response end
revoke_voucher(voucher_id = nill)
click to toggle source
# File lib/unifi_gem/client/vouchers.rb, line 28 def revoke_voucher(voucher_id = nill) body = { cmd: 'delete-voucher', _id: voucher_id } response = self.class.post("/s/#{@site}/cmd/hotspot", { body: body.to_json } ) response.parsed_response end
stat_voucher(create_time = nill)
click to toggle source
# File lib/unifi_gem/client/vouchers.rb, line 21 def stat_voucher(create_time = nill) body = { create_time: create_time } response = self.class.get("/s/#{@site}/stat/voucher", { body: body.to_json }) response.parsed_response end