cloudstrg 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,5 +5,7 @@ module Cloudstrg
5
5
  belongs_to :cloudstrgplugin, :class_name => Cloudstrg::Cloudstrgplugin
6
6
 
7
7
  belongs_to :user, :class_name => Cloudstrg.user_class
8
+
9
+ has_many :gdrivestrgpermissions, :class_name => Gdrivestrg::PermissionId, :dependent => :destroy
8
10
  end
9
11
  end
@@ -124,7 +124,9 @@ module CloudStrg
124
124
  #
125
125
  # Params: the "params" variable must contain the following fields
126
126
  # share_user: the username which we want the file shared with,
127
- # file_id: the id of the file.
127
+ # file_id: the id of the file,
128
+ # local_file_id: the local id of the file,
129
+ # user_id: the id of the user we want to grant.
128
130
  #
129
131
  # Returns:
130
132
  # This method returns non-nil data if success.
@@ -132,6 +134,21 @@ module CloudStrg
132
134
  def share_file params
133
135
  raise NotImplementedError
134
136
  end
137
+
138
+ ###
139
+ # This method allows a user to revoke a file's permission to other users.
140
+ #
141
+ # Params: the "params" variable must contain the following fields
142
+ # file_id: the id of the file,
143
+ # local_file_id: the local id of the file,
144
+ # user_id: the id of the target user.
145
+ #
146
+ # Returns:
147
+ # This method returns non-nil data if success.
148
+ #
149
+ def unshare_file params
150
+ raise NotImplementedError
151
+ end
135
152
 
136
153
  ###
137
154
  # This method check if a referer is valid
@@ -124,7 +124,9 @@ module CloudStrg
124
124
  #
125
125
  # Params: the "params" variable must contain the following fields
126
126
  # share_user: the username which we want the file shared with,
127
- # file_id: the id of the file.
127
+ # file_id: the id of the file,
128
+ # local_file_id: the local id of the file,
129
+ # user_id: the id of the user we want to grant.
128
130
  #
129
131
  # Returns:
130
132
  # This method returns non-nil data if success.
@@ -132,6 +134,22 @@ module CloudStrg
132
134
  def share_file params
133
135
  raise NotImplementedError
134
136
  end
137
+
138
+ ###
139
+ # This method allows a user to revoke a file's permission to other users.
140
+ #
141
+ # Params: the "params" variable must contain the following fields
142
+ # permission_id: the id of the permission we want to revoke,
143
+ # file_id: the id of the file,
144
+ # local_file_id: the local id of the file,
145
+ # user_id: the id of the target user.
146
+ #
147
+ # Returns:
148
+ # This method returns non-nil data if success.
149
+ #
150
+ def unshare_file params
151
+ raise NotImplementedError
152
+ end
135
153
 
136
154
  ###
137
155
  # This method check if a referer is valid
@@ -148,12 +166,12 @@ module CloudStrg
148
166
  puts plugin_name
149
167
  plugin = Cloudstrg::Cloudstrgplugin.find_by_plugin_name(plugin_name)
150
168
 
151
- file = Cloudstrg::Remoteobject.where(:user_id => user.id, :cloudstrgplugin_id => plugin, :filename => filename)
169
+ file = Cloudstrg::Remoteobject.where(:user_id => user.id, :cloudstrgplugin_id => plugin.id, :filename => filename)
152
170
  if not file.empty?
153
171
  file = file[0]
154
172
  file.filehash = filecontent.hash.to_s
155
173
  else
156
- file = plugin.remotes.build(:user_id => user, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
174
+ file = plugin.remotes.build(:user_id => user.id, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
157
175
  end
158
176
  file.save
159
177
  return file
@@ -1,3 +1,3 @@
1
1
  module Cloudstrg
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Cloudstrg
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstrg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-07 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails