nvx-sds 0.0.1

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.
Files changed (42) hide show
  1. data/LICENSE +64 -0
  2. data/README +80 -0
  3. data/lib/nvx/sds/APIClasses/accountfeatureusage.rb +60 -0
  4. data/lib/nvx/sds/APIClasses/accountinfo.rb +30 -0
  5. data/lib/nvx/sds/APIClasses/accountlimit.rb +25 -0
  6. data/lib/nvx/sds/APIClasses/contactinfo.rb +74 -0
  7. data/lib/nvx/sds/APIClasses/fsfileattributes.rb +50 -0
  8. data/lib/nvx/sds/APIClasses/fsfolderattributes.rb +53 -0
  9. data/lib/nvx/sds/APIClasses/fsfolderlist.rb +70 -0
  10. data/lib/nvx/sds/APIClasses/metadatainfo.rb +26 -0
  11. data/lib/nvx/sds/APIClasses/responsecodes.rb +97 -0
  12. data/lib/nvx/sds/APIClasses/soapupload.rb +52 -0
  13. data/lib/nvx/sds/APIClasses/utilities.rb +97 -0
  14. data/lib/nvx/sds/SOAP/TransferClient.rb +68 -0
  15. data/lib/nvx/sds/SOAP/default.rb +80 -0
  16. data/lib/nvx/sds/SOAP/defaultDriver.rb +70 -0
  17. data/lib/nvx/sds/accountlogin.rb +68 -0
  18. data/lib/nvx/sds/apicommand.rb +251 -0
  19. data/lib/nvx/sds/apiparam.rb +33 -0
  20. data/lib/nvx/sds/countries.rb +257 -0
  21. data/lib/nvx/sds/folder.rb +236 -0
  22. data/lib/nvx/sds/hosteditem.rb +115 -0
  23. data/lib/nvx/sds/itembase.rb +53 -0
  24. data/lib/nvx/sds/masteraccount.rb +74 -0
  25. data/lib/nvx/sds/nvxfile.rb +173 -0
  26. data/lib/nvx/sds/session.rb +110 -0
  27. data/lib/nvx/sds/transport.rb +129 -0
  28. data/lib/nvx_sds.rb +19 -0
  29. data/tests/TestUpload.txt +9 -0
  30. data/tests/accountlogintest.rb +19 -0
  31. data/tests/apicommandtest.rb +186 -0
  32. data/tests/apiparamtest.rb +24 -0
  33. data/tests/countriestest.rb +20 -0
  34. data/tests/foldertest.rb +26 -0
  35. data/tests/fsfolderlisttest.rb +127 -0
  36. data/tests/masteraccounttest.rb +69 -0
  37. data/tests/sessiontest.rb +187 -0
  38. data/tests/testconfig.rb +14 -0
  39. data/tests/transporttest.rb +19 -0
  40. data/tests/unittests_gemtest.rb +17 -0
  41. data/tests/uploadtest.rb +22 -0
  42. metadata +102 -0
@@ -0,0 +1,251 @@
1
+ # = Overview
2
+ # The APICommand object defines all the namespaces and methods in the Nirvanix services.
3
+ # in the future this could be split into multiple namespaces but for now there are no collisions.
4
+
5
+ module NVX
6
+ module SDS
7
+
8
+ # The APICommand object defines all the namespaces and methods in the Nirvanix services.
9
+ # in the future this could be split into multiple namespaces but for now there are no collisions.
10
+ class APICommand
11
+
12
+ private_class_method :new
13
+
14
+ # Initialize method sets the command and if its to be executed via SSL.
15
+ # You can change the method to be secure for any call but currently only
16
+ # the Login command is marked as secure.
17
+ def initialize(command_path, is_secure)
18
+ @command_path = command_path
19
+ @is_secure = is_secure
20
+ end
21
+
22
+ # Used to determine if a command is using SSL.
23
+ def is_secure?
24
+ @is_secure
25
+ end
26
+
27
+ # The namespace/path of the command.
28
+ def command_path
29
+ @command_path
30
+ end
31
+
32
+
33
+ #Authentication Namespace
34
+
35
+ @@logincmd = nil
36
+ def APICommand.Login
37
+ @@logincmd = new("Authentication/Login.ashx", true) unless @@logincmd
38
+ @@logincmd
39
+ end
40
+
41
+ @@logoutcmd = nil
42
+ def APICommand.Logout
43
+ @@logoutcmd = new("Authentication/Logout.ashx", false) unless @@logoutcmd
44
+ @@logoutcmd
45
+ end
46
+
47
+
48
+ #IMFS Namespace
49
+
50
+ @@listfoldercmd = nil
51
+ def APICommand.ListFolder
52
+ @@listfoldercmd = new("IMFS/ListFolder.ashx", false) unless @@listfoldercmd
53
+ @@listfoldercmd
54
+ end
55
+
56
+ @@createfolderscmd = nil
57
+ def APICommand.CreateFolders
58
+ @@createfolderscmd = new("IMFS/CreateFolders.ashx", false) unless @@createfolderscmd
59
+ @@createfolderscmd
60
+ end
61
+
62
+ @@deletefolderscmd = nil
63
+ def APICommand.DeleteFolders
64
+ @@deletefolderscmd = new("IMFS/DeleteFolders.ashx", false) unless @@deletefolderscmd
65
+ @@deletefolderscmd
66
+ end
67
+
68
+ @@copyfolderscmd = nil
69
+ def APICommand.CopyFolders
70
+ @@copyfolderscmd = new("IMFS/CopyFolders.ashx", false) unless @@copyfolderscmd
71
+ @@copyfolderscmd
72
+ end
73
+
74
+ @@movefolderscmd = nil
75
+ def APICommand.MoveFolders
76
+ @@movefolderscmd = new("IMFS/MoveFolders.ashx", false) unless @@movefolderscmd
77
+ @@movefolderscmd
78
+ end
79
+
80
+ @@copyfilescmd = nil
81
+ def APICommand.CopyFiles
82
+ @@copyfilescmd = new("IMFS/CopyFiles.ashx", false) unless @@copyfilescmd
83
+ @@copyfilescmd
84
+ end
85
+
86
+ @@movefilescmd = nil
87
+ def APICommand.MoveFiles
88
+ @@movefilescmd = new("IMFS/MoveFiles.ashx", false) unless @@movefilescmd
89
+ @@movefilescmd
90
+ end
91
+
92
+ @@renamefoldercmd = nil
93
+ def APICommand.RenameFolder
94
+ @@renamefoldercmd = new("IMFS/RenameFolder.ashx", false) unless @@renamefoldercmd
95
+ @@renamefoldercmd
96
+ end
97
+
98
+ @@renamefilecmd = nil
99
+ def APICommand.RenameFile
100
+ @@renamefilecmd = new("IMFS/RenameFile.ashx", false) unless @@renamefilecmd
101
+ @@renamefilecmd
102
+ end
103
+
104
+ @@deletefilescmd = nil
105
+ def APICommand.DeleteFiles
106
+ @@deletefilescmd = new("IMFS/DeleteFiles.ashx", false) unless @@deletefilescmd
107
+ @@deletefilescmd
108
+ end
109
+
110
+ @@getdownloadnodescmd = nil
111
+ def APICommand.GetDownloadNodes
112
+ @@getdownloadnodescmd = new("IMFS/GetDownloadNodes.ashx", false) unless @@getdownloadnodescmd
113
+ @@getdownloadnodescmd
114
+ end
115
+
116
+ @@getuploadnodecmd = nil
117
+ def APICommand.GetUploadNode
118
+ @@getuploadnodecmd = new("IMFS/GetUploadNode.ashx", false) unless @@getuploadnodecmd
119
+ @@getuploadnodecmd
120
+ end
121
+
122
+ # MetaData Namespace
123
+
124
+ @@deleteallmetadatacmd = nil
125
+ def APICommand.DeleteAllMetadata
126
+ @@deleteallmetadatacmd = new("Metadata/DeleteAllMetadata.ashx", false) unless @@deleteallmetadatacmd
127
+ @@deleteallmetadatacmd
128
+ end
129
+
130
+ @@deletealltagscmd = nil
131
+ def APICommand.DeleteAllTags
132
+ @@deletealltagscmd = new("Metadata/DeleteAllTags.ashx", false) unless @@deletealltagscmd
133
+ @@deletealltagscmd
134
+ end
135
+
136
+ @@deletemetadatacmd = nil
137
+ def APICommand.DeleteMetadata
138
+ @@deletemetadatacmd = new("Metadata/DeleteMetadata.ashx", false) unless @@deletemetadatacmd
139
+ @@deletemetadatacmd
140
+ end
141
+
142
+ @@deletetagscmd = nil
143
+ def APICommand.DeleteTags
144
+ @@deletetagscmd = new("Metadata/DeleteTags.ashx", false) unless @@deletetagscmd
145
+ @@deletetagscmd
146
+ end
147
+
148
+ @@getmetadatacmd = nil
149
+ def APICommand.GetMetadata
150
+ @@getmetadatacmd = new("Metadata/GetMetadata.ashx", false) unless @@getmetadatacmd
151
+ @@getmetadatacmd
152
+ end
153
+
154
+ @@gettagscmd = nil
155
+ def APICommand.GetTags
156
+ @@gettagscmd = new("Metadata/GetTags.ashx", false) unless @@gettagscmd
157
+ @@gettagscmd
158
+ end
159
+
160
+ @@setmetadatacmd = nil
161
+ def APICommand.SetMetadata
162
+ @@setmetadatacmd = new("Metadata/SetMetadata.ashx", false) unless @@setmetadatacmd
163
+ @@setmetadatacmd
164
+ end
165
+
166
+ @@settagscmd = nil
167
+ def APICommand.SetTags
168
+ @@settagscmd = new("Metadata/SetTags.ashx", false) unless @@settagscmd
169
+ @@settagscmd
170
+ end
171
+
172
+
173
+ # Sharing Namespace
174
+
175
+ @@createhosteditemcmd = nil
176
+ def APICommand.CreateHostedItem
177
+ @@createhosteditemcmd = new("Sharing/CreateHostedItem.ashx", false) unless @@createhosteditemcmd
178
+ @@createhosteditemcmd
179
+ end
180
+
181
+ @@removehosteditemcmd = nil
182
+ def APICommand.RemoveHostedItem
183
+ @@removehosteditemcmd = new("Sharing/RemoveHostedItem.ashx", false) unless @@removehosteditemcmd
184
+ @@removehosteditemcmd
185
+ end
186
+
187
+ @@listhosteditemscmd = nil
188
+ def APICommand.ListHostedItems
189
+ @@listhosteditemscmd = new("Sharing/ListHostedItems.ashx", false) unless @@listhosteditemscmd
190
+ @@listhosteditemscmd
191
+ end
192
+
193
+
194
+ # Accounting Namespace
195
+
196
+ @@createchildaccountcmd = nil
197
+ def APICommand.CreateChildAccount
198
+ @@createchildaccountcmd = new("Accounting/CreateChildAccount.ashx", false) unless @@createchildaccountcmd
199
+ @@createchildaccountcmd
200
+ end
201
+
202
+ @@deletechildaccountcmd = nil
203
+ def APICommand.DeleteChildAccount
204
+ @@deletechildaccountcmd = new("Accounting/DeleteChildAccount.ashx", false) unless @@deletechildaccountcmd
205
+ @@deletechildaccountcmd
206
+ end
207
+
208
+ @@getaccountinfocmd = nil
209
+ def APICommand.GetAccountInfo
210
+ @@getaccountinfocmd = new("Accounting/GetAccountInfo.ashx", false) unless @@getaccountinfocmd
211
+ @@getaccountinfocmd
212
+ end
213
+
214
+ @@getaccountnotescmd = nil
215
+ def APICommand.GetAccountNotes
216
+ @@getaccountnotescmd = new("Accounting/GetAccountNotes.ashx", false) unless @@getaccountnotescmd
217
+ @@getaccountnotescmd
218
+ end
219
+
220
+ @@getaccountlimitscmd = nil
221
+ def APICommand.GetAccountLimits
222
+ @@getaccountlimitscmd = new("Accounting/GetAccountLimits.ashx", false) unless @@getaccountlimitscmd
223
+ @@getaccountlimitscmd
224
+ end
225
+
226
+ @@getaccountusagecmd = nil
227
+ def APICommand.GetAccountUsage
228
+ @@getaccountusagecmd = new("Accounting/GetAccountUsage.ashx", false) unless @@getaccountusagecmd
229
+ @@getaccountusagecmd
230
+ end
231
+
232
+ @@setaccountinfocmd = nil
233
+ def APICommand.SetAccountInfo
234
+ @@setaccountinfocmd = new("Accounting/SetAccountInfo.ashx", false) unless @@setaccountinfocmd
235
+ @@setaccountinfocmd
236
+ end
237
+
238
+ @@setaccountlimitscmd = nil
239
+ def APICommand.SetAccountLimits
240
+ @@setaccountlimitscmd = new("Accounting/SetAccountLimits.ashx", false) unless @@setaccountlimitscmd
241
+ @@setaccountlimitscmd
242
+ end
243
+
244
+ @@setaccountnotescmd = nil
245
+ def APICommand.SetAccountNotes
246
+ @@setaccountnotescmd = new("Accounting/SetAccountNotes.ashx", false) unless @@setaccountnotescmd
247
+ @@setaccountnotescmd
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,33 @@
1
+ # = Overview
2
+ # The APIParam object lets you pass parameters to the Transport.execute_command_get and
3
+ # Transport.execute_command_post methods. This is an internal class.
4
+
5
+ module NVX
6
+ module SDS
7
+ class APIParam
8
+
9
+ require 'cgi'
10
+
11
+ # The initialize method stores the key and value of the parameter to be passed.
12
+ def initialize(key, value)
13
+ @key = key
14
+ @value = value
15
+ end
16
+
17
+ # Returns the key.
18
+ def key
19
+ @key
20
+ end
21
+
22
+ # Returns the value.
23
+ def value
24
+ @value
25
+ end
26
+
27
+ # Overload to return a CGI::escape version of the key=value pair.
28
+ def to_s
29
+ CGI::escape(@key.to_s) + "=" + CGI::escape(@value.to_s);
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,257 @@
1
+ module NVX
2
+ module SDS
3
+
4
+ class Countries
5
+
6
+ # This list is from the ISO 3166-1-alpha-2 list, later the 2 character code may be
7
+ # used in place of the index number.
8
+ def Countries.country_list
9
+ { "Afghanistan" => 8,
10
+ "�land Islands" => 31,
11
+ "Albania" => 11,
12
+ "Algeria" => 75,
13
+ "American Samoa" => 27,
14
+ "Andorra" => 16,
15
+ "Angola" => 14,
16
+ "Anguilla" => 10,
17
+ "Antarctica" => 15,
18
+ "Antigua and Barbuda" => 9,
19
+ "Argentina" => 26,
20
+ "Armenia" => 12,
21
+ "Aruba" => 30,
22
+ "Australia" => 29,
23
+ "Austria" => 28,
24
+ "Azerbaijan" => 32,
25
+ "Bahamas" => 46,
26
+ "Bahrain" => 39,
27
+ "Bangladesh" => 35,
28
+ "Barbados" => 34,
29
+ "Belarus" => 50,
30
+ "Belgium" => 36,
31
+ "Belize" => 51,
32
+ "Benin" => 41,
33
+ "Bermuda" => 42,
34
+ "Bhutan" => 47,
35
+ "Bolivia" => 44,
36
+ "Bosnia and Herzegovina" => 33,
37
+ "Botswana" => 49,
38
+ "Bouvet Island" => 48,
39
+ "Brazil" => 45,
40
+ "British Indian Ocean Territory" => 119,
41
+ "Brunei Darussalam" => 43,
42
+ "Bulgaria" => 38,
43
+ "Burkina Faso" => 37,
44
+ "Burundi" => 40,
45
+ "Cambodia" => 130,
46
+ "Cameroon" => 61,
47
+ "Canada" => 52,
48
+ "Cape Verde" => 66,
49
+ "Cayman Islands" => 137,
50
+ "Central African Republic" => 55,
51
+ "Chad" => 225,
52
+ "Chile" => 60,
53
+ "China" => 62,
54
+ "Christmas Island" => 67,
55
+ "Cocos (Keeling) Islands" => 53,
56
+ "Colombia" => 63,
57
+ "Comoros" => 132,
58
+ "Congo" => 56,
59
+ "Congo, the Democratic Republic of the" => 54,
60
+ "Cook Islands" => 59,
61
+ "Costa Rica" => 64,
62
+ "C�te d'Ivoire" => 58,
63
+ "Croatia" => 111,
64
+ "Cuba" => 65,
65
+ "Cyprus" => 68,
66
+ "Czech Republic" => 69,
67
+ "Denmark" => 72,
68
+ "Djibouti" => 71,
69
+ "Dominica" => 73,
70
+ "Dominican Republic" => 74,
71
+ "Ecuador" => 76,
72
+ "Egypt" => 78,
73
+ "El Salvador" => 221,
74
+ "Equatorial Guinea" => 101,
75
+ "Eritrea" => 80,
76
+ "Estonia" => 77,
77
+ "Ethiopia" => 82,
78
+ "Falkland Islands (Malvinas)" => 85,
79
+ "Faroe Islands" => 87,
80
+ "Fiji" => 84,
81
+ "Finland" => 83,
82
+ "France" => 88,
83
+ "French Guiana" => 93,
84
+ "French Polynesia" => 187,
85
+ "French Southern Territories" => 226,
86
+ "Gabon" => 89,
87
+ "Gambia" => 98,
88
+ "Georgia" => 92,
89
+ "Germany" => 70,
90
+ "Ghana" => 95,
91
+ "Gibraltar" => 96,
92
+ "Greece" => 102,
93
+ "Greenland" => 97,
94
+ "Grenada" => 91,
95
+ "Guadeloupe" => 100,
96
+ "Guam" => 105,
97
+ "Guatemala" => 104,
98
+ "Guernsey" => 94,
99
+ "Guinea" => 99,
100
+ "Guinea-Bissau" => 106,
101
+ "Guyana" => 107,
102
+ "Haiti" => 112,
103
+ "Heard Island and McDonald Islands" => 109,
104
+ "Holy See (Vatican City State)" => 246,
105
+ "Honduras" => 110,
106
+ "Hong Kong" => 108,
107
+ "Hungary" => 113,
108
+ "Iceland" => 122,
109
+ "India" => 118,
110
+ "Indonesia" => 114,
111
+ "Iran, Islamic Republic of" => 121,
112
+ "Iraq" => 120,
113
+ "Ireland" => 115,
114
+ "Isle of Man" => 117,
115
+ "Israel" => 116,
116
+ "Italy" => 123,
117
+ "Jamaica" => 125,
118
+ "Japan" => 127,
119
+ "Jersey" => 124,
120
+ "Jordan" => 126,
121
+ "Kazakhstan" => 138,
122
+ "Kenya" => 128,
123
+ "Kiribati" => 131,
124
+ "Korea, Democratic People's Republic of" => 134,
125
+ "Korea, Republic of" => 135,
126
+ "Kuwait" => 136,
127
+ "Kyrgyzstan" => 129,
128
+ "Lao People's Democratic Republic" => 139,
129
+ "Latvia" => 148,
130
+ "Lebanon" => 140,
131
+ "Lesotho" => 145,
132
+ "Liberia" => 144,
133
+ "Libyan Arab Jamahiriya" => 149,
134
+ "Liechtenstein" => 142,
135
+ "Lithuania" => 146,
136
+ "Luxembourg" => 147,
137
+ "Macao" => 160,
138
+ "Macedonia, the former Yugoslav Republic of" => 156,
139
+ "Madagascar" => 154,
140
+ "Malawi" => 168,
141
+ "Malaysia" => 170,
142
+ "Maldives" => 167,
143
+ "Mali" => 157,
144
+ "Malta" => 165,
145
+ "Marshall Islands" => 155,
146
+ "Martinique" => 162,
147
+ "Mauritania" => 163,
148
+ "Mauritius" => 166,
149
+ "Mayotte" => 256,
150
+ "Mexico" => 169,
151
+ "Micronesia, Federated States of" => 86,
152
+ "Moldova, Republic of" => 152,
153
+ "Monaco" => 151,
154
+ "Mongolia" => 159,
155
+ "Montenegro" => 153,
156
+ "Montserrat" => 164,
157
+ "Morocco" => 150,
158
+ "Mozambique" => 171,
159
+ "Myanmar" => 158,
160
+ "Namibia" => 172,
161
+ "Nauru" => 181,
162
+ "Nepal" => 180,
163
+ "Netherlands" => 178,
164
+ "Netherlands Antilles" => 13,
165
+ "New Caledonia" => 173,
166
+ "New Zealand" => 183,
167
+ "Nicaragua" => 177,
168
+ "Niger" => 174,
169
+ "Nigeria" => 176,
170
+ "Niue" => 182,
171
+ "Norfolk Island" => 175,
172
+ "Northern Mariana Islands" => 161,
173
+ "Norway" => 179,
174
+ "Oman" => 184,
175
+ "Pakistan" => 190,
176
+ "Palau" => 197,
177
+ "Palestinian Territory, Occupied" => 195,
178
+ "Panama" => 185,
179
+ "Papua New Guinea" => 188,
180
+ "Paraguay" => 198,
181
+ "Peru" => 186,
182
+ "Philippines" => 189,
183
+ "Pitcairn" => 193,
184
+ "Poland" => 191,
185
+ "Portugal" => 196,
186
+ "Puerto Rico" => 194,
187
+ "Qatar" => 199,
188
+ "R�union" => 200,
189
+ "Romania" => 201,
190
+ "Russian Federation" => 203,
191
+ "Rwanda" => 204,
192
+ "Saint Helena" => 211,
193
+ "Saint Kitts and Nevis" => 133,
194
+ "Saint Lucia" => 141,
195
+ "Saint Pierre and Miquelon" => 192,
196
+ "Saint Vincent and the Grenadines" => 247,
197
+ "Samoa" => 254,
198
+ "San Marino" => 216,
199
+ "Sao Tome and Principe" => 220,
200
+ "Saudi Arabia" => 205,
201
+ "Senegal" => 217,
202
+ "Serbia" => 202,
203
+ "Seychelles" => 207,
204
+ "Sierra Leone" => 215,
205
+ "Singapore" => 210,
206
+ "Slovakia" => 214,
207
+ "Slovenia" => 212,
208
+ "Solomon Islands" => 206,
209
+ "Somalia" => 218,
210
+ "South Africa" => 257,
211
+ "South Georgia and the South Sandwich Islands" => 103,
212
+ "Spain" => 81,
213
+ "Sri Lanka" => 143,
214
+ "Sudan" => 208,
215
+ "Suriname" => 219,
216
+ "Svalbard and Jan Mayen" => 213,
217
+ "Swaziland" => 223,
218
+ "Sweden" => 209,
219
+ "Switzerland" => 57,
220
+ "Syrian Arab Republic" => 222,
221
+ "Taiwan, Province of China" => 238,
222
+ "Tajikistan" => 229,
223
+ "Tanzania, United Republic of" => 239,
224
+ "Thailand" => 228,
225
+ "Timor-Leste" => 231,
226
+ "Togo" => 227,
227
+ "Tokelau" => 230,
228
+ "Tonga" => 234,
229
+ "Trinidad and Tobago" => 236,
230
+ "Tunisia" => 233,
231
+ "Turkey" => 235,
232
+ "Turkmenistan" => 232,
233
+ "Turks and Caicos Islands" => 224,
234
+ "Tuvalu" => 237,
235
+ "Uganda" => 241,
236
+ "Ukraine" => 240,
237
+ "United Arab Emirates" => 7,
238
+ "United Kingdom" => 90,
239
+ "United States" => 1,
240
+ "United States Minor Outlying Islands" => 242,
241
+ "Uruguay" => 244,
242
+ "Uzbekistan" => 245,
243
+ "Vanuatu" => 252,
244
+ "Venezuela" => 248,
245
+ "Viet Nam" => 251,
246
+ "Virgin Islands, British" => 249,
247
+ "Virgin Islands, U.S." => 250,
248
+ "Wallis and Futuna" => 253,
249
+ "Western Sahara" => 79,
250
+ "Yemen" => 255,
251
+ "Zambia" => 258,
252
+ "Zimbabwe" => 259
253
+ }
254
+ end
255
+ end
256
+ end
257
+ end