Class: OpenSTF::Client::Service
- Inherits:
-
Object
- Object
- OpenSTF::Client::Service
- Defined in:
- lib/openstf/client.rb
Instance Method Summary collapse
- #connect_device(serial:) ⇒ Object
- #disconnect_device(serial:) ⇒ Object
- #fetch_available_devices ⇒ Object
-
#initialize(service) ⇒ Service
constructor
A new instance of Service.
Constructor Details
#initialize(service) ⇒ Service
Returns a new instance of Service.
27 28 29 |
# File 'lib/openstf/client.rb', line 27 def initialize(service) @service = service end |
Instance Method Details
#connect_device(serial:) ⇒ Object
45 46 47 48 |
# File 'lib/openstf/client.rb', line 45 def connect_device(serial:) d = Device.new(serial: serial) d.connect end |
#disconnect_device(serial:) ⇒ Object
50 51 52 53 |
# File 'lib/openstf/client.rb', line 50 def disconnect_device(serial:) d = Device.new(serial: serial) d.disconnect end |
#fetch_available_devices ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/openstf/client.rb', line 31 def fetch_available_devices devices = OpenSTF::Client::Devices.get_devices.body['devices'] available = devices.reject do |device| !device['present'] || !device['ready'] || device['using'] || device['owner'] end @devices = available.map do |d| Device.new(data: d, serial: d['serial']) end @devices end |