Sha256: 957b04d888a849ec1dcfee294a9d23ef89580f9351bf873a53928e3a6f6596dd
Contents?: true
Size: 1.62 KB
Versions: 6
Compression:
Stored size: 1.62 KB
Contents
require 'HTTParty' class DeviceDetails def get_device_details device_names = self.process_android_devices android_device_details = find_android_devices(device_names) ios_device_details = process_ios_devices p "IOS Devices = #{ios_device_details}" p "IOS Devices = #{ios_device_details.length}" device_details = android_device_details+ios_device_details device_details end def process_android_devices devices = `adb devices` query = { deviceLog: devices }.to_json puts query headers = { 'Content-Type': "Application/json" } response = HTTParty.post('http://localhost:9099/processDevices', body: query, headers: headers) end def process_ios_devices devices = `instruments -s devices | grep 'iPhone'` p devices body = { deviceLog: devices }.to_json headers = { 'Content-Type': "Application/json" } response = HTTParty.post('http://localhost:9099/processIosDevices', body: body, headers: headers) p response res = JSON.parse(response.to_s) return res end def find_android_devices(device_names) res = JSON.parse(device_names.to_s) device_details = [] res.each do |a| device_model = `adb -s #{a['udid']} shell getprop ro.product.model` device_os_version = `adb -s #{a['udid']} shell getprop ro.build.version.release` a['deviceName'] = device_model.to_s.rstrip a['platformVersion'] = device_os_version.to_s.rstrip a["platform"] = "ANDROID" device_details.push(a) end device_details end end div_details = DeviceDetails.new details = div_details.get_device_details p details
Version data entries
6 entries across 6 versions & 1 rubygems