-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.rhtml
More file actions
51 lines (40 loc) · 1.47 KB
/
example.rhtml
File metadata and controls
51 lines (40 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/eruby
<%
#load required files
require 'iDrive.rb'
require 'rexml/document'
#create library instance
myapi = IDrive::IDriveAPI.new('delray_davis','vXpt952LZ')
#set parameters for the function
parameters = {}
puts '<strong>Validate Account<br /></strong>'
#call the appropriate function
result = myapi.execute("validateAccount",parameters)
#load the result into some form of XML parser
document = REXML::Document.new(result.body)
#point a variable at the XML tree root
result = document.root
#print out the status message
puts result.attributes['message']
puts '<br /><br /><strong>Get Server Address<br /></strong>'
parameters = {}
result = myapi.execute("getServerAddress",parameters)
puts '<br /><br /><strong>Configure Account<br /></strong>'
parameters = {"enctype" => "default", "pvtkey" => ""}
result = myapi.execute("configureAccount",parameters)
document = REXML::Document.new(result.body)
result = document.root
puts result.attributes['message']
puts '<br /><br /><strong>Validate Private Key<br /></strong>'
parameters = {"pvtkey" => ""}
result = myapi.execute("validatePvtKey",parameters)
document = REXML::Document.new(result.body)
result = document.root
puts result.attributes['message']
puts '<br /><br /><strong>Search Files<br /></strong>'
parameters = {"p"=>"/OWNER-PC","searchkey"=>"Chrysanthemum","trash"=>"yes"}
result = myapi.execute("searchFiles",parameters)
document = REXML::Document.new(result.body)
result = document.root
puts result.attributes['message']
%>