Class: TestdroidAPI::Files

Inherits:
CloudResource show all
Defined in:
lib/testdroid_api/files.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 = {}) ⇒ Files

Returns a new instance of Files.



4
5
6
7
8
9
# File 'lib/testdroid_api/files.rb', line 4

def	initialize(uri, client, params= {})

	super uri, client,"files", 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

#uploadApplication(filename, mime_type = "application/vnd.android.package-archive") ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/testdroid_api/files.rb', line 11

def uploadApplication(filename, mime_type = "application/vnd.android.package-archive")
	if !File.exist?(filename)
		@client.logger.error( "Invalid filename")
		return
	end
	reply = @client.upload("#{@uri}/application", filename, mime_type)

	Application.new(nil, nil, reply)
end

#uploadData(filename, mime_type = "application/zip") ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/testdroid_api/files.rb', line 20

def uploadData(filename, mime_type = "application/zip")
	if !File.exist?(filename)
		@client.logger.error( "Invalid filename")
		return
	end
	reply = @client.upload("#{@uri}/data", filename, mime_type)

	Data.new(nil, nil, reply)
end

#uploadTest(filename, mime_type = "application/vnd.android.package-archive") ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/testdroid_api/files.rb', line 29

def uploadTest(filename, mime_type = "application/vnd.android.package-archive")
	if !File.exist?(filename)
		@client.logger.error( "Invalid filename")
		return
	end
	reply = @client.upload("#{@uri}/test", filename, mime_type)

	Test.new(nil, nil, reply)
end