safe-t-rest 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e702f2133cba9ebc965b8037aab33c7b8f3bc21
4
- data.tar.gz: e9f5ffbaabcf5109296b9767026de6c9619d6876
3
+ metadata.gz: 9b8190532e352f035b2b321f98e7ba83aac7f94c
4
+ data.tar.gz: 9e50cfc6e396ea5d9e0f094f4b059c32c68db29a
5
5
  SHA512:
6
- metadata.gz: 680980bf3331b44c008126d011212a86934d6265c7818aec1a6580944e895ae7da89466913a421b28b4baccff78333327c62d86f03fdd7d42a6afe4d24a4028b
7
- data.tar.gz: d6de2ced9da2dc5a0eabf376a7cbeddcaa2719c54093a19339cfbd2deb340b2ad6c3bdeaa0e58331a83faa8cbae5bff169e3be4913b1501f784612856aec7fb5
6
+ metadata.gz: 94ff331dda6f0bde22a8d25d5a32aab612c02f2249c17ec04e268c9f9a210e09ccf3c89f0c1fa087fe8ba51ef3c6af693ec04506fac926989a257ca878eb0644
7
+ data.tar.gz: 56b10c2c05b2ec61964e343c619e843deb90067ac0adeb72271783579e4f8593f3ba280581233e6da10b9972806df4cbefe38d8d7f02dee06b0d237bbf9cb40d
data/README.md CHANGED
@@ -33,4 +33,27 @@ client.guid = 'my_packge_GUID.123123'
33
33
  ```ruby
34
34
  puts client.getAppsProcessState
35
35
  puts client.getPackageFileList
36
+ ```
37
+
38
+ * Safe Share
39
+ ```ruby
40
+ args = {
41
+ :files => 'file.txt', # name of file to share
42
+ :recipients => 'alexander.dan@safe-t.com', # Email address of the one you want to share with
43
+ :sender_name => 'Bar Hofesh',
44
+ :sender_address => 'bar.hofesh@safe-t.com',
45
+ :subject => 'Testing Ruby API', # Email Subject
46
+ :message => 'This is a Test message, just checking the Ruby API using REST', # Email body message
47
+ :message_encryption_level => '0', # 0 = high, 1 = normal, 2 = low
48
+ :delivery_method => '0',
49
+ :mobile_recipient => '',
50
+ :return_receipt => true, # get back a notification when the file was downloaded
51
+ :safe_reply => true, # send an safe reply invitation
52
+ :max_downloads => '3', # maximum number of allowed downloads
53
+ :package_expiry => '1440', # in minutes
54
+ :folder_path => '', # empty means root folder
55
+ :root_folder_id => '417' # My Storage ID
56
+ }
57
+
58
+ client.iSafeShareFile(args)
36
59
  ```
data/lib/safe-t-rest.rb CHANGED
@@ -1,74 +1,82 @@
1
1
  require 'rest-client'
2
- require 'base64'
3
2
 
4
-
5
3
  class SafeTRest
6
4
  attr_accessor(:extenstion_id, :username, :password, :url, :role_id, :guid)
7
5
 
8
6
  def getAppsProcessState
9
- a = RestClient::Request.execute(
10
- :method => :post,
11
- :url => @url,
12
- :headers => {
13
- :servletRequestID => 'MethodRequest',
14
- :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', GetAppsProcessState: ['#{@guid}', false]}"
15
- }
7
+ RestClient::Request.execute(
8
+ :method => :post,
9
+ :url => @url,
10
+ :headers => {
11
+ :servletRequestID => 'MethodRequest',
12
+ :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', GetAppsProcessState: ['#{@guid}', false]}"
13
+ }
16
14
  )
17
15
  end
18
16
 
19
17
  def getPackageFileList
20
- a = RestClient::Request.execute(
21
- :method => :post,
22
- :url => @url,
23
- :headers => {
24
- :servletRequestID => 'MethodRequest',
25
- :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', GetPackageFileList: ['#{@guid}']}"
26
- }
18
+ RestClient::Request.execute(
19
+ :method => :post,
20
+ :url => @url,
21
+ :headers => {
22
+ :servletRequestID => 'MethodRequest',
23
+ :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', GetPackageFileList: ['#{@guid}']}"
24
+ }
27
25
  )
28
26
  end
29
27
 
30
28
  def iVerifyUserAccount
31
- a = RestClient::Request.execute(
32
- :method => :post,
33
- :url => @url,
34
- :headers => {
35
- :servletRequestID => 'MethodRequest',
36
- :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iVerifyUserAccount: ['#{@username}', '#{@password}', true]}"
37
- }
38
- ).split(':')
39
- return [a[0], Base64.decode64(a[1])].join(':')
29
+ RestClient::Request.execute(
30
+ :method => :post,
31
+ :url => @url,
32
+ :headers => {
33
+ :servletRequestID => 'MethodRequest',
34
+ :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iVerifyUserAccount: ['#{@username}', '#{@password}', true]}"
35
+ }
36
+ )
40
37
  end
41
38
 
42
39
  def iGetHistory(days)
43
- a = RestClient::Request.execute(
44
- :method => :post,
45
- :url => @url,
46
- :headers => {
47
- :servletRequestID => 'MethodRequest',
48
- :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iGetHistory: ['#{@username}', '#{@password}', #{days}]}"
49
- }
40
+ RestClient::Request.execute(
41
+ :method => :post,
42
+ :url => @url,
43
+ :headers => {
44
+ :servletRequestID => 'MethodRequest',
45
+ :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iGetHistory: ['#{@username}', '#{@password}', #{days}]}"
46
+ }
50
47
  )
51
48
  end
52
49
 
53
50
  def iUserAccountAddressList
54
- a = RestClient::Request.execute(
55
- :method => :post,
56
- :url => @url,
57
- :headers => {
58
- :servletRequestID => 'MethodRequest',
59
- :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iUserAccountAddressList: ['#{@username}', '#{@password}']}"
60
- }
51
+ RestClient::Request.execute(
52
+ :method => :post,
53
+ :url => @url,
54
+ :headers => {
55
+ :servletRequestID => 'MethodRequest',
56
+ :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iUserAccountAddressList: ['#{@username}', '#{@password}']}"
57
+ }
58
+ )
59
+ end
60
+
61
+ def iGetFolderList(path)
62
+ RestClient::Request.execute(
63
+ :method => :post,
64
+ :url => @url,
65
+ :headers => {
66
+ :servletRequestID => 'MethodRequest',
67
+ :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iGetFolderList: ['#{@username}', '#{@password}', #{false}, #{true}, '#{path}', 417]}"
68
+ }
61
69
  )
62
70
  end
63
71
 
64
- def iGetFolderList
65
- a = RestClient::Request.execute(
66
- :method => :post,
67
- :url => @url,
68
- :headers => {
69
- :servletRequestID => 'MethodRequest',
70
- :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iGetFolderList: ['#{@username}', '#{@password}', #{true}, #{false}, '0/000', 417]}"
71
- }
72
+ def iSafeShareFile(args)
73
+ RestClient::Request.execute(
74
+ :method => :post,
75
+ :url => @url,
76
+ :headers => {
77
+ :servletRequestID => 'MethodRequest',
78
+ :BusinessLogic => "{Username:'', Password:'', RoleID: '#{@role_id}', ExtensionID: '#{@extenstion_id}', iSafeShareFile: ['#{@username}', '#{@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]}]}"
79
+ }
72
80
  )
73
81
  end
74
82
 
data/safe-t-rest.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'safe-t-rest'
3
- s.version = '0.0.4'
3
+ s.version = '0.0.5'
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. '
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.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bar Hofesh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-28 00:00:00.000000000 Z
11
+ date: 2015-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client