nvx-sds 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +64 -0
- data/README +80 -0
- data/lib/nvx/sds/APIClasses/accountfeatureusage.rb +60 -0
- data/lib/nvx/sds/APIClasses/accountinfo.rb +30 -0
- data/lib/nvx/sds/APIClasses/accountlimit.rb +25 -0
- data/lib/nvx/sds/APIClasses/contactinfo.rb +74 -0
- data/lib/nvx/sds/APIClasses/fsfileattributes.rb +50 -0
- data/lib/nvx/sds/APIClasses/fsfolderattributes.rb +53 -0
- data/lib/nvx/sds/APIClasses/fsfolderlist.rb +70 -0
- data/lib/nvx/sds/APIClasses/metadatainfo.rb +26 -0
- data/lib/nvx/sds/APIClasses/responsecodes.rb +97 -0
- data/lib/nvx/sds/APIClasses/soapupload.rb +52 -0
- data/lib/nvx/sds/APIClasses/utilities.rb +97 -0
- data/lib/nvx/sds/SOAP/TransferClient.rb +68 -0
- data/lib/nvx/sds/SOAP/default.rb +80 -0
- data/lib/nvx/sds/SOAP/defaultDriver.rb +70 -0
- data/lib/nvx/sds/accountlogin.rb +68 -0
- data/lib/nvx/sds/apicommand.rb +251 -0
- data/lib/nvx/sds/apiparam.rb +33 -0
- data/lib/nvx/sds/countries.rb +257 -0
- data/lib/nvx/sds/folder.rb +236 -0
- data/lib/nvx/sds/hosteditem.rb +115 -0
- data/lib/nvx/sds/itembase.rb +53 -0
- data/lib/nvx/sds/masteraccount.rb +74 -0
- data/lib/nvx/sds/nvxfile.rb +173 -0
- data/lib/nvx/sds/session.rb +110 -0
- data/lib/nvx/sds/transport.rb +129 -0
- data/lib/nvx_sds.rb +19 -0
- data/tests/TestUpload.txt +9 -0
- data/tests/accountlogintest.rb +19 -0
- data/tests/apicommandtest.rb +186 -0
- data/tests/apiparamtest.rb +24 -0
- data/tests/countriestest.rb +20 -0
- data/tests/foldertest.rb +26 -0
- data/tests/fsfolderlisttest.rb +127 -0
- data/tests/masteraccounttest.rb +69 -0
- data/tests/sessiontest.rb +187 -0
- data/tests/testconfig.rb +14 -0
- data/tests/transporttest.rb +19 -0
- data/tests/unittests_gemtest.rb +17 -0
- data/tests/uploadtest.rb +22 -0
- metadata +102 -0
data/LICENSE
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Limited Permissive License
|
2
|
+
# September 05, 2007
|
3
|
+
#
|
4
|
+
# Nirvanix Licensing Limited Permissive License
|
5
|
+
#
|
6
|
+
# This license governs use of the accompanying software. If you use the
|
7
|
+
# software, you accept this license. If you do not accept the license,
|
8
|
+
# do not use the software.
|
9
|
+
#
|
10
|
+
# 1. DEFINITIONS
|
11
|
+
#
|
12
|
+
# The terms �reproduce,� �reproduction,� �derivative works,� and
|
13
|
+
# �distribution� have the same meaning here as under U.S. copyright law.
|
14
|
+
# A �contribution� is the original software, or any additions or changes
|
15
|
+
# to the software. A �contributor� is any person that distributes its
|
16
|
+
# contribution under this license. �License patents� are a contributor�s
|
17
|
+
# patent claims that read directly on its contribution.
|
18
|
+
#
|
19
|
+
# 2. GRANT OF RIGHTS
|
20
|
+
#
|
21
|
+
# A. Copyright Grant � Subject to the terms of this license, including
|
22
|
+
# the license conditions and limitations in section 3, each contributor
|
23
|
+
# grants you a non-exclusive, worldwide, royalty-free copyright license
|
24
|
+
# to reproduce its contribution, prepare derivative works of its
|
25
|
+
# contribution, and distribute its contribution or any derivative works
|
26
|
+
# that you create.
|
27
|
+
#
|
28
|
+
# B. Patent Grant � Subject to the terms of this license, including the
|
29
|
+
# license conditions and limitations in section 3, each contributor
|
30
|
+
# grants you a non-exclusive, worldwide, royalty-free license under its
|
31
|
+
# licensed patents to make, have made, use, sell, offer for sale, import,
|
32
|
+
# and/or otherwise dispose of its contribution in the software or
|
33
|
+
# derivative works of the contribution in the software.
|
34
|
+
#
|
35
|
+
# 3. CONDITIONS AND LIMITATIONS
|
36
|
+
#
|
37
|
+
# A. No Trademark License � This license does not grant you rights to
|
38
|
+
# use any contributors� name, logo, or trademarks.
|
39
|
+
#
|
40
|
+
# B. If you bring a patent claim against any contributor over patents
|
41
|
+
# that you claim are infringed by the software, your patent license from
|
42
|
+
# such contributor to the software ends automatically.
|
43
|
+
#
|
44
|
+
# C. If you distribute any portion of the software, you must retain all
|
45
|
+
# copyright, patent, trademark, and attribution notices that are present
|
46
|
+
# in the software.
|
47
|
+
#
|
48
|
+
# D. If you distribute any portion of the software in source code form,
|
49
|
+
# you may do so only under this license by including a complete copy of
|
50
|
+
# this license with your distribution. If you distribute any portion of
|
51
|
+
# the software in compiled or object code form, you may only do so
|
52
|
+
# under a license that complies with this license.
|
53
|
+
#
|
54
|
+
# E. The software is licensed �as-is.� You bear the risk of using it.
|
55
|
+
# The contributors give no express warranties, guarantees or
|
56
|
+
# conditions. You may have additional consumer rights under your local
|
57
|
+
# laws which this license cannot change. To the extent permitted under
|
58
|
+
# your local laws, the contributors exclude the implied warranties of
|
59
|
+
# merchantability, fitness for a particular purpose and
|
60
|
+
# non-infringement.
|
61
|
+
#
|
62
|
+
# F. Platform Limitation � The licenses granted in sections 2 A. & 2 B.
|
63
|
+
# extend only to the software or derivative works that you create that
|
64
|
+
# utilize the Nirvanix Web Services Platform.
|
data/README
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
#= NVX::SDS
|
2
|
+
#== A Ruby SDK for Nirvanix Storage Delivery System (SDS).
|
3
|
+
#=== Getting the Library
|
4
|
+
#==== Download with RubyGems
|
5
|
+
#
|
6
|
+
#sudo gem i nvx-sds
|
7
|
+
#==== Download from the svn repository
|
8
|
+
#
|
9
|
+
#svn co svn://rubyforge.org/var/svn/nirvanix/sds/trunk nvx-sds
|
10
|
+
#The latest release and support is always available at Nirvanix Development Site
|
11
|
+
#
|
12
|
+
#=== Getting started
|
13
|
+
#After the gems library is installed you will need to:
|
14
|
+
#
|
15
|
+
#require 'nvx_sds'
|
16
|
+
#==== Creating a Session
|
17
|
+
#Most operations using this library will use go through the Session object. The session holds authentication and persistent connection information for the Nirvanix account.
|
18
|
+
#
|
19
|
+
#Creating a session can be done using:
|
20
|
+
#
|
21
|
+
#session = Session.new("APP-KEY", "USERNAME", "APP NAME", "PASSWORD")
|
22
|
+
#
|
23
|
+
#To get an account go to http://nmp.nirvanix.com/ and sign up. This will generate a new account and application key that you can use the pass to the session initialize method.
|
24
|
+
#
|
25
|
+
#When you are finished with a session always be sure to log that session out to invalidate the active session token.
|
26
|
+
#
|
27
|
+
#session.Logout
|
28
|
+
#==== Uploading a file
|
29
|
+
#To upload a file you will need to create a session and a SoapUpload object. The call takes a local file and streams it to the remote server. Below is an example of an upload:
|
30
|
+
#
|
31
|
+
#session = Session.new("APP-KEY", "USERNAME", "APP NAME", "PASSWORD")
|
32
|
+
#
|
33
|
+
#remote_file = "/TestUpload.txt"
|
34
|
+
#
|
35
|
+
##Get a file in the current directory
|
36
|
+
#
|
37
|
+
#local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + remote_file
|
38
|
+
#
|
39
|
+
#SoapUpload.UploadFile(remote_file, local_file, session.account_login)
|
40
|
+
#
|
41
|
+
#==== General File operations
|
42
|
+
#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.
|
43
|
+
#
|
44
|
+
#session = Session.new("APP-KEY", "USERNAME", "APP NAME", "PASSWORD")
|
45
|
+
#
|
46
|
+
#root_folder = session.GetRootFolder(1, 500, 0, true)
|
47
|
+
#
|
48
|
+
#root_folder.folders.each do |folder|
|
49
|
+
#
|
50
|
+
# print folder.name
|
51
|
+
#
|
52
|
+
#end
|
53
|
+
#
|
54
|
+
#The parameters are:
|
55
|
+
#
|
56
|
+
#* CurrentPage - The current page you are requesting
|
57
|
+
#* NumberPerPage - This is the total number of items files or folders
|
58
|
+
#* FolderSortCode - How the list of items returned should be sorted
|
59
|
+
#* SortDescending - If the list of items should be listed in descending order
|
60
|
+
#The maximum number of items reutrned in a single page is 500
|
61
|
+
#
|
62
|
+
#The folder sort codes are:
|
63
|
+
#
|
64
|
+
#* Name
|
65
|
+
#* CreatedDate
|
66
|
+
#* SizeBytes
|
67
|
+
#* FileType
|
68
|
+
#
|
69
|
+
#LoadChildren must be called to handle paging, due to memory concerns we didnt want to return too many items in one request, doing so could cause problems for people using shared servers with memory caps or other limitations.
|
70
|
+
#
|
71
|
+
#After getting a folder object you can copy, move, rename and delete files or folders. You can read more about folder oprations in the Folder RubyDoc entry.
|
72
|
+
#
|
73
|
+
#File operations can be completed in a similar manor using the NVXFile object
|
74
|
+
#
|
75
|
+
#=== Accounting Operations
|
76
|
+
#The session object lets you get or set account information about the account you used to create the session. This is contact information and the username. The session object can also be used to retrieve a MasterAccount object that will give you the ability to create and delete child accounts, setting and getting account notes and impersonation of children under that master account.
|
77
|
+
#
|
78
|
+
#The master account has a unique set of children and file system per application key but only one set of account contact information. This means each application key is a unique space under the master account. You can read more about this relationship in the official Nirvanix API Documentation.
|
79
|
+
#
|
80
|
+
#As a master account you will not need the password of the child account only the username you wish to impersonate.
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# = Overview
|
2
|
+
#
|
3
|
+
# AccountFeatureUsage is a class to define feature usage. This lets you get usage for a particular account.
|
4
|
+
# There are several usage types such as:
|
5
|
+
#
|
6
|
+
# * Storage Amount
|
7
|
+
# * Download Bandwidth Amount
|
8
|
+
# * Upload Bandwidth Amount
|
9
|
+
module NVX
|
10
|
+
module SDS
|
11
|
+
|
12
|
+
$:.unshift File.dirname(__FILE__)
|
13
|
+
require 'REXML/Document'
|
14
|
+
include REXML
|
15
|
+
|
16
|
+
# = Overview
|
17
|
+
#
|
18
|
+
# AccountFeatureUsage is a class to define feature usage. This lets you get usage for a particular account.
|
19
|
+
# There are several usage types such as:
|
20
|
+
#
|
21
|
+
# * Storage Amount
|
22
|
+
# * Download Bandwidth Amount
|
23
|
+
# * Upload Bandwidth Amount
|
24
|
+
class AccountFeatureUsage
|
25
|
+
|
26
|
+
# Extracts the Usage information from the xml node element.
|
27
|
+
def initialize(element)
|
28
|
+
@feature_name = (text = element.elements["FeatureName"].get_text and text.value)
|
29
|
+
@total_usage_amount = (text = element.elements["TotalUsageAmount"].get_text and text.value)
|
30
|
+
@usage_start_date = (text = element.elements["UsageStartDate"].get_text and text.value)
|
31
|
+
@usage_end_date = (text = element.elements["UsageEndDate"].get_text and text.value)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns a nicely formatted feature name : usage amount string. Eg. "Storage Amount: 10000"
|
35
|
+
def to_s
|
36
|
+
@feature_name + ":" + @total_usage_amount
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns the name of the feature.
|
40
|
+
def feature_name
|
41
|
+
@feature_name
|
42
|
+
end
|
43
|
+
|
44
|
+
# Returns the total amount of usage.
|
45
|
+
def total_usage_amount
|
46
|
+
@total_usage_amount
|
47
|
+
end
|
48
|
+
|
49
|
+
# Returns the start date when this usage information applies.
|
50
|
+
def usage_start_date
|
51
|
+
@usage_start_date
|
52
|
+
end
|
53
|
+
|
54
|
+
# Returns the end date when this usage information applies.
|
55
|
+
def usage_end_date
|
56
|
+
@usage_end_date
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# = Overview
|
2
|
+
#
|
3
|
+
# Holds the account information from the GetAccountInfo call.
|
4
|
+
module NVX
|
5
|
+
module SDS
|
6
|
+
|
7
|
+
$:.unshift File.dirname(__FILE__)
|
8
|
+
require 'contactinfo'
|
9
|
+
|
10
|
+
# Holds the account information from the GetAccountInfo call.
|
11
|
+
class AccountInfo
|
12
|
+
|
13
|
+
# Stores the username and creates a new contact object.
|
14
|
+
def initialize(doc)
|
15
|
+
@username = (text = doc.root.elements["//Username"].get_text and text.value)
|
16
|
+
@contact = ContactInfo.new(doc)
|
17
|
+
end
|
18
|
+
|
19
|
+
# The username.
|
20
|
+
def username
|
21
|
+
@username
|
22
|
+
end
|
23
|
+
|
24
|
+
# The contact object.
|
25
|
+
def contact
|
26
|
+
@contact
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# = Overview
|
2
|
+
#
|
3
|
+
# AccountLimit holds the account limit information.
|
4
|
+
module NVX
|
5
|
+
module SDS
|
6
|
+
# AccountLimit holds the account limit information.
|
7
|
+
class AccountLimit
|
8
|
+
# stores the limit type and value for that limit.
|
9
|
+
def initialize(type, value)
|
10
|
+
@type = type
|
11
|
+
@value = value
|
12
|
+
end
|
13
|
+
|
14
|
+
# Returns the limit type.
|
15
|
+
def type
|
16
|
+
@type
|
17
|
+
end
|
18
|
+
|
19
|
+
# Returns the value for the limit.
|
20
|
+
def value
|
21
|
+
@value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# = Overview
|
2
|
+
#
|
3
|
+
# The contact information is stored from the GetAccountInfo call.
|
4
|
+
module NVX
|
5
|
+
module SDS
|
6
|
+
# The contact information is stored from the GetAccountInfo call.
|
7
|
+
class ContactInfo
|
8
|
+
|
9
|
+
def initialize(doc)
|
10
|
+
@first_name = (text = doc.root.elements["//FirstName"].get_text and text.value)
|
11
|
+
@last_name = (text = doc.root.elements["//LastName"].get_text and text.value)
|
12
|
+
@middle_initial = (text = doc.root.elements["//MiddleInitial"].get_text and text.value)
|
13
|
+
@phone_number = (text = doc.root.elements["//PhoneNumber"].get_text and text.value)
|
14
|
+
@email_address = (text = doc.root.elements["//EmailAddress"].get_text and text.value)
|
15
|
+
@email_format = (text = doc.root.elements["//EmailFormat"].get_text and text.value)
|
16
|
+
@address_line1 = (text = doc.root.elements["//AddressLine1"].get_text and text.value)
|
17
|
+
@address_line2 = (text = doc.root.elements["//AddressLine2"].get_text and text.value)
|
18
|
+
@city = (text = doc.root.elements["//City"].get_text and text.value)
|
19
|
+
@state = (text = doc.root.elements["//State"].get_text and text.value)
|
20
|
+
@country = (text = doc.root.elements["//CountryID"].get_text and text.value)
|
21
|
+
@postal_code = (text = doc.root.elements["//PostalCode"].get_text and text.value)
|
22
|
+
end
|
23
|
+
|
24
|
+
def first_name
|
25
|
+
@first_name
|
26
|
+
end
|
27
|
+
|
28
|
+
def last_name
|
29
|
+
@last_name
|
30
|
+
end
|
31
|
+
|
32
|
+
def middle_initial
|
33
|
+
@middle_initial
|
34
|
+
end
|
35
|
+
|
36
|
+
def phone_number
|
37
|
+
@phone_number
|
38
|
+
end
|
39
|
+
|
40
|
+
def email_address
|
41
|
+
@email_address
|
42
|
+
end
|
43
|
+
|
44
|
+
def email_format
|
45
|
+
@email_format
|
46
|
+
end
|
47
|
+
|
48
|
+
def address_line1
|
49
|
+
@address_line1
|
50
|
+
end
|
51
|
+
|
52
|
+
def address_line2
|
53
|
+
@address_line2
|
54
|
+
end
|
55
|
+
|
56
|
+
def city
|
57
|
+
@city
|
58
|
+
end
|
59
|
+
|
60
|
+
def state
|
61
|
+
@state
|
62
|
+
end
|
63
|
+
|
64
|
+
def country
|
65
|
+
@country
|
66
|
+
end
|
67
|
+
|
68
|
+
def postal_code
|
69
|
+
@postal_code
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# FSFileAttributes is an internal class used to extract file information from a ListFolders call.
|
2
|
+
module NVX
|
3
|
+
module SDS
|
4
|
+
|
5
|
+
# Used to extract file information from a ListFolders call.
|
6
|
+
class FSFileAttributes
|
7
|
+
# Reads the File node from the xml fragment.
|
8
|
+
def initialize(xml)
|
9
|
+
doc = REXML::Document.new(xml)
|
10
|
+
|
11
|
+
@name = (text = doc.root.elements["//File/Name"].get_text and text.value)
|
12
|
+
@path = (text = doc.root.elements["//File/Path"].get_text and text.value)
|
13
|
+
@created_date = (text = doc.root.elements["//File/CreatedDate"].get_text and text.value)
|
14
|
+
@size_bytes = (text = doc.root.elements["//File/SizeBytes"].get_text and text.value)
|
15
|
+
@metadata = (text = doc.root.elements["//File/Metadata"].get_text and text.value)
|
16
|
+
@file_tags = (text = doc.root.elements["//File/FileTags"].get_text and text.value)
|
17
|
+
end
|
18
|
+
|
19
|
+
# The filename.
|
20
|
+
def name
|
21
|
+
@name
|
22
|
+
end
|
23
|
+
|
24
|
+
# The full relative path to the file.
|
25
|
+
def path
|
26
|
+
@path.nil? ? "" : @path
|
27
|
+
end
|
28
|
+
|
29
|
+
# The date the file was created on the local system.
|
30
|
+
def created_date
|
31
|
+
@created_date.nil? ? "" : @created_date
|
32
|
+
end
|
33
|
+
|
34
|
+
# The size of the file.
|
35
|
+
def size_bytes
|
36
|
+
@size_bytes
|
37
|
+
end
|
38
|
+
|
39
|
+
# The metadata for the file.
|
40
|
+
def metadata
|
41
|
+
@metadata.nil? ? "" : @metadata
|
42
|
+
end
|
43
|
+
|
44
|
+
# The array of tags.
|
45
|
+
def file_tags
|
46
|
+
@fileTags
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# FSFolderAttributes is an internal class used to extract folder information from a ListFolders call.
|
2
|
+
module NVX
|
3
|
+
module SDS
|
4
|
+
|
5
|
+
# FSFolderAttributes is an internal class used to extract folder information from a ListFolders call.
|
6
|
+
class FSFolderAttributes
|
7
|
+
|
8
|
+
# Extract the folder information from the xml fragment.
|
9
|
+
def initialize(xml)
|
10
|
+
if !xml.nil?
|
11
|
+
doc = REXML::Document.new(xml)
|
12
|
+
@name = (text = doc.root.elements["//Folder/Name"].get_text and text.value)
|
13
|
+
@path = (text = doc.root.elements["//Folder/Path"].get_text and text.value)
|
14
|
+
@created_date = (text = doc.root.elements["//Folder/CreatedDate"].get_text and text.value)
|
15
|
+
@folder_count = (text = doc.root.elements["//Folder/FolderCount"].get_text and text.value)
|
16
|
+
@file_count = (text = doc.root.elements["//Folder/FileCount"].get_text and text.value)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Creates the Base root folder, used internally for ListFolders call.
|
21
|
+
def EmptyRootFolder(name, path, created_date)
|
22
|
+
@name = name
|
23
|
+
@path = path
|
24
|
+
@created_date = created_date
|
25
|
+
end
|
26
|
+
|
27
|
+
# The name of the folder
|
28
|
+
def name
|
29
|
+
@name
|
30
|
+
end
|
31
|
+
|
32
|
+
# The path to the folder.
|
33
|
+
def path
|
34
|
+
@path
|
35
|
+
end
|
36
|
+
|
37
|
+
# The date created.
|
38
|
+
def created_date
|
39
|
+
@created_date.nil? ? "" : @created_date
|
40
|
+
end
|
41
|
+
|
42
|
+
# The children folder count.
|
43
|
+
def folder_count
|
44
|
+
@folder_count
|
45
|
+
end
|
46
|
+
|
47
|
+
# the children file count
|
48
|
+
def file_count
|
49
|
+
@file_count
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# FSFolderList is an internal class used to extract file and folder information from a ListFolders call.
|
2
|
+
module NVX
|
3
|
+
module SDS
|
4
|
+
|
5
|
+
$:.unshift File.dirname(__FILE__)
|
6
|
+
require 'fsfolderattributes'
|
7
|
+
require 'fsfileattributes'
|
8
|
+
require 'REXML/Document'
|
9
|
+
include REXML
|
10
|
+
|
11
|
+
# FSFolderList is an internal class used to extract file and folder information from a ListFolders call.
|
12
|
+
class FSFolderList
|
13
|
+
|
14
|
+
# Extracts count and file / folder arrays from the ListFolders response.
|
15
|
+
def initialize(xml)
|
16
|
+
doc = REXML::Document.new(xml)
|
17
|
+
@total_folder_count = (text = doc.root.elements["//Response/ListFolder/TotalFolderCount"].get_text and text.value)
|
18
|
+
@total_file_count = (text = doc.root.elements["//Response/ListFolder/TotalFileCount"].get_text and text.value)
|
19
|
+
@page_folder_count = (text = doc.root.elements["//Response/ListFolder/PageFolderCount"].get_text and text.value)
|
20
|
+
@page_file_count = (text = doc.root.elements["//Response/ListFolder/PageFileCount"].get_text and text.value)
|
21
|
+
|
22
|
+
@folder_attributes = Array.new
|
23
|
+
@file_attributes = Array.new
|
24
|
+
|
25
|
+
if doc.root.elements["//Response/ListFolder/Folder"]
|
26
|
+
doc.root.elements.each("//Response/ListFolder/Folder") do |folder|
|
27
|
+
@folder_attributes << FSFolderAttributes.new(folder.to_s)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
if doc.root.elements["//Response/ListFolder/File"]
|
32
|
+
doc.root.elements.each("//Response/ListFolder/File") do |file|
|
33
|
+
@file_attributes << FSFileAttributes.new(file.to_s)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# The total folder count outside of paging.
|
40
|
+
def total_folder_count
|
41
|
+
@total_folder_count.nil? ? 0 : @total_folder_count.to_i
|
42
|
+
end
|
43
|
+
|
44
|
+
# The total file count outside of paging.
|
45
|
+
def total_file_count
|
46
|
+
@total_file_count.nil? ? 0 : @total_file_count.to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
# The paging folder count
|
50
|
+
def page_folder_count
|
51
|
+
@page_folder_count.nil? ? 0 : @page_folder_count.to_i
|
52
|
+
end
|
53
|
+
|
54
|
+
# the paging file count
|
55
|
+
def page_file_count
|
56
|
+
@page_file_count.nil? ? 0 : @page_file_count.to_i
|
57
|
+
end
|
58
|
+
|
59
|
+
# The folder attributes array.
|
60
|
+
def folder_attributes
|
61
|
+
@folder_attributes
|
62
|
+
end
|
63
|
+
|
64
|
+
# The file attributes array.
|
65
|
+
def file_attributes
|
66
|
+
@file_attributes
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# = Overview
|
2
|
+
#
|
3
|
+
# The MetadataInfo object stores the type and value pair.
|
4
|
+
module NVX
|
5
|
+
module SDS
|
6
|
+
|
7
|
+
# The MetadataInfo object stores the type and value pair.
|
8
|
+
class MetadataInfo
|
9
|
+
# Sets the type and value
|
10
|
+
def initialize(type, value)
|
11
|
+
@type = type
|
12
|
+
@value = value
|
13
|
+
end
|
14
|
+
|
15
|
+
# The Metadata type
|
16
|
+
def type
|
17
|
+
@type
|
18
|
+
end
|
19
|
+
|
20
|
+
# The Metadata value
|
21
|
+
def value
|
22
|
+
@value
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
#Response Codes that can be returned from the services are listed below as constants
|
2
|
+
module NVX
|
3
|
+
module SDS
|
4
|
+
|
5
|
+
#Response Codes that can be returned from the services are listed below as constants
|
6
|
+
OK = 0,
|
7
|
+
|
8
|
+
# API errors.
|
9
|
+
MissingRequiredParameter = 100,
|
10
|
+
InvalidParameter = 101,
|
11
|
+
UnsupportedOperation = 160,
|
12
|
+
|
13
|
+
# Billing errors
|
14
|
+
ParameterOutOfAcceptedRange = 50103,
|
15
|
+
InvalidPayment = 55001,
|
16
|
+
|
17
|
+
CreditCardChargeFailed = 55100,
|
18
|
+
|
19
|
+
# Account errors.
|
20
|
+
CreateAccountFailed = 65001,
|
21
|
+
CreateAccountContactFailed = 65002,
|
22
|
+
InvalidAppKey = 65004,
|
23
|
+
InvalidAccountType = 65005,
|
24
|
+
DuplicateUserNameUnderAppKey = 65006,
|
25
|
+
DuplicateAppName = 65007,
|
26
|
+
PageSizeExceedsLimit = 65008,
|
27
|
+
DeletedAccount = 65009,
|
28
|
+
InvalidStatus = 65010,
|
29
|
+
InvalidSecurityResponse = 65011,
|
30
|
+
InvalidUserNameOrPassword = 65012,
|
31
|
+
DuplicateMasterAccountUserName = 65016,
|
32
|
+
PageNumberExceeded = 65017,
|
33
|
+
|
34
|
+
InvalidContactParameter = 65101,
|
35
|
+
AppNameNotFound = 65102,
|
36
|
+
UserNameNotFoundUnderAppKey = 65103,
|
37
|
+
UserNameNotFound = 65104,
|
38
|
+
|
39
|
+
# File system errors.
|
40
|
+
FolderNotFound = 70001,
|
41
|
+
FileNotFound = 70002,
|
42
|
+
PathNotFound = 70003,
|
43
|
+
AlreadyExists = 70004,
|
44
|
+
InvalidPath = 70005,
|
45
|
+
DownloadPathNotFound = 70006,
|
46
|
+
MetadataDoesNotExist = 70007,
|
47
|
+
FolderAlreadyExists = 70008,
|
48
|
+
PathTooLong = 70009,
|
49
|
+
FileFolderNameTooLong = 70010,
|
50
|
+
ItemAlreadyShared = 70012,
|
51
|
+
PathNotShared = 70013,
|
52
|
+
|
53
|
+
NullOrEmptyPath = 70101,
|
54
|
+
InvalidPathCharacter = 70102,
|
55
|
+
InvalidAbsolutePath = 70103,
|
56
|
+
InvalidRelativePath = 70104,
|
57
|
+
FileIntegrityError = 70106,
|
58
|
+
InvalidMetadata = 70107,
|
59
|
+
RangeNotSatisfiable = 70108,
|
60
|
+
PathTooShort = 70109,
|
61
|
+
FileOffline = 70110,
|
62
|
+
InvalidImageDimensions = 70111,
|
63
|
+
InvalidRotateFlipType = 70112,
|
64
|
+
InvalidSearchItem = 70113,
|
65
|
+
InvalidFileFolderNameCharacter = 70114,
|
66
|
+
|
67
|
+
# Authentication/Authorizarion errors.
|
68
|
+
LoginFailed = 80001,
|
69
|
+
AccessDenied = 80003,
|
70
|
+
InvalidMasterAccountID = 80004,
|
71
|
+
InvalidBillableAccountID = 80005,
|
72
|
+
SessionNotFound = 80006,
|
73
|
+
AccountExpired = 80007,
|
74
|
+
OutOfBytes = 80015,
|
75
|
+
OutOfBytesNonOwner = 80016,
|
76
|
+
InvalidIPAddress = 80018,
|
77
|
+
DownloadFileSizeLimitExceded = 80019,
|
78
|
+
UploadBandwidthLimitExceeded = 80020,
|
79
|
+
StorageLimitExceeded = 80021,
|
80
|
+
LimitAlreadyExceeded = 80022,
|
81
|
+
InvalidAccessToken = 80023,
|
82
|
+
InvalidSessionToken = 80101,
|
83
|
+
ExpiredAccessToken = 80102,
|
84
|
+
InvalidDownloadToken = 80103,
|
85
|
+
|
86
|
+
# Storage errors
|
87
|
+
StorageNotAvailable = 85001,
|
88
|
+
ServerNotFound = 85003,
|
89
|
+
|
90
|
+
# Utility errors.
|
91
|
+
Configuration = 90001,
|
92
|
+
SSLRequired = 90002,
|
93
|
+
|
94
|
+
# SQL Errors
|
95
|
+
Database = 100001
|
96
|
+
end
|
97
|
+
end
|