cloudstrg 0.0.10 → 0.0.11
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.
@@ -2,7 +2,7 @@ module Cloudstrg
|
|
2
2
|
class Cloudstrgplugin < ActiveRecord::Base
|
3
3
|
attr_accessible :plugin_name, :version
|
4
4
|
|
5
|
-
|
5
|
+
has_many :cloudstrgconfig, :class_name => Cloudstrg::Config, :dependent => :destroy
|
6
6
|
has_many :remotes, :class_name => Cloudstrg::Remoteobject, :dependent => :destroy
|
7
7
|
end
|
8
8
|
end
|
@@ -3,6 +3,6 @@ module Cloudstrg
|
|
3
3
|
attr_accessible :plugin_name, :version
|
4
4
|
|
5
5
|
has_one :cloudstrgconfig, :class_name => Cloudstrg::Config, :dependent => :destroy
|
6
|
-
has_many :
|
6
|
+
has_many :remotes, :class_name => Cloudstrg::Remoteobject, :dependent => :destroy
|
7
7
|
end
|
8
8
|
end
|
@@ -2,29 +2,8 @@ module Cloudstrg
|
|
2
2
|
class Config < ActiveRecord::Base
|
3
3
|
attr_accessible :cloudstrgplugin_id, :user_id
|
4
4
|
|
5
|
-
|
6
|
-
belongs_to :cloudstrgplugin, :class_name => Cloudstrg::Cloudstrgplugin
|
5
|
+
has_one :cloudstrgplugin, :class_name => Cloudstrg::Cloudstrgplugin
|
7
6
|
|
8
|
-
attr_accessor :user_email
|
9
7
|
belongs_to :user, :class_name => Cloudstrg.user_class
|
10
|
-
|
11
|
-
before_save :set_hooks
|
12
|
-
|
13
|
-
private
|
14
|
-
def set_hooks
|
15
|
-
if cloudstrgplugin_name
|
16
|
-
self.cloudstrgplugin = Cloudstrg::Cloudstrgplugin.find_by_plugin_name(cloudstrgplugin_name)
|
17
|
-
else
|
18
|
-
self.cloudstrgplugin = Cloudstrg::Cloudstrgplugin.find(self.cloudstrgplugin_id)
|
19
|
-
end
|
20
|
-
|
21
|
-
if not self.cloudstrgplugin
|
22
|
-
return false
|
23
|
-
end
|
24
|
-
self.user = Cloudstrg.user_class.constantize.find_by_email(user_email)
|
25
|
-
if not self.user
|
26
|
-
return false
|
27
|
-
end
|
28
|
-
end
|
29
8
|
end
|
30
9
|
end
|
data/lib/cloudstrg/cloudstrg.rb
CHANGED
@@ -148,12 +148,12 @@ module CloudStrg
|
|
148
148
|
puts plugin_name
|
149
149
|
plugin = Cloudstrg::Cloudstrgplugin.find_by_plugin_name(plugin_name)
|
150
150
|
|
151
|
-
file = Cloudstrg::Remoteobject.where(:user_id => user, :cloudstrgplugin_id => plugin, :filename => filename)
|
151
|
+
file = Cloudstrg::Remoteobject.where(:user_id => user.id, :cloudstrgplugin_id => plugin.id, :filename => filename)
|
152
152
|
if not file.empty?
|
153
153
|
file = file[0]
|
154
154
|
file.filehash = filecontent.hash.to_s
|
155
155
|
else
|
156
|
-
file = plugin.remotes.build(:user_id => user, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
|
156
|
+
file = plugin.remotes.build(:user_id => user.id, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
|
157
157
|
end
|
158
158
|
file.save
|
159
159
|
return file
|
data/lib/cloudstrg/cloudstrg.rb~
CHANGED
@@ -127,7 +127,7 @@ module CloudStrg
|
|
127
127
|
# file_id: the id of the file.
|
128
128
|
#
|
129
129
|
# Returns:
|
130
|
-
# This method returns
|
130
|
+
# This method returns non-nil data if success.
|
131
131
|
#
|
132
132
|
def share_file params
|
133
133
|
raise NotImplementedError
|
@@ -148,7 +148,7 @@ module CloudStrg
|
|
148
148
|
puts plugin_name
|
149
149
|
plugin = Cloudstrg::Cloudstrgplugin.find_by_plugin_name(plugin_name)
|
150
150
|
|
151
|
-
file = Cloudstrg::Remoteobject.where(:user_id => user, :cloudstrgplugin_id => plugin, :filename => filename)
|
151
|
+
file = Cloudstrg::Remoteobject.where(:user_id => user.id, :cloudstrgplugin_id => plugin, :filename => filename)
|
152
152
|
if not file.empty?
|
153
153
|
file = file[0]
|
154
154
|
file.filehash = filecontent.hash.to_s
|
data/lib/cloudstrg/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.11
|
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-
|
12
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|