module Testcloud::Devices::Resources

Public Instance Methods

categories() click to toggle source

Return all available categories for a given device type

# File lib/testcloud/devices/resources.rb, line 14
def categories
  @raw_response = self.class.get("/devices/#{type.pluralize}/categories", access_headers)
  @response = Response.new(@raw_response).keys
end
form_data() click to toggle source

Get form data for a type and category (such as os, os_version, vendor, device models)

# File lib/testcloud/devices/resources.rb, line 27
def form_data
  @raw_response = self.class.get("/devices/#{type}/#{category}/form_data", access_headers)
  @response = Response.new(@raw_response)
end
report_missing_device(data = {}) click to toggle source

Submit a device that's missing from the database

# File lib/testcloud/devices/resources.rb, line 33
def report_missing_device(data = {})
  @raw_response = self.class.post("/devices/report_missing", access_headers.merge(body: data.to_json))
  @response = Response.new(@raw_response)
end
types() click to toggle source

Return all available device types

# File lib/testcloud/devices/resources.rb, line 9
def types
  @raw_response = @response = self.class.get('/devices/types', access_headers)
end
validate(data = {}) click to toggle source

Takes device parameters, validates them, and returns the correct device hash an 'errors' key is always present if anything goes wrong.

# File lib/testcloud/devices/resources.rb, line 21
def validate(data = {})
  @raw_response = self.class.post("/devices/#{type}/#{category}", access_headers.merge(body: data.to_json))
  @response = Response.new(@raw_response)
end