upfluence-utils 0.2.7 → 0.2.8
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e951b33e7527d10d325def4e62ac4e6ec3ef96
|
4
|
+
data.tar.gz: 5314e26feb53f839c1a280da22b3a92fda3c4a2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4277e074820a591c7d8154a103fa7e90fc0ca35ba0a82411070180aeb64e5bc0689fcbded46737c6b6e554c0558f7961207435ef2d7807e135ad2bec0f0f4c4
|
7
|
+
data.tar.gz: d674f4f9b084fb9e75578b92805a1ffd5f3c6ce9a7ce1830dcfac54d385c60e3adaf27bbdf132fc08953d0aa6154dbfa3c376c3943ca1a773dca598038bcbe8c
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'base/exceptions/exceptions_types'
|
2
|
+
require 'active_record/errors'
|
3
|
+
|
4
|
+
module Upfluence
|
5
|
+
module Utils
|
6
|
+
module Thrift
|
7
|
+
module Middleware
|
8
|
+
class ActiveRecord
|
9
|
+
def initialize(app)
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def method_missing(method, *args, &block)
|
14
|
+
@app.send(method, *args, &block)
|
15
|
+
rescue ActiveRecord::RecordInvalid => e
|
16
|
+
raise Base::Exceptions::ValidationError.from_model(e.record)
|
17
|
+
rescue ActiveRecord::RecordNotFound
|
18
|
+
raise Base::Exceptions::NotFound
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upfluence-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Upfluence
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- lib/upfluence/utils/http/middleware/null.rb
|
235
235
|
- lib/upfluence/utils/thrift.rb
|
236
236
|
- lib/upfluence/utils/thrift/middleware.rb
|
237
|
+
- lib/upfluence/utils/thrift/middleware/active_record.rb
|
237
238
|
- lib/upfluence/utils/thrift/middleware/error_catcher.rb
|
238
239
|
- lib/upfluence/utils/thrift/middleware/request_logger.rb
|
239
240
|
- lib/upfluence/utils/thrift/middleware/timeout.rb
|