Class: Asca::REST::Provisioning::Devices
- Inherits:
-
Object
- Object
- Asca::REST::Provisioning::Devices
- Defined in:
- lib/asca/rest/provisioning/devices.rb
Class Method Summary collapse
Class Method Details
.list_devices ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/asca/rest/provisioning/devices.rb', line 9 def list_devices response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_DEVICES, :params => { "limit": 200 }) if response.status.success? devices = JSON.parse(response.body) puts "device count #{devices["data"].length()}" return devices["data"] end return nil end |
.register_new_device(options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/asca/rest/provisioning/devices.rb', line 19 def register_new_device( = {}) udid = [:udid] name = [:name] response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).post(URI_DEVICES, :json => { "data" => { "type" => "devices", "attributes" => { "name" => name, "platform" => "IOS", "udid" => udid } }}) if response.status.success? return true else Asca::Tools::Log.error(response.body) return false end end |