Class: TestdroidAPI::DeviceSession

Inherits:
CloudResource show all
Defined in:
lib/testdroid_api/device_sessions.rb

Instance Method Summary collapse

Methods inherited from CloudResource

#camel_case_it, #delete, #download_file, #inspect, #method_missing, #refresh, #set_up_properties_from, #snake_case_it, #sub_items, #update

Constructor Details

#initialize(uri, client, params = {}) ⇒ DeviceSession

Returns a new instance of DeviceSession.



5
6
7
8
# File 'lib/testdroid_api/device_sessions.rb', line 5

def initialize(uri, client, params = {})
  super uri, client, "deviceSession", params
  @uri, @client = uri, client
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TestdroidAPI::CloudResource

Instance Method Details

#download_all_files(path) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/testdroid_api/device_sessions.rb', line 14

def download_all_files(path)
  Dir.mkdir(path) unless Dir.exist?(path)
  files = @client.get("#{@uri}/output-file-set/files")
  files['data'].each do |file|
    @client.download(file['directUrl'], ::File.join(path, "#{file['id']}-#{file['name']}"))
  end
end

#releaseObject



10
11
12
# File 'lib/testdroid_api/device_sessions.rb', line 10

def release
  @client.post("#{@uri}/release", params = {})
end