safe-t-rest 0.1.0 → 0.1.3
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.
- checksums.yaml +4 -4
- data/README.md +13 -9
- data/bin/safe-t-bin +1 -1
- data/lib/safe-t-rest.rb +22 -12
- data/safe-t-rest.gemspec +4 -4
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f925155d48c7167c173bcc5cfd8a4101d44ef9b7
|
4
|
+
data.tar.gz: 96fd9cc27ede58452d6e9e0b12d5abc2b9bbbdbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b55cb69e6378200c7b011baa54d9e6dfc6c639b9878e42c1ac7d21aedc4ce4bc425058ec4a31a66d3aff477bccdad000be2e107a162bdf5826fccad7a96de30e
|
7
|
+
data.tar.gz: 3b1168f81e5866fb21f1814fc528930a18bc323cac7d6bd3710b7ed6e0547697d31fe7abd2612f8a40324de2d79d6031c283ace3b79778be5c7078e10a419268
|
data/README.md
CHANGED
@@ -14,26 +14,30 @@ gem install safe-t-rest
|
|
14
14
|
require 'safe-t-rest'
|
15
15
|
```
|
16
16
|
|
17
|
-
* Initialize a new instance
|
17
|
+
* Initialize a new instance (can be empty or set via parameters)
|
18
|
+
empty:
|
18
19
|
```ruby
|
19
20
|
client = SafeTRest.new
|
20
21
|
```
|
22
|
+
set using hash:
|
23
|
+
```ruby
|
24
|
+
client = SafeTRest.new(url: 'https://Safe-T/ui_api/login.aspx', user_name: 'test', password: '123', extension_id: '1', role_id: '0')
|
25
|
+
```
|
21
26
|
|
22
|
-
* Configure the client
|
27
|
+
* Configure the client (if you initialized empty)
|
23
28
|
```ruby
|
24
29
|
client.url = 'https://Safe-T_Box_Site.com/ui_api/login.aspx'
|
25
30
|
client.username = 'test'
|
26
31
|
client.password = '12345'
|
27
|
-
client.
|
32
|
+
client.extension_id = '435-34534-24-234-6'
|
28
33
|
client.role_id = '00006'
|
29
|
-
client.guid = 'my_packge_GUID.123123'
|
30
34
|
```
|
31
35
|
|
32
36
|
* Send requests
|
33
37
|
```ruby
|
34
|
-
puts client.
|
38
|
+
puts client.get_apps_process_state('my_packge_GUID.123123')
|
35
39
|
|
36
|
-
puts client.
|
40
|
+
puts client.get_package_file_list('my_packge_GUID.123123')
|
37
41
|
```
|
38
42
|
|
39
43
|
* Safe Share
|
@@ -56,7 +60,7 @@ args = {
|
|
56
60
|
:root_folder_id => '417' # My Storage ID
|
57
61
|
}
|
58
62
|
|
59
|
-
client.
|
63
|
+
client.safe_share_file(args)
|
60
64
|
```
|
61
65
|
|
62
66
|
* File Upload
|
@@ -68,7 +72,7 @@ args = {
|
|
68
72
|
:root_folder_id => 417 # My Storage ID
|
69
73
|
}
|
70
74
|
|
71
|
-
client.
|
75
|
+
client.file_upload(args)
|
72
76
|
```
|
73
77
|
|
74
78
|
* File Download
|
@@ -79,7 +83,7 @@ args = {
|
|
79
83
|
:root_folder_id => 417 # My Storage ID
|
80
84
|
}
|
81
85
|
|
82
|
-
file = client.
|
86
|
+
file = client.file_download(args) # Get back the file as a base64 string
|
83
87
|
file = Base64.decode64(file) # decode the string
|
84
88
|
File.write('file.txt', file) # write decoded file
|
85
89
|
```
|
data/bin/safe-t-bin
CHANGED
data/lib/safe-t-rest.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
|
3
3
|
class SafeTRest
|
4
|
-
attr_accessor :
|
4
|
+
attr_accessor :extension_id, :user_name, :password, :url, :role_id
|
5
5
|
|
6
6
|
def initialize(config_hash={})
|
7
|
-
@
|
7
|
+
@extension_id = config_hash[:extension_id]
|
8
8
|
@user_name = config_hash[:user_name]
|
9
9
|
@password = config_hash[:password]
|
10
10
|
@url = config_hash[:url]
|
@@ -12,51 +12,61 @@ class SafeTRest
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def get_apps_process_state(guid)
|
15
|
-
send_request("
|
15
|
+
send_request("GetAppsProcessState: ['#{guid}', false]}")
|
16
16
|
end
|
17
17
|
|
18
18
|
def get_package_file_list(guid)
|
19
|
-
send_request("
|
19
|
+
send_request("GetPackageFileList: ['#{guid}']}")
|
20
20
|
end
|
21
21
|
|
22
22
|
def verify_user_account
|
23
|
-
send_request("
|
23
|
+
send_request("iVerifyUserAccount: ['#{@user_name}', '#{@password}', true]")
|
24
24
|
end
|
25
25
|
|
26
26
|
def get_user_history(days)
|
27
|
-
send_request("
|
27
|
+
send_request("iGetHistory: ['#{@user_name}', '#{@password}', #{days}]")
|
28
28
|
end
|
29
29
|
|
30
30
|
def user_account_address_list
|
31
|
-
send_request("
|
31
|
+
send_request("iUserAccountAddressList: ['#{@user_name}', '#{@password}']")
|
32
32
|
end
|
33
33
|
|
34
34
|
def get_folder_list(path)
|
35
|
-
send_request("
|
35
|
+
send_request("iGetFolderList: ['#{@user_name}', '#{@password}', false, true, '#{path}', 417]")
|
36
36
|
end
|
37
37
|
|
38
38
|
def safe_share_file(args)
|
39
|
-
send_request("
|
39
|
+
send_request("iSafeShareFile: ['#{@user_name}', '#{@password}', '#{args[:files]}', '#{args[:recipients]}', '#{args[:sender_name]}', '#{args[:sender_address]}', '#{args[:subject]}', '#{args[:message]}', #{args[:message_encryption_level]}, #{args[:delivery_method]}, '#{args[:mobile_recipient]}', #{args[:return_receipt]}, #{args[:safe_reply]}, #{args[:max_downloads]}, #{args[:package_expiry]}, '#{args[:folder_path]}', #{args[:root_folder_id]}]")
|
40
40
|
end
|
41
41
|
|
42
42
|
def file_upload(args)
|
43
|
-
send_request("
|
43
|
+
send_request("iFileUpload: ['#{@user_name}', '#{@password}', '#{args[:file_base64]}', '#{args[:file_name]}', '#{args[:folder_path]}', #{args[:root_folder_id]}]")
|
44
44
|
end
|
45
45
|
|
46
46
|
def file_download(args)
|
47
|
-
send_request("
|
47
|
+
send_request("iFileDownload: ['#{@user_name}', '#{@password}', '#{args[:file_name]}', '#{args[:folder_path]}', #{args[:root_folder_id]}]")
|
48
|
+
end
|
49
|
+
|
50
|
+
def register_session(url_string)
|
51
|
+
send_request("\'RegisterSession\': [\'#{url_string}\']")
|
52
|
+
end
|
53
|
+
|
54
|
+
def verify_session(post_parameters)
|
55
|
+
send_request("\'VerifySession\': [\'#{post_parameters}\']")
|
48
56
|
end
|
49
57
|
|
50
58
|
private
|
51
59
|
|
52
60
|
def send_request(request_string)
|
53
61
|
RestClient::Request.execute(
|
62
|
+
:verify_ssl => false,
|
54
63
|
method: :post,
|
55
64
|
url: @url,
|
56
65
|
headers: {
|
57
66
|
servletRequestID: 'MethodRequest',
|
58
|
-
BusinessLogic: request_string
|
67
|
+
BusinessLogic: "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extension_id}', #{request_string}}"
|
59
68
|
}
|
60
69
|
)
|
61
70
|
end
|
62
71
|
end
|
72
|
+
|
data/safe-t-rest.gemspec
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'safe-t-rest'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.3'
|
4
4
|
s.date = Time.now.strftime('%Y-%m-%d')
|
5
5
|
s.summary = 'A ruby gem to interact with Safe-T Box.'
|
6
6
|
s.description = 'Ruby gem to interact with Safe-T Box rest API. '
|
7
7
|
s.authors = ['Bar Hofesh']
|
8
8
|
s.email = ['Bar.Hofesh@safe-t.com']
|
9
|
-
s.homepage = 'https://github.com/
|
10
|
-
s.license = '
|
9
|
+
s.homepage = 'https://github.com/safe-t/safe-t-rest'
|
10
|
+
s.license = 'mit'
|
11
11
|
|
12
12
|
s.files = Dir[
|
13
13
|
'README.md',
|
@@ -18,5 +18,5 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.bindir = 'bin'
|
19
19
|
s.executables << 'safe-t-bin'
|
20
20
|
s.default_executable = 'safe-t-bin'
|
21
|
-
s.add_dependency 'rest-client', '~>
|
21
|
+
s.add_dependency 'rest-client', '~> 2.0', '>= 2.0.2'
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe-t-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bar Hofesh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 2.0.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '2.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 2.0.2
|
33
33
|
description: 'Ruby gem to interact with Safe-T Box rest API. '
|
34
34
|
email:
|
35
35
|
- Bar.Hofesh@safe-t.com
|
@@ -42,9 +42,9 @@ files:
|
|
42
42
|
- bin/safe-t-bin
|
43
43
|
- lib/safe-t-rest.rb
|
44
44
|
- safe-t-rest.gemspec
|
45
|
-
homepage: https://github.com/
|
45
|
+
homepage: https://github.com/safe-t/safe-t-rest
|
46
46
|
licenses:
|
47
|
-
-
|
47
|
+
- mit
|
48
48
|
metadata: {}
|
49
49
|
post_install_message:
|
50
50
|
rdoc_options: []
|
@@ -62,9 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.6.11
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: A ruby gem to interact with Safe-T Box.
|
69
69
|
test_files: []
|
70
|
-
has_rdoc:
|