Class: SafeTRest

Inherits:
Object
  • Object
show all
Defined in:
lib/safe-t-rest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_hash = {}) ⇒ SafeTRest

Returns a new instance of SafeTRest



6
7
8
9
10
11
12
# File 'lib/safe-t-rest.rb', line 6

def initialize(config_hash={})
  @extension_id = config_hash[:extension_id]
  @user_name = config_hash[:user_name]
  @password = config_hash[:password]
  @url = config_hash[:url]
  @role_id = config_hash[:role_id]
end

Instance Attribute Details

#extension_idObject

Returns the value of attribute extension_id



4
5
6
# File 'lib/safe-t-rest.rb', line 4

def extension_id
  @extension_id
end

#passwordObject

Returns the value of attribute password



4
5
6
# File 'lib/safe-t-rest.rb', line 4

def password
  @password
end

#role_idObject

Returns the value of attribute role_id



4
5
6
# File 'lib/safe-t-rest.rb', line 4

def role_id
  @role_id
end

#urlObject

Returns the value of attribute url



4
5
6
# File 'lib/safe-t-rest.rb', line 4

def url
  @url
end

#user_nameObject

Returns the value of attribute user_name



4
5
6
# File 'lib/safe-t-rest.rb', line 4

def user_name
  @user_name
end

Instance Method Details

#file_download(args) ⇒ Object



46
47
48
# File 'lib/safe-t-rest.rb', line 46

def file_download(args)
  send_request("iFileDownload: ['#{@user_name}', '#{@password}', '#{args[:file_name]}', '#{args[:folder_path]}', #{args[:root_folder_id]}]")
end

#file_upload(args) ⇒ Object



42
43
44
# File 'lib/safe-t-rest.rb', line 42

def file_upload(args)
  send_request("iFileUpload: ['#{@user_name}', '#{@password}', '#{args[:file_base64]}', '#{args[:file_name]}', '#{args[:folder_path]}', #{args[:root_folder_id]}]")
end

#get_apps_process_state(guid) ⇒ Object



14
15
16
# File 'lib/safe-t-rest.rb', line 14

def get_apps_process_state(guid)
  send_request("GetAppsProcessState: ['#{guid}', false]}")
end

#get_folder_list(path) ⇒ Object



34
35
36
# File 'lib/safe-t-rest.rb', line 34

def get_folder_list(path)
  send_request("iGetFolderList: ['#{@user_name}', '#{@password}', false, true, '#{path}', 417]")
end

#get_package_file_list(guid) ⇒ Object



18
19
20
# File 'lib/safe-t-rest.rb', line 18

def get_package_file_list(guid)
  send_request("GetPackageFileList: ['#{guid}']}")
end

#get_user_history(days) ⇒ Object



26
27
28
# File 'lib/safe-t-rest.rb', line 26

def get_user_history(days)
  send_request("iGetHistory: ['#{@user_name}', '#{@password}', #{days}]")
end

#safe_share_file(args) ⇒ Object



38
39
40
# File 'lib/safe-t-rest.rb', line 38

def safe_share_file(args)
  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]}]")
end

#user_account_address_listObject



30
31
32
# File 'lib/safe-t-rest.rb', line 30

def 
  send_request("iUserAccountAddressList: ['#{@user_name}', '#{@password}']")
end

#verify_user_accountObject



22
23
24
# File 'lib/safe-t-rest.rb', line 22

def 
  send_request("iVerifyUserAccount: ['#{@user_name}', '#{@password}', true]")
end