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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b602b1677568ea5d878174c76224c6a61d431efdb93046f8bd3b897dbed63f55
4
- data.tar.gz: e2464535aa4a6f329bee939b98a32fba4193f472111bda3c669c5f8465d1ac62
3
+ metadata.gz: 3b1554bed2e981630207e781e2cb75015f00fedc24d3e539cde1f00ae4b6d1c9
4
+ data.tar.gz: 6b01480fbfdd9cba2721a1a082a61c2ea4c15f3faea2c2f4b30d6ee8161dfd6c
5
5
  SHA512:
6
- metadata.gz: 194158c8d9f7540ed210e11b3cb1b98ff346c35562b960365dba01113caea71b808363832b613a804bcd45b2df2f815506d8c74c25532011384dd027f38f9660
7
- data.tar.gz: d66527e6277747de70d148af352391998c83a75e08418e0a665c31130c1ea5117e06c2c039ce4b8fad73930e75fe5cfe45c77da72e509ee4da6fdb34ed72c5ee
6
+ metadata.gz: 3002afb2276e1261e757eb099145470af8e0363151bb4381c0154ec4c7940f49d19fc6b712bed1799a248743cb49468d960e229720b458bffc2845e93d4a44d9
7
+ data.tar.gz: d6f0918940ec2c5b66634398542a1c63854628416c3f506d04282b83869c1046a9221becf34e6677b47d4e486de917afbcb3e230f29bb7abaab17b2333ca7935
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  require 'rdoc/task'
3
4
  require 'bundler/gem_tasks'
4
5
  require 'rspec/core/rake_task'
@@ -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 ActiveSupport::Rescuable
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
- render json: { message: exception.message }, status: 403
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uploader
4
- VERSION = '0.5.0'.freeze
4
+ VERSION = '0.5.1'
5
5
  end
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.0
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-17 00:00:00.000000000 Z
12
+ date: 2020-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: sqlite3
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: carrierwave
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: mongoid
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