rails-uploader 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -1
- data/app/controllers/uploader/attachments_controller.rb +0 -6
- data/lib/uploader/authorization.rb +4 -2
- data/lib/uploader/json_rendering.rb +11 -0
- data/lib/uploader/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b1554bed2e981630207e781e2cb75015f00fedc24d3e539cde1f00ae4b6d1c9
|
4
|
+
data.tar.gz: 6b01480fbfdd9cba2721a1a082a61c2ea4c15f3faea2c2f4b30d6ee8161dfd6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3002afb2276e1261e757eb099145470af8e0363151bb4381c0154ec4c7940f49d19fc6b712bed1799a248743cb49468d960e229720b458bffc2845e93d4a44d9
|
7
|
+
data.tar.gz: d6f0918940ec2c5b66634398542a1c63854628416c3f506d04282b83869c1046a9221becf34e6677b47d4e486de917afbcb3e230f29bb7abaab17b2333ca7935
|
data/Rakefile
CHANGED
@@ -69,12 +69,6 @@ module Uploader
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
def render_json(hash_or_object, status = 200)
|
73
|
-
self.status = status
|
74
|
-
self.content_type = request.format
|
75
|
-
self.response_body = hash_or_object.to_json(root: false)
|
76
|
-
end
|
77
|
-
|
78
72
|
def asset_params
|
79
73
|
ActionController::Parameters.new(params).require(:asset).permit(:data)
|
80
74
|
end
|
@@ -1,13 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/concern'
|
4
|
+
require_relative 'json_rendering'
|
4
5
|
|
5
6
|
module Uploader
|
6
7
|
module Authorization
|
7
8
|
extend ActiveSupport::Concern
|
8
9
|
|
9
10
|
included do
|
10
|
-
include
|
11
|
+
include JsonRendering
|
12
|
+
include ActionController::Rescue
|
11
13
|
|
12
14
|
rescue_from Uploader::AccessDenied, with: :dispatch_uploader_access_denied
|
13
15
|
end
|
@@ -44,7 +46,7 @@ module Uploader
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def dispatch_uploader_access_denied(exception)
|
47
|
-
|
49
|
+
render_json({ message: exception.message }, 403)
|
48
50
|
end
|
49
51
|
|
50
52
|
def current_uploader_user
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Uploader
|
4
|
+
module JsonRendering
|
5
|
+
def render_json(hash_or_object, status = 200)
|
6
|
+
self.status = status
|
7
|
+
self.content_type = request.format
|
8
|
+
self.response_body = hash_or_object.to_json(root: false)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/uploader/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-uploader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Galeta
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-11-
|
12
|
+
date: 2020-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: carrierwave
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: mongoid
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: sqlite3
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/uploader/hooks/active_record.rb
|
94
94
|
- lib/uploader/hooks/formtastic.rb
|
95
95
|
- lib/uploader/hooks/simple_form.rb
|
96
|
+
- lib/uploader/json_rendering.rb
|
96
97
|
- lib/uploader/upload_request.rb
|
97
98
|
- lib/uploader/version.rb
|
98
99
|
- spec/dummy/README.rdoc
|