Class: MrMurano::ProductSerialNumber
Instance Method Summary
collapse
Methods inherited from ProductBase
#endPoint
Methods included from Verbose
#debug, #error, #outf, #tabularize, #verbose, #warning
Methods included from Http
#curldebug, #delete, #get, #http, #http_reset, #isJSON, #json_opts, #post, #postf, #put, #set_def_headers, #showHttpError, #token, #workit
Constructor Details
Returns a new instance of ProductSerialNumber.
284
285
286
287
288
289
290
291
|
# File 'lib/MrMurano/Product.rb', line 284
def initialize
super
@uriparts << :proxy
@uriparts << :provision
@uriparts << :manage
@uriparts << :model
@uriparts << @pid
end
|
Instance Method Details
#activate(sn) ⇒ Object
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
# File 'lib/MrMurano/Product.rb', line 311
def activate(sn)
uri = URI("https://#{@pid}.m2.exosite.com/provision/activate")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.start
request = Net::HTTP::Post.new(uri)
request.form_data = {
:vendor => @pid,
:model => @pid,
:sn => sn
}
request['User-Agent'] = "MrMurano/#{MrMurano::VERSION}"
request['Authorization'] = nil
request.content_type = 'application/x-www-form-urlencoded; charset=utf-8'
curldebug(request)
response = http.request(request)
case response
when Net::HTTPSuccess
return response.body
else
showHttpError(request, response)
end
end
|
#add_range ⇒ Object
351
352
353
|
# File 'lib/MrMurano/Product.rb', line 351
def add_range()
post('/', {:ranges=>[ ]})
end
|
#add_sn(sn, extra = '') ⇒ Object
335
336
337
338
339
340
|
# File 'lib/MrMurano/Product.rb', line 335
def add_sn(sn, ='')
postf('/', {:sn=>sn,:extra=>})
end
|
#disable(sn) ⇒ Object
307
308
309
|
# File 'lib/MrMurano/Product.rb', line 307
def disable(sn)
postf("/#{sn}", {:disable=>true})
end
|
#list(offset = 0, limit = 1000) ⇒ Object
293
294
295
296
297
|
# File 'lib/MrMurano/Product.rb', line 293
def list(offset=0, limit=1000)
ret = get("/?offset=#{offset}&limit=#{limit}&status=true")
return [] if ret.kind_of?(Hash)
CSV.parse(ret)
end
|
#logs(sn) ⇒ Object
299
300
301
|
# File 'lib/MrMurano/Product.rb', line 299
def logs(sn)
get("/#{sn}?show=log") end
|
#ranges ⇒ Object
347
348
349
|
# File 'lib/MrMurano/Product.rb', line 347
def ranges
get('/?show=ranges')
end
|
#regen(sn) ⇒ Object
303
304
305
|
# File 'lib/MrMurano/Product.rb', line 303
def regen(sn)
postf("/#{sn}", {:enable=>true})
end
|
#remove_sn(sn) ⇒ Object
342
343
344
345
|
# File 'lib/MrMurano/Product.rb', line 342
def remove_sn(sn)
delete("/#{sn}")
end
|