class Ruby::Miradore::Device
Public Instance Methods
location(**args)
click to toggle source
# File lib/ruby/miradore.rb, line 113 def location(**args) http_method(args.merge(method: :get, action: __method__)) end
lock(**args)
click to toggle source
# File lib/ruby/miradore.rb, line 93 def lock(**args) http_method(args.merge(method: :post, id: id, action: __method__)) end
lostmode(**args)
click to toggle source
# File lib/ruby/miradore.rb, line 97 def lostmode(**args) if args[0] http_method(args.merge(method: :post, id: id, action: __method__)) else http_method(args.merge(method: :delete, id: id, action: __method__)) end end
patch(**args)
click to toggle source
# File lib/ruby/miradore.rb, line 117 def patch(**args) http_method(args.merge(method: :patch)) end
reboot(**args)
click to toggle source
# File lib/ruby/miradore.rb, line 105 def reboot(**args) http_method(args.merge(method: :post, id: id, action: __method__)) end
wipe(**args)
click to toggle source
# File lib/ruby/miradore.rb, line 109 def wipe(**args) http_method(args.merge(method: :post, id: id, action: __method__)) end
Private Instance Methods
http_method(**args)
click to toggle source
# File lib/ruby/miradore.rb, line 123 def http_method(**args) self.class.headers "X-API-Key" => @auth || args[:auth] url = Miradore.url[:v2] % { subdomain: @subdomain || args[:subdomain], id: args.fetch(:id, id), method: args.fetch(:action, nil) } self.class.method(args.fetch(:method, nil)).call(url, body: JSON.generate(args.fetch(:body, {}))) rescue StandardError => e { error: e&.message || "Error connecting to manager service provider", status: :not_found } end