Class: SeafileApi::Connect
- Inherits:
-
Object
- Object
- SeafileApi::Connect
- Defined in:
- lib/seafile-api.rb,
lib/seafile-api/file.rb,
lib/seafile-api/group.rb,
lib/seafile-api/share.rb,
lib/seafile-api/account.rb,
lib/seafile-api/library.rb,
lib/seafile-api/message.rb,
lib/seafile-api/starred.rb,
lib/seafile-api/directory.rb,
lib/seafile-api/group/group.rb,
lib/seafile-api/shared/share.rb,
lib/seafile-api/file/dry_methods.rb,
lib/seafile-api/group/group_member.rb,
lib/seafile-api/file/get_operations.rb,
lib/seafile-api/group/group_message.rb,
lib/seafile-api/library/del_library.rb,
lib/seafile-api/library/get_library.rb,
lib/seafile-api/shared/shared_files.rb,
lib/seafile-api/file/file_operations.rb,
lib/seafile-api/file/post_operations.rb,
lib/seafile-api/library/post_library.rb,
lib/seafile-api/shared/shared_libraries.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#token ⇒ Object
Returns the value of attribute token.
-
#user_name ⇒ Object
Returns the value of attribute user_name.
Instance Method Summary collapse
- #account_info ⇒ Object
- #add_group(group_name) ⇒ Object
-
#add_group_member(user_email, group_id) ⇒ Object
group member.
- #block_link(repo = self.repo) ⇒ Object
-
#copy_file(filename, dst_dir = '/', dst_repo = self.repo, src_repo = self.repo) ⇒ Object
TODO: missing arguments at 3,0,3 , at 3.0.0 all wark.
- #create_accounts(email, pass) ⇒ Object
- #create_default_library ⇒ Object
- #create_dir(path, repo = self.repo) ⇒ Object
- #create_file(filename, repo = self.repo) ⇒ Object
- #create_file_share_link(file, repo_id = self.repo) ⇒ Object
-
#create_library(name, desc = "new repo", pwd = nil) ⇒ Object
post libraries.
- #create_public_library(repo_id) ⇒ Object
- #create_sub_library(repo_id, name, p = '/') ⇒ Object
- #decrypt_library(repo_id, password) ⇒ Object
-
#default_library ⇒ Object
get libraries.
- #del_account(email) ⇒ Object
-
#del_dir(path, repo = self.repo) ⇒ Object
You do not have permission to perform this action.
- #del_file(filename, repo = self.repo) ⇒ Object
- #del_file_share_link(shared_t) ⇒ Object
- #del_group_member(user_email, group_id) ⇒ Object
-
#del_library(repo_id) ⇒ Object
del libraries.
- #download_dir(path, repo = self.repo) ⇒ Object
-
#download_private_shared_file(file_t) ⇒ Object
‘TODO need know what is private shared file -> need test“error_msg": "Token not found"}.
- #fetch_library_info(repo_id) ⇒ Object
- #file_detail(filename, repo = self.repo) ⇒ Object
- #file_history(filename, repo = self.repo) ⇒ Object
- #file_link(filename, repo = self.repo) ⇒ Object
- #get_token ⇒ Object
- #group_message_detail(group_id, msg_id) ⇒ Object
-
#group_messages(group_id) ⇒ Object
group_message.
- #group_messages_replies ⇒ Object
-
#initialize(user_name, password, host, repo) ⇒ Connect
constructor
A new instance of Connect.
- #library_history(repo_id) ⇒ Object
- #library_info(repo_id) ⇒ Object
- #library_owner(repo_id) ⇒ Object
- #link_revision(filename, commit_id, repo = self.repo) ⇒ Object
- #list_accounts ⇒ Object
-
#list_beshared_libraries ⇒ Object
TODO: need know what it do.
- #list_dir_entry(path = '/', repo = self.repo) ⇒ Object
-
#list_file_share_link ⇒ Object
share.
- #list_groups ⇒ Object
- #list_libraries ⇒ Object
-
#list_shared_files ⇒ Object
shared_files.
-
#list_shared_libraries ⇒ Object
shared_libraries.
- #list_starred ⇒ Object
- #list_user_message(to_email) ⇒ Object
- #list_virtual_libraries ⇒ Object
- #move_file(filename, dst_dir = '/', dest_repo = self.repo, src_repo = self.repo) ⇒ Object
-
#private_shared_file_detail(file_t) ⇒ Object
TODO need know what is private shared file -> need test“error_msg": "Token not found"}.
- #remove_public_library(repo_id) ⇒ Object
- #rename_file(old_name, new_name, repo = self.repo) ⇒ Object
- #reply_group_message(group_id, message, msg_id) ⇒ Object
- #reply_user_message(to_email, message) ⇒ Object
-
#revert_file(filename, commit_id, repo = self.repo) ⇒ Object
TODO: need test on new server version not working seafile server version 3.0.3 , curl to not working.
-
#search_libraries(keyword) ⇒ Object
search not supported.
- #send_group_message(group_id, message, repo_id = self.repo, path = "/") ⇒ Object
-
#share_dir(email, path, perm = "r", repo = self.repo, s_type = "d") ⇒ Object
You do not have permission to perform this action.
-
#share_library(repo_id, user, group_id, permission = "rw", share_type = "group") ⇒ Object
TODO need test not working !!.
- #shared_file_detail(file_t) ⇒ Object
- #shared_file_link(file_t) ⇒ Object
- #star_a_file(file, repo_id = self.repo) ⇒ Object
- #unread_message ⇒ Object
-
#unshare_library(repo_id, share_type, user, group_id) ⇒ Object
TODO need test not working wrong user error.
- #unstar_a_file(file, repo_id = self.repo) ⇒ Object
- #update_account(email, pass) ⇒ Object
- #update_file(file, target_file = nil, repo = self.repo) ⇒ Object
- #upload_file(file, path = '/', repo = self.repo) ⇒ Object
Constructor Details
#initialize(user_name, password, host, repo) ⇒ Connect
Returns a new instance of Connect.
13 14 15 16 17 18 19 |
# File 'lib/seafile-api.rb', line 13 def initialize(user_name ,password,host,repo) self.user_name = user_name self.password = password self.host = host self.repo = repo self.token = self.get_token end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
9 10 11 |
# File 'lib/seafile-api.rb', line 9 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/seafile-api.rb', line 8 def password @password end |
#repo ⇒ Object
Returns the value of attribute repo.
10 11 12 |
# File 'lib/seafile-api.rb', line 10 def repo @repo end |
#token ⇒ Object
Returns the value of attribute token.
11 12 13 |
# File 'lib/seafile-api.rb', line 11 def token @token end |
#user_name ⇒ Object
Returns the value of attribute user_name.
7 8 9 |
# File 'lib/seafile-api.rb', line 7 def user_name @user_name end |
Instance Method Details
#account_info ⇒ Object
13 14 15 |
# File 'lib/seafile-api/account.rb', line 13 def account_info get_acc_info end |
#add_group(group_name) ⇒ Object
6 7 8 |
# File 'lib/seafile-api/group.rb', line 6 def add_group(group_name) put_new_group(group_name) end |
#add_group_member(user_email, group_id) ⇒ Object
group member
29 30 31 |
# File 'lib/seafile-api/group.rb', line 29 def add_group_member(user_email,group_id) put_new_meber_to_group(user_email,group_id) end |
#block_link(repo = self.repo) ⇒ Object
22 23 24 |
# File 'lib/seafile-api/file.rb', line 22 def block_link(repo=self.repo) get_block(repo) end |
#copy_file(filename, dst_dir = '/', dst_repo = self.repo, src_repo = self.repo) ⇒ Object
TODO: missing arguments at 3,0,3 , at 3.0.0 all wark
42 43 44 |
# File 'lib/seafile-api/file.rb', line 42 def copy_file(filename,dst_dir='/',dst_repo=self.repo,src_repo=self.repo) post_copy(src_repo,{"file_names"=>filename, "dst_repo" => dst_repo, "dst_dir"=>dst_dir}) end |
#create_accounts(email, pass) ⇒ Object
7 8 9 |
# File 'lib/seafile-api/account.rb', line 7 def create_accounts(email,pass) put_create_acc(email,pass) end |
#create_default_library ⇒ Object
41 42 43 |
# File 'lib/seafile-api/library.rb', line 41 def create_default_library post_default_lib end |
#create_dir(path, repo = self.repo) ⇒ Object
7 8 9 |
# File 'lib/seafile-api/directory.rb', line 7 def create_dir(path,repo=self.repo) post_create_dir(path,repo) end |
#create_file(filename, repo = self.repo) ⇒ Object
33 34 35 |
# File 'lib/seafile-api/file.rb', line 33 def create_file(filename,repo=self.repo) post_file(filename,repo) end |
#create_file_share_link(file, repo_id = self.repo) ⇒ Object
8 9 10 |
# File 'lib/seafile-api/share.rb', line 8 def create_file_share_link(file,repo_id=self.repo) create_share_link(file,repo_id) end |
#create_library(name, desc = "new repo", pwd = nil) ⇒ Object
post libraries
38 39 40 |
# File 'lib/seafile-api/library.rb', line 38 def create_library(name,desc="new repo",pwd=nil) post_lib({"name" =>name,"desc" =>desc,"passwd" => pwd}) end |
#create_public_library(repo_id) ⇒ Object
44 45 46 |
# File 'lib/seafile-api/library.rb', line 44 def create_public_library(repo_id) post_public_lib(repo_id) end |
#create_sub_library(repo_id, name, p = '/') ⇒ Object
8 9 10 |
# File 'lib/seafile-api/library.rb', line 8 def create_sub_library(repo_id,name,p='/') get_create_sub_lib(repo_id,p,name) end |
#decrypt_library(repo_id, password) ⇒ Object
48 49 50 |
# File 'lib/seafile-api/library.rb', line 48 def decrypt_library(repo_id,password) post_lib_pass(repo_id,{'password' => password }) end |
#default_library ⇒ Object
get libraries
5 6 7 |
# File 'lib/seafile-api/library.rb', line 5 def default_library get_default_lib end |
#del_account(email) ⇒ Object
16 17 18 |
# File 'lib/seafile-api/account.rb', line 16 def del_account(email) delete_acc(email) end |
#del_dir(path, repo = self.repo) ⇒ Object
You do not have permission to perform this action
12 13 14 |
# File 'lib/seafile-api/directory.rb', line 12 def del_dir(path,repo=self.repo) delete_directory(path,repo) end |
#del_file(filename, repo = self.repo) ⇒ Object
50 51 52 |
# File 'lib/seafile-api/file.rb', line 50 def del_file(filename,repo=self.repo) delete_file(filename,repo) end |
#del_file_share_link(shared_t) ⇒ Object
11 12 13 |
# File 'lib/seafile-api/share.rb', line 11 def del_file_share_link(shared_t) delete_share_link(shared_t) end |
#del_group_member(user_email, group_id) ⇒ Object
33 34 35 |
# File 'lib/seafile-api/group.rb', line 33 def del_group_member(user_email,group_id) delete_group_member(user_email,group_id) end |
#del_library(repo_id) ⇒ Object
del libraries
53 54 55 |
# File 'lib/seafile-api/library.rb', line 53 def del_library(repo_id) delete_lib(repo_id) end |
#download_dir(path, repo = self.repo) ⇒ Object
15 16 17 |
# File 'lib/seafile-api/directory.rb', line 15 def download_dir(path,repo=self.repo) get_download_dir(path,repo) end |
#download_private_shared_file(file_t) ⇒ Object
‘TODO need know what is private shared file -> need test“error_msg": "Token not found"}
29 30 31 |
# File 'lib/seafile-api/share.rb', line 29 def download_private_shared_file(file_t) get_private_shared_file_link(file_t) end |
#fetch_library_info(repo_id) ⇒ Object
33 34 35 |
# File 'lib/seafile-api/library.rb', line 33 def fetch_library_info(repo_id) get_lib_download_info(repo_id) end |
#file_detail(filename, repo = self.repo) ⇒ Object
11 12 13 |
# File 'lib/seafile-api/file.rb', line 11 def file_detail(filename,repo=self.repo) get_description(filename,repo) end |
#file_history(filename, repo = self.repo) ⇒ Object
18 19 20 |
# File 'lib/seafile-api/file.rb', line 18 def file_history(filename,repo=self.repo) get_history(filename,repo) end |
#file_link(filename, repo = self.repo) ⇒ Object
5 6 7 |
# File 'lib/seafile-api/file.rb', line 5 def file_link(filename,repo=self.repo) get_file_link(filename,repo) end |
#get_token ⇒ Object
8 9 10 |
# File 'lib/seafile-api/file.rb', line 8 def get_token get_sf_token end |
#group_message_detail(group_id, msg_id) ⇒ Object
13 14 15 |
# File 'lib/seafile-api/group.rb', line 13 def (group_id,msg_id) (group_id,msg_id) end |
#group_messages(group_id) ⇒ Object
group_message
10 11 12 |
# File 'lib/seafile-api/group.rb', line 10 def (group_id) (group_id) end |
#group_messages_replies ⇒ Object
16 17 18 |
# File 'lib/seafile-api/group.rb', line 16 def end |
#library_history(repo_id) ⇒ Object
30 31 32 |
# File 'lib/seafile-api/library.rb', line 30 def library_history(repo_id) get_lib_history(repo_id) end |
#library_info(repo_id) ⇒ Object
22 23 24 |
# File 'lib/seafile-api/library.rb', line 22 def library_info(repo_id) get_lib_info(repo_id) end |
#library_owner(repo_id) ⇒ Object
26 27 28 |
# File 'lib/seafile-api/library.rb', line 26 def library_owner(repo_id) get_lib_owner(repo_id) end |
#link_revision(filename, commit_id, repo = self.repo) ⇒ Object
14 15 16 |
# File 'lib/seafile-api/file.rb', line 14 def link_revision(filename,commit_id,repo=self.repo) get_link_file_revision(filename,commit_id,repo) end |
#list_accounts ⇒ Object
4 5 6 |
# File 'lib/seafile-api/account.rb', line 4 def list_accounts get_list_acc end |
#list_beshared_libraries ⇒ Object
TODO: need know what it do
42 43 44 |
# File 'lib/seafile-api/share.rb', line 42 def list_beshared_libraries get_list_beshared_libraries end |
#list_dir_entry(path = '/', repo = self.repo) ⇒ Object
4 5 6 |
# File 'lib/seafile-api/directory.rb', line 4 def list_dir_entry(path='/',repo=self.repo) get_list_dir_entry(repo,path) end |
#list_file_share_link ⇒ Object
share
4 5 6 |
# File 'lib/seafile-api/share.rb', line 4 def list_file_share_link get_list_shared_files_link end |
#list_groups ⇒ Object
3 4 5 |
# File 'lib/seafile-api/group.rb', line 3 def list_groups get_list_groups end |
#list_libraries ⇒ Object
15 16 17 |
# File 'lib/seafile-api/library.rb', line 15 def list_libraries get_list_lib end |
#list_shared_files ⇒ Object
shared_files
16 17 18 |
# File 'lib/seafile-api/share.rb', line 16 def list_shared_files get_list_shared_files end |
#list_shared_libraries ⇒ Object
shared_libraries
38 39 40 |
# File 'lib/seafile-api/share.rb', line 38 def list_shared_libraries get_list_shared_libraries end |
#list_starred ⇒ Object
3 4 5 |
# File 'lib/seafile-api/starred.rb', line 3 def list_starred get_list_starred_files end |
#list_user_message(to_email) ⇒ Object
3 4 5 |
# File 'lib/seafile-api/message.rb', line 3 def (to_email) (to_email) end |
#list_virtual_libraries ⇒ Object
19 20 21 |
# File 'lib/seafile-api/library.rb', line 19 def list_virtual_libraries get_list_virtual_lib end |
#move_file(filename, dst_dir = '/', dest_repo = self.repo, src_repo = self.repo) ⇒ Object
46 47 48 |
# File 'lib/seafile-api/file.rb', line 46 def move_file(filename,dst_dir='/',dest_repo=self.repo,src_repo=self.repo) post_move(filename,src_repo,{"operation"=>"move", "dst_repo" => dest_repo, "dst_dir"=>dst_dir}) end |
#private_shared_file_detail(file_t) ⇒ Object
TODO need know what is private shared file -> need test“error_msg": "Token not found"}
33 34 35 |
# File 'lib/seafile-api/share.rb', line 33 def private_shared_file_detail(file_t) get_private_shared_file_detail(file_t) end |
#remove_public_library(repo_id) ⇒ Object
56 57 58 |
# File 'lib/seafile-api/library.rb', line 56 def remove_public_library(repo_id) delete_public_lib(repo_id) end |
#rename_file(old_name, new_name, repo = self.repo) ⇒ Object
37 38 39 |
# File 'lib/seafile-api/file.rb', line 37 def rename_file(old_name,new_name,repo=self.repo) post_rename(old_name,repo,{"operation"=>"rename", "newname" => new_name}) end |
#reply_group_message(group_id, message, msg_id) ⇒ Object
24 25 26 |
# File 'lib/seafile-api/group.rb', line 24 def (group_id,,msg_id) (group_id,msg_id,{"message" => }) end |
#reply_user_message(to_email, message) ⇒ Object
9 10 11 |
# File 'lib/seafile-api/message.rb', line 9 def (to_email,) (to_email,{"message" => }) end |
#revert_file(filename, commit_id, repo = self.repo) ⇒ Object
TODO: need test on new server version not working seafile server version 3.0.3 , curl to not working
56 57 58 |
# File 'lib/seafile-api/file.rb', line 56 def revert_file(filename,commit_id,repo=self.repo) post_revert("#{filename}",commit_id,repo) end |
#search_libraries(keyword) ⇒ Object
search not supported
12 13 14 |
# File 'lib/seafile-api/library.rb', line 12 def search_libraries(keyword) get_searched_lib(keyword) end |
#send_group_message(group_id, message, repo_id = self.repo, path = "/") ⇒ Object
20 21 22 |
# File 'lib/seafile-api/group.rb', line 20 def (group_id,,repo_id=self.repo,path="/") (group_id,{"message"=> ,"repo_id"=> repo_id,"path"=> path}) end |
#share_dir(email, path, perm = "r", repo = self.repo, s_type = "d") ⇒ Object
You do not have permission to perform this action
19 20 21 |
# File 'lib/seafile-api/directory.rb', line 19 def share_dir(email,path,perm="r",repo=self.repo,s_type="d") post_share_dir(repo,{"email"=> email, "path"=> path,"s_type"=> s_type,"perm"=> perm}) end |
#share_library(repo_id, user, group_id, permission = "rw", share_type = "group") ⇒ Object
TODO need test not working !!
46 47 48 |
# File 'lib/seafile-api/share.rb', line 46 def share_library(repo_id,user,group_id,="rw",share_type="group") put_share_library(repo_id,share_type,user,group_id,) end |
#shared_file_detail(file_t) ⇒ Object
23 24 25 |
# File 'lib/seafile-api/share.rb', line 23 def shared_file_detail(file_t) get_share_file_detail(file_t) end |
#shared_file_link(file_t) ⇒ Object
20 21 22 |
# File 'lib/seafile-api/share.rb', line 20 def shared_file_link(file_t) get_shared_file_link(file_t) end |
#star_a_file(file, repo_id = self.repo) ⇒ Object
6 7 8 |
# File 'lib/seafile-api/starred.rb', line 6 def star_a_file(file,repo_id=self.repo) post_star_file({"repo_id" => repo_id, "p" => file}) end |
#unread_message ⇒ Object
6 7 8 |
# File 'lib/seafile-api/message.rb', line 6 def end |
#unshare_library(repo_id, share_type, user, group_id) ⇒ Object
TODO need test not working wrong user error
50 51 52 |
# File 'lib/seafile-api/share.rb', line 50 def unshare_library(repo_id,share_type,user,group_id) delete_unshare_library(repo_id,share_type,user,group_id) end |
#unstar_a_file(file, repo_id = self.repo) ⇒ Object
9 10 11 |
# File 'lib/seafile-api/starred.rb', line 9 def unstar_a_file(file,repo_id=self.repo) delete_unstar_file(repo_id,file) end |
#update_account(email, pass) ⇒ Object
10 11 12 |
# File 'lib/seafile-api/account.rb', line 10 def update_account(email,pass) put_update_acc(email,pass) end |
#update_file(file, target_file = nil, repo = self.repo) ⇒ Object
29 30 31 |
# File 'lib/seafile-api/file.rb', line 29 def update_file(file,target_file=nil,repo=self.repo) post_update(repo,{"file" => file, "filename" =>File.basename(file), "target_file"=> target_file ||File.basename(file)}) end |
#upload_file(file, path = '/', repo = self.repo) ⇒ Object
26 27 28 |
# File 'lib/seafile-api/file.rb', line 26 def upload_file(file,path='/',repo=self.repo) post_upload(repo,{"file"=> file,"filename"=> File.basename(file),"parent_dir"=> "#{path}"}) end |