nvx-sds 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- # Limited Permissive License
2
- # September 05, 2007
1
+ # Nirvanix Public License
2
+ # May 15, 2009
3
3
  #
4
- # Nirvanix Licensing Limited Permissive License
4
+ # Nirvanix Public License
5
5
  #
6
6
  # This license governs use of the accompanying software. If you use the
7
7
  # software, you accept this license. If you do not accept the license,
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
  #= NVX::SDS
2
- #== A Ruby SDK for Nirvanix Storage Delivery System (SDS).
2
+ #== A Ruby SDK for Nirvanix
3
3
  #=== Getting the Library
4
4
  #==== Download with RubyGems
5
5
  #
@@ -30,13 +30,15 @@
30
30
  #
31
31
  #session = Session.new("APP-KEY", "USERNAME", "APP NAME", "PASSWORD")
32
32
  #
33
- #remote_file = "/TestUpload.txt"
33
+ #remote_file = "TestUpload.txt"
34
+ #remote_path = "/"
35
+ #overwrite = true
34
36
  #
35
37
  ##Get a file in the current directory
36
38
  #
37
39
  #local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + remote_file
38
40
  #
39
- #SoapUpload.UploadFile(remote_file, local_file, session.account_login)
41
+ #HttpUpload.UploadFile(remote_path, remote_file, local_file, overwrite, session.account_login)
40
42
  #
41
43
  #==== General File operations
42
44
  #There are many different file operations that are available once a file has been uploaded through the API. To get to these operations you can retrieve the root folder. The example below shows this and prints out each folder name.
data/RELEASENOTES ADDED
@@ -0,0 +1,8 @@
1
+ #= NVX::SDS
2
+ #== A Ruby SDK for Nirvanix
3
+ #=== Release Notes
4
+ #==== May 18, 2009 - 1.2.0
5
+ #
6
+ # * Added HttpUpload class for doing HTTP Post uploads. You should see about 30%-40% increase in upload using this class.
7
+ # * Fixed several Folder children bugs.
8
+ # * Made change password API calls execute as HTTPS.
@@ -10,7 +10,7 @@ module NVX
10
10
  module SDS
11
11
 
12
12
  $:.unshift File.dirname(__FILE__)
13
- require 'rexml/document'
13
+ require 'REXML/Document'
14
14
  include REXML
15
15
 
16
16
  # = Overview
@@ -15,21 +15,11 @@ module NVX
15
15
  def type
16
16
  @type
17
17
  end
18
-
19
- # Sets the limit type.
20
- def type=(type)
21
- @type=type
22
- end
23
18
 
24
19
  # Returns the value for the limit.
25
20
  def value
26
21
  @value
27
22
  end
28
-
29
- # Sets the value for the limit.
30
- def value=(value)
31
- @value=value
32
- end
33
23
  end
34
24
  end
35
25
  end
@@ -5,7 +5,7 @@ module NVX
5
5
  $:.unshift File.dirname(__FILE__)
6
6
  require 'fsfolderattributes'
7
7
  require 'fsfileattributes'
8
- require 'rexml/document'
8
+ require 'REXML/Document'
9
9
  include REXML
10
10
 
11
11
  # FSFolderList is an internal class used to extract file and folder information from a ListFolders call.
@@ -15,9 +15,10 @@ module NVX
15
15
 
16
16
  # The SoapTransfer class is used for upload. Since this method doesnt have a specific
17
17
  # file size limit other than the 256gb max file size limit this method is used instead of
18
- # the http upload which is limited to 2gb. This is due to the
18
+ # the http upload which is limited to 2gb.
19
19
  class SoapUpload
20
20
 
21
+ BLOCKSIZE = 1024*1024*4
21
22
  # Uploads a file in parts at a using a buffer of 65k.
22
23
  #
23
24
  # == Usage
@@ -39,7 +40,7 @@ module NVX
39
40
  # Loop through the entire file uploading each file part.
40
41
  while !file.eof?
41
42
  # Send a 65k file part to Nirvanix using the upload token.
42
- params = NVX::SDS::SOAP::AppendFile.new(upload_token, path, Base64.encode64(file.read(65536)), false)
43
+ params = NVX::SDS::SOAP::AppendFile.new(upload_token, path, Base64.encode64(file.read(BLOCKSIZE)), false)
43
44
  soap.appendFile(params)
44
45
  end
45
46
  # Send an empty data with a True for last packet, this finalizes the upload and will
@@ -51,16 +51,6 @@ module NVX
51
51
  return accountlimits
52
52
  end
53
53
 
54
- # Sets the limits from the array passed to the child username
55
- # Valid limit types are:
56
- def Utilities.SetAccountLimits(account_login, username, limits)
57
- params = [APIParam.new("username", username)]
58
- limits.each do |limit|
59
- params << APIParam.new(limit.type, limit.value)
60
- end
61
- doc = Transport.execute_command_post(APICommand.SetAccountLimits, params, account_login)
62
- end
63
-
64
54
  # Gets account usage extracting each usage type and creating a new AccountFeatureUsage object to contain each.
65
55
  def Utilities.GetAccountUsage(account_login, username)
66
56
  doc = Transport.execute_command_post(APICommand.GetAccountUsage, [APIParam.new("username", username)], account_login)
@@ -46,13 +46,13 @@ module NVX
46
46
 
47
47
  @@changepasswordcmd = nil
48
48
  def APICommand.ChangePassword
49
- @@changepasswordcmd = new("Authentication/ChangePassword.ashx", false) unless @@changepasswordcmd
49
+ @@changepasswordcmd = new("Authentication/ChangePassword.ashx", true) unless @@changepasswordcmd
50
50
  @@changepasswordcmd
51
51
  end
52
52
 
53
53
  @@setchildaccountpasswordcmd = nil
54
54
  def APICommand.SetChildAccountPassword
55
- @@setchildaccountpasswordcmd = new("Authentication/SetChildAccountPassword.ashx", false) unless @@setchildaccountpasswordcmd
55
+ @@setchildaccountpasswordcmd = new("Authentication/SetChildAccountPassword.ashx", true) unless @@setchildaccountpasswordcmd
56
56
  @@setchildaccountpasswordcmd
57
57
  end
58
58
 
@@ -125,17 +125,37 @@ module NVX
125
125
  end
126
126
 
127
127
  @@getuploadnodecmd = nil
128
+ # <b>DEPRECATED:</b> Please use <tt>GetStorageNode</tt> or <tt>GetStorageNodeExtended</tt> instead.
128
129
  def APICommand.GetUploadNode
129
130
  @@getuploadnodecmd = new("IMFS/GetUploadNode.ashx", false) unless @@getuploadnodecmd
130
131
  @@getuploadnodecmd
131
132
  end
133
+
134
+ @@getstoragenodecmd = nil
135
+ def APICommand.GetStorageNode
136
+ @@getstoragenodecmd = new("IMFS/GetStorageNode.ashx", false) unless @@getstoragenodecmd
137
+ @@getstoragenodecmd
138
+ end
139
+
140
+ @@getstoragenodeextendedcmd = nil
141
+ def APICommand.GetStorageNodeExtended
142
+ @@getstoragenodeextendedcmd = new("IMFS/GetStorageNodeExtended.ashx", false) unless @@getstoragenodeextendedcmd
143
+ @@getstoragenodeextendedcmd
144
+ end
132
145
 
133
146
  @@getdownloadlinkscmd = nil
147
+ # <b>DEPRECATED:</b> Please use <tt>GetOptimalURLs</tt> instead.
134
148
  def APICommand.GetDownloadLinks
135
149
  @@getdownloadlinkscmd = new("IMFS/GetDownloadLinks.ashx", false) unless @@getdownloadlinkscmd
136
150
  @@getdownloadlinkscmd
137
151
  end
138
-
152
+
153
+ @@getoptimalurlscmd = nil
154
+ def APICommand.GetOptimalURLs
155
+ @@getoptimalurlscmd = new("IMFS/GetOptimalURLs.ashx", false) unless @@getoptimalurlscmd
156
+ @@getoptimalurlscmd
157
+ end
158
+
139
159
  @@searchfilesystemcmd = nil
140
160
  def APICommand.SearchFileSystem
141
161
  @@searchfilesystemcmd = new("IMFS/SearchFileSystem.ashx", false) unless @@searchfilesystemcmd
@@ -87,13 +87,14 @@ module NVX
87
87
 
88
88
  params << APIParam.new("folderSortCode", folder_sort_code) if !folder_sort_code.nil?
89
89
  params << APIParam.new("shouldSortDescending", should_sort_descending) if !should_sort_descending.nil?
90
-
90
+
91
91
  result = Transport.execute_command_post(APICommand.ListFolder, params, account_login)
92
92
 
93
+ # add extra / to path to make absolute.
93
94
  p = Pathname.new(path)
94
-
95
+
95
96
  attributes = FSFolderAttributes.new(nil)
96
- attributes.EmptyRootFolder(p.basename, p.cleanpath, nil)
97
+ attributes.EmptyRootFolder(p.basename, "/" + p.cleanpath, nil)
97
98
 
98
99
  return Folder.new(account_login, FSFolderList.new(result.to_s), attributes)
99
100
  end
@@ -146,7 +147,9 @@ module NVX
146
147
  #empty the file and folder arrays.
147
148
  @files.clear
148
149
  @folders.clear
149
-
150
+
151
+ print Newline + Newline + "Path: " + @path + Newline
152
+
150
153
  params = [APIParam.new("pageNumber", page_number),
151
154
  APIParam.new("pageSize", page_size),
152
155
  APIParam.new("folderPath", @path)]
@@ -156,10 +159,15 @@ module NVX
156
159
 
157
160
  #retrieve the folder information for the current path
158
161
  result = Transport.execute_command_post(APICommand.ListFolder, params, @account_login)
159
-
162
+
160
163
  #Load the folderlist from the xml
161
164
  @fs_folder_list = FSFolderList.new(result.to_s)
162
-
165
+
166
+ @total_file_count = @fs_folder_list.total_file_count
167
+ @total_folder_count = @fs_folder_list.total_folder_count
168
+ @page_file_count = @fs_folder_list.page_file_count
169
+ @page_folder_count = @fs_folder_list.page_folder_count
170
+
163
171
  #load the folders array from the attributes
164
172
  @fs_folder_list.folder_attributes.each do |folderattrib|
165
173
  @folders << Folder.new(@account_login, nil, folderattrib)
@@ -0,0 +1,114 @@
1
+ # = Overview
2
+ #
3
+ # The HttpUpload is used to upload files via HTTP POST. This class can upload a maximum of 256gb.
4
+ module NVX
5
+ module SDS
6
+
7
+ $:.unshift File.dirname(__FILE__)
8
+ require 'apiparam'
9
+ require 'apicommand'
10
+ require 'apiclasses/responsecodes'
11
+ require 'net/https'
12
+ require 'net/http'
13
+ require 'REXML/Document'
14
+ require 'uri'
15
+
16
+ USERAGENT = "Nirvanix Ruby SDK"
17
+ Newline = "\r\n" unless const_defined? "Newline"
18
+ # upload 4 Mb chunks. 4 Mb is usually quite efficient but you may want to change this
19
+ # to a larger value if you are on a very fast connection or have very high latency.
20
+ BLOCKSIZE = 1024 * 1024 * 4
21
+
22
+ # = Overview
23
+ #
24
+ # The HttpUpload is used to upload files via HTTP POST. This class can upload a maximum of 256gb.
25
+ class HttpUpload
26
+ # Uploads a file to a destination and allows you to call overwrite.
27
+ def HttpUpload.UploadFile(destination_path, destination_filename, local_path, overwrite, account_login)
28
+ # Get the Upload node passing in the total file size.
29
+ file_size = File.size(local_path)
30
+ params = Array.new
31
+ params << APIParam.new("sizeBytes", file_size)
32
+ params << APIParam.new("destFolderPath", destination_path)
33
+ params << APIParam.new("fileOverwrite", overwrite)
34
+
35
+ result = Transport.execute_command_post(APICommand.GetStorageNodeExtended, params, account_login)
36
+
37
+ # extract the upload token, host name and build a new transfer object.
38
+ upload_token = result.root.elements["//UploadToken"].get_text.value
39
+ node = result.root.elements["//UploadHost"].get_text.value
40
+ # set the URL based on the node that was returned from Nirvanix.
41
+
42
+ # Open the local file
43
+ file = File.open(local_path, "rb")
44
+ offset = 0
45
+ path = "/upload.ashx?uploadToken=#{upload_token}&destFolderPath=#{destination_path}"
46
+ # Loop through the entire file uploading each file part.
47
+ while !file.eof?
48
+ # read a chunk of data from the file.
49
+ file_data = file.read(BLOCKSIZE)
50
+ # Send a chunk to Nirvanix using the upload token and node.
51
+ params = post_data(node, path, destination_filename, file_data, offset, file_size, false)
52
+ # advance offset based on how much data was read.
53
+ # TODO: Catch any exceptions and build in retry logic to read from a specific offset and retry last chunk.
54
+ offset += file_data.length
55
+ end
56
+ end
57
+
58
+ # A method to execute a nirvanix command with the parameters passed via a POST HTTP call.
59
+ def HttpUpload.post_data(node, path, filename, file_data, offset, file_size, is_secure)
60
+
61
+ # setup headers including content-range to tell the upload what chunk we are uploading.
62
+ boundary = "XYZBOUNDARY23487844XYZBOUNDARY1234567889"
63
+
64
+ # setup the HTTP post data.
65
+ content = "--" + boundary + "\r\n" +
66
+ "Content-Disposition: form-data; name=\"File1\"; filename=\"#{filename}\"\r\n" +
67
+ "Content-Transfer-Encoding: binary\r\n" +
68
+ "Content-Type: application/octet-stream\r\n" +
69
+ "\r\n" +
70
+ "#{file_data}\r\n" +
71
+ "--" + boundary + "--\r\n"
72
+
73
+ # pass headers including Content-Range to define the chunk that is being sent.
74
+ headers = {
75
+ 'Content-Range' => "#{offset}-#{file_data.length - 1}/#{file_size}",
76
+ 'Content-Type' => "multipart/form-data; boundary=#{boundary}",
77
+ 'User-Agent' => USERAGENT
78
+ }
79
+
80
+ # set the port based on the is_secure flag.
81
+ port = is_secure ? 443 : 80
82
+
83
+ # Create the first http(s) object.
84
+ h = Net::HTTP.new(node, port).start
85
+
86
+ # if you are just testing and do not have a SSL certificate setup properly you can
87
+ # disable warnings with the below line. Just uncomment to ignore SSL session warnings.
88
+ h.verify_mode = OpenSSL::SSL::VERIFY_NONE if is_secure
89
+
90
+ # put the SSL in the correct mode based on the apicommand
91
+ h.use_ssl = is_secure
92
+
93
+ # do the upload and return the response.
94
+ req = Net::HTTP::Post.new(path, headers)
95
+ req.content_length = content.length
96
+ req.content_type = "multipart/form-data; boundary=#{boundary}"
97
+ req.body = content
98
+ response = h.request(req)
99
+
100
+ #print "RESPONSE XML: " + response.body + "\r\n\r\n"
101
+
102
+ # read the xml document and get any errors that are returned.
103
+ doc = REXML::Document.new(response.body)
104
+ response_code = (text = doc.root.elements["//Response/ResponseCode"].get_text and text.value)
105
+
106
+ if response_code.to_i != 0
107
+ error_message = (text = doc.root.elements["//Response/ErrorMessage"].get_text and text.value)
108
+ raise error_message
109
+ end
110
+ return doc
111
+ end
112
+ end
113
+ end
114
+ end
@@ -84,24 +84,6 @@ module NVX
84
84
  return (text = doc.root.elements["//Response/GetAccountNotes"].get_text and text.value)
85
85
  end
86
86
 
87
- # Gets the account limits as an array of AccountLimit objects of the child account passed.
88
- def GetAccountLimits(username)
89
- Utilities.GetAccountLimits(@account_login, username)
90
- end
91
-
92
- #
93
- # Sets the account limits from the array of AccountLimit objects passed on the username.
94
- # Valid limit types:
95
- #
96
- # * StorageAmount - The total bytes stored.
97
- # * DownloadBandwidthAmount - The total number of bytes that can be downloaded per pay period.
98
- # * FileSizeDownloadLimit - The maximum size in bytes of a file that can be downlaoded.
99
- # * UploadBandwidthAmount - The total number of bytes that can be uploaded per pay period.
100
- #
101
- def SetAccountLimits(username, limits)
102
- Utilities.SetAccountLimits(@account_login, username, limits)
103
- end
104
-
105
87
  # Set the account notes. This method expects properly formated xml. Be sure to escape any invalid characters.
106
88
  def SetAccountNotes(username, xml_notes)
107
89
  params = [APIParam.new("username", username),
@@ -11,7 +11,7 @@ module NVX
11
11
  require 'apiclasses/responsecodes'
12
12
  require 'net/https'
13
13
  require 'net/http'
14
- require 'rexml/document'
14
+ require 'REXML/Document'
15
15
  require 'uri'
16
16
 
17
17
  Newline = "\r\n" unless const_defined? "Newline"
data/lib/nvx_sds.rb CHANGED
@@ -15,6 +15,8 @@ require File.join( dir, "session" )
15
15
  require File.join( dir, "searchitem" )
16
16
  require File.join( dir, "transport" )
17
17
  require File.join( dir, "masteraccount" )
18
+ # this will be removed soon as the SOAP upload is obsolete.
18
19
  require File.join( dir, "apiclasses/soapupload" )
20
+ require File.join( dir, "apiclasses/httpupload" )
19
21
  require File.join( dir, "apiclasses/fsfolderlist" )
20
22
  require File.join( dir, "apiclasses/metadatainfo" )
@@ -20,12 +20,12 @@ class APICommandTest < Test::Unit::TestCase
20
20
 
21
21
  def test_ChangePassword
22
22
  assert APICommand.ChangePassword.command_path == "Authentication/ChangePassword.ashx"
23
- assert !APICommand.ChangePassword.is_secure?
23
+ assert APICommand.ChangePassword.is_secure?
24
24
  end
25
25
 
26
26
  def test_SetChildAccountPassword
27
27
  assert APICommand.SetChildAccountPassword.command_path == "Authentication/SetChildAccountPassword.ashx"
28
- assert !APICommand.SetChildAccountPassword.is_secure?
28
+ assert APICommand.SetChildAccountPassword.is_secure?
29
29
  end
30
30
 
31
31
  #IMFS Namespace tests
@@ -84,14 +84,31 @@ class APICommandTest < Test::Unit::TestCase
84
84
  assert !APICommand.GetDownloadNodes.is_secure?
85
85
  end
86
86
 
87
- def test_GetUploadNode
88
- assert APICommand.GetUploadNode.command_path == "IMFS/GetUploadNode.ashx"
89
- assert !APICommand.GetUploadNode.is_secure?
90
- end
87
+ # OBSOLETE Use GetStorageNode or GetStorageNodeExtended
88
+ #def test_GetUploadNode
89
+ # assert APICommand.GetUploadNode.command_path == "IMFS/GetUploadNode.ashx"
90
+ # assert !APICommand.GetUploadNode.is_secure?
91
+ #end
91
92
 
92
- def test_GetDownloadLinks
93
- assert APICommand.GetDownloadLinks.command_path == "IMFS/GetDownloadLinks.ashx"
94
- assert !APICommand.GetDownloadLinks.is_secure?
93
+ def test_GetStorageNode
94
+ assert APICommand.GetStorageNode.command_path == "IMFS/GetStorageNode.ashx"
95
+ assert !APICommand.GetStorageNode.is_secure?
96
+ end
97
+
98
+ def test_GetStorageNodeExtended
99
+ assert APICommand.GetStorageNodeExtended.command_path == "IMFS/GetStorageNodeExtended.ashx"
100
+ assert !APICommand.GetStorageNodeExtended.is_secure?
101
+ end
102
+
103
+ # OBSOLETE Use GetOptimalURLs
104
+ #def test_GetDownloadLinks
105
+ # assert APICommand.GetDownloadLinks.command_path == "IMFS/GetDownloadLinks.ashx"
106
+ # assert !APICommand.GetDownloadLinks.is_secure?
107
+ #end
108
+
109
+ def test_GetOptimalURLs
110
+ assert APICommand.GetOptimalURLs.command_path == "IMFS/GetOptimalURLs.ashx"
111
+ assert !APICommand.GetOptimalURLs.is_secure?
95
112
  end
96
113
 
97
114
  def test_SearchFileSystem
data/tests/foldertest.rb CHANGED
@@ -12,16 +12,32 @@ class FolderTest < Test::Unit::TestCase
12
12
  include NVX::SDS
13
13
 
14
14
  Newline = "\r\n"
15
-
15
+
16
16
  def test_Folder
17
17
 
18
18
  session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
19
- #page_number, page_size, folder_sort_code, should_sort_descending)
20
19
  root_folder = session.GetRootFolder(1, 500, "Name", true)
21
- print "total_folder_count" + root_folder.total_folder_count.to_s
20
+ print "total_folder_count" + root_folder.total_folder_count.to_s + Newline;
21
+ print "total_file_count" + root_folder.total_file_count.to_s + Newline;
22
+ print "page_folder_count" + root_folder.page_folder_count.to_s + Newline;
23
+ print "page_file_count" + root_folder.page_file_count.to_s + Newline;
24
+
22
25
  assert root_folder.total_folder_count > 0
23
26
  end
24
27
 
28
+ def test_SubFolder
29
+ # child a subfolder so we can verify the load children works.
30
+
31
+ session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
32
+ root_folder = session.GetRootFolder(1, 500, "Name", true)
33
+ subfolder = root_folder.folders[0];
34
+ subfolder.LoadChildren(1, 500);
35
+ print "total_folder_count" + subfolder.total_folder_count.to_s + Newline;
36
+ print "total_file_count" + subfolder.total_file_count.to_s + Newline;
37
+ print "page_folder_count" + subfolder.page_folder_count.to_s + Newline;
38
+ print "page_file_count" + subfolder.page_file_count.to_s + Newline;
39
+ end
40
+
25
41
  def test_FolderSideload
26
42
 
27
43
  session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
@@ -31,5 +47,4 @@ class FolderTest < Test::Unit::TestCase
31
47
  # since this is done as a background process we can't check the results just the initial call.
32
48
  end
33
49
 
34
-
35
50
  end
data/tests/testconfig.rb CHANGED
@@ -2,13 +2,18 @@
2
2
  # If you do not already have a Nirvanix account go to http://nmp.nirvanix.com/ and sign up.
3
3
 
4
4
  # Replace these values with your own to run unit tests.
5
- APP_KEY = "E91A7EC7-6714-4BB7-B7A4-61644854C523"
6
- APP_NAME = "test app"
5
+ APP_KEY = "ABCD-YOURAPPKEY-ABCD-123567-ABCD"
6
+ APP_NAME = "YOURAPPNAME"
7
7
 
8
8
  # Below is the information for testing a child or master account.
9
- USERNAME = "rubytest"
10
- PASSWORD = "testpass"
9
+ USERNAME = "USERNAME"
10
+ PASSWORD = "PASSWORD"
11
11
 
12
12
  # Below is the master account information for testing the master account calls.
13
- MASTERUSERNAME = "masterrubytest"
14
- MASTERPASSWORD = "testpass"
13
+ MASTERUSERNAME = "MASTERUSERNAME"
14
+ MASTERPASSWORD = "MASTERPASSWORD"
15
+
16
+ # Below is the master account information for testing the master account calls.
17
+ UPLOADPATH = "/"
18
+ UPLOADFILE = "TestUpload.txt"
19
+ UPLOADFILELARGE = "LargeFile.dat"
@@ -4,6 +4,7 @@ require 'nvx_sds'
4
4
 
5
5
  class Unittests < Test::Unit::TestCase
6
6
 
7
+
7
8
  # This unit test accesses the Gem library rather than directly at the source, this
8
9
  # Tests that the Gem is properly installed and shows how to require the gem and use it.
9
10
  def test_LoginGem
data/tests/uploadtest.rb CHANGED
@@ -4,19 +4,55 @@ $:.unshift File.dirname(__FILE__) + '/../lib/nvx/sds/'
4
4
  require 'session'
5
5
  require 'REXML/Document'
6
6
  require 'soapupload'
7
+ require 'httpupload'
7
8
  require File.dirname(__FILE__) + '/testconfig'
8
9
  include REXML
9
10
 
10
11
  class Uploadtest < Test::Unit::TestCase
11
12
  include NVX::SDS
12
- def test_UploadFile
13
+ def test_SoapUploadFile
13
14
  session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
14
15
 
16
+ start_time = Time.now
15
17
  remote_file = "/TestUpload.txt"
16
- local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + remote_file
17
- print local_file
18
- SoapUpload.UploadFile(remote_file, local_file, session.account_login)
18
+ local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + "/" + UPLOADFILE
19
+ SoapUpload.UploadFile(UPLOADPATH + UPLOADFILE, local_file, session.account_login)
20
+ print "\r\nSoapUploadFile: #{Time.now - start_time}\r\n"
19
21
  # remove file after uploading
20
- session.DeleteFiles([remote_file])
22
+ session.DeleteFiles([UPLOADPATH + UPLOADFILE])
23
+ end
24
+
25
+ def test_SoapUploadFileLarge
26
+ session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
27
+
28
+ start_time = Time.now
29
+ remote_file = "/TestUpload.txt"
30
+ local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + "/" + UPLOADFILELARGE
31
+ SoapUpload.UploadFile(UPLOADPATH + UPLOADFILELARGE, local_file, session.account_login)
32
+ print "\r\nSoapUploadFileLarge: #{Time.now - start_time}\r\n"
33
+ # remove file after uploading
34
+ session.DeleteFiles([UPLOADPATH + UPLOADFILELARGE])
35
+ end
36
+
37
+ def test_HTTPUploadFile
38
+ session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
39
+
40
+ start_time = Time.now
41
+ local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + "/" + UPLOADFILE
42
+ HttpUpload.UploadFile(UPLOADPATH, UPLOADFILE, local_file, true, session.account_login)
43
+ print "\r\nHttpUploadFile: #{Time.now - start_time}\r\n"
44
+ # remove file after uploading
45
+ session.DeleteFiles([UPLOADPATH + UPLOADFILE])
46
+ end
47
+
48
+ def test_HTTPUploadFileLarge
49
+ session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
50
+
51
+ start_time = Time.now
52
+ local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + "/" + UPLOADFILELARGE
53
+ HttpUpload.UploadFile(UPLOADPATH, UPLOADFILELARGE, local_file, true, session.account_login)
54
+ print "\r\nHttpUploadFileLarge: #{Time.now - start_time}\r\n"
55
+ # remove file after uploading
56
+ session.DeleteFiles([UPLOADPATH + UPLOADFILELARGE])
21
57
  end
22
58
  end
metadata CHANGED
@@ -1,33 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: nvx-sds
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2007-10-22 00:00:00 -07:00
8
- summary: A package for accessing the Nirvanix SDS allowing remote file storage, retrieval and account operations.
9
- require_paths:
10
- - lib
11
- email: barry @nospam@ nirvanix.com
12
- homepage: http://nvx-sds.rubyforge.org/
13
- rubyforge_project: nvx-sds
14
- description:
15
- autorequire: nvx_sds
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.2.0
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Barry Ruffner
8
+ autorequire: nvx_sds
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-18 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: barry @nospam@ nirvanix.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README
25
+ - RELEASENOTES
31
26
  files:
32
27
  - lib/nvx_sds.rb
33
28
  - lib/nvx/sds/accountlogin.rb
@@ -36,26 +31,27 @@ files:
36
31
  - lib/nvx/sds/countries.rb
37
32
  - lib/nvx/sds/folder.rb
38
33
  - lib/nvx/sds/hosteditem.rb
34
+ - lib/nvx/sds/httpupload.rb
39
35
  - lib/nvx/sds/itembase.rb
40
36
  - lib/nvx/sds/masteraccount.rb
41
37
  - lib/nvx/sds/nvxfile.rb
42
38
  - lib/nvx/sds/searchitem.rb
43
39
  - lib/nvx/sds/session.rb
44
40
  - lib/nvx/sds/transport.rb
45
- - lib/nvx/sds/apiclasses/accountfeatureusage.rb
46
- - lib/nvx/sds/apiclasses/accountinfo.rb
47
- - lib/nvx/sds/apiclasses/accountlimit.rb
48
- - lib/nvx/sds/apiclasses/contactinfo.rb
49
- - lib/nvx/sds/apiclasses/fsfileattributes.rb
50
- - lib/nvx/sds/apiclasses/fsfolderattributes.rb
51
- - lib/nvx/sds/apiclasses/fsfolderlist.rb
52
- - lib/nvx/sds/apiclasses/metadatainfo.rb
53
- - lib/nvx/sds/apiclasses/responsecodes.rb
54
- - lib/nvx/sds/apiclasses/soapupload.rb
55
- - lib/nvx/sds/apiclasses/utilities.rb
56
- - lib/nvx/sds/soap/default.rb
57
- - lib/nvx/sds/soap/defaultDriver.rb
58
- - lib/nvx/sds/soap/TransferClient.rb
41
+ - lib/nvx/sds/APIClasses/accountfeatureusage.rb
42
+ - lib/nvx/sds/APIClasses/accountinfo.rb
43
+ - lib/nvx/sds/APIClasses/accountlimit.rb
44
+ - lib/nvx/sds/APIClasses/contactinfo.rb
45
+ - lib/nvx/sds/APIClasses/fsfileattributes.rb
46
+ - lib/nvx/sds/APIClasses/fsfolderattributes.rb
47
+ - lib/nvx/sds/APIClasses/fsfolderlist.rb
48
+ - lib/nvx/sds/APIClasses/metadatainfo.rb
49
+ - lib/nvx/sds/APIClasses/responsecodes.rb
50
+ - lib/nvx/sds/APIClasses/soapupload.rb
51
+ - lib/nvx/sds/APIClasses/utilities.rb
52
+ - lib/nvx/sds/SOAP/default.rb
53
+ - lib/nvx/sds/SOAP/defaultDriver.rb
54
+ - lib/nvx/sds/SOAP/TransferClient.rb
59
55
  - tests/accountlogintest.rb
60
56
  - tests/apicommandtest.rb
61
57
  - tests/apiparamtest.rb
@@ -71,6 +67,37 @@ files:
71
67
  - tests/uploadtest.rb
72
68
  - LICENSE
73
69
  - README
70
+ - RELEASENOTES
71
+ has_rdoc: true
72
+ homepage: http://nvx-sds.rubyforge.org/
73
+ post_install_message:
74
+ rdoc_options:
75
+ - --exclude
76
+ - definitions
77
+ - --exclude
78
+ - indexes
79
+ - --inline-source
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: "0"
93
+ version:
94
+ requirements: []
95
+
96
+ rubyforge_project: nvx-sds
97
+ rubygems_version: 1.0.1
98
+ signing_key:
99
+ specification_version: 2
100
+ summary: A package for accessing Nirvanix allowing remote file storage, retrieval and account operations.
74
101
  test_files:
75
102
  - tests/accountlogintest.rb
76
103
  - tests/apicommandtest.rb
@@ -84,20 +111,3 @@ test_files:
84
111
  - tests/transporttest.rb
85
112
  - tests/unittests_gemtest.rb
86
113
  - tests/uploadtest.rb
87
- rdoc_options:
88
- - --exclude
89
- - definitions
90
- - --exclude
91
- - indexes
92
- - --inline-source
93
- extra_rdoc_files:
94
- - LICENSE
95
- - README
96
- executables: []
97
-
98
- extensions: []
99
-
100
- requirements: []
101
-
102
- dependencies: []
103
-
File without changes
File without changes
File without changes