softwear-lib 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/softwear/lib/api_controller.rb +16 -3
- data/lib/softwear/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e90afc76e3b1165b82d91bb760e60feb43e2cd09
|
4
|
+
data.tar.gz: 12da3861f5450b3b88ac0557a56e7ad8d15f6202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a87c65a04b1e92f2c334d1bad7449462d1aa91ada5b3a8264402150a6a3cf0f894009d819a717e7c1832fbf6ae6aaf59a500f29d3a22f8c34c708b3290103ab
|
7
|
+
data.tar.gz: dd75b6dc070a46296b2e02f78de390532f0ac037ce0ebb407b1d2fc99a213739e3b2d38ec67c382c113aba5a2353a32841725bf5ae6f6ed207e12277b9806445
|
@@ -42,8 +42,9 @@ module Softwear
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def update
|
45
|
-
super do |
|
46
|
-
|
45
|
+
super do |success, failure|
|
46
|
+
success.json(&render_json)
|
47
|
+
failure.json(&render_errors)
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
@@ -53,7 +54,7 @@ module Softwear
|
|
53
54
|
headers['Location'] = resource_url(record.id)
|
54
55
|
render_json(status: 201).call
|
55
56
|
end
|
56
|
-
failure.json(&
|
57
|
+
failure.json(&render_errors)
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
@@ -82,6 +83,18 @@ module Softwear
|
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
86
|
+
def render_errors(options = {})
|
87
|
+
proc do
|
88
|
+
rendering = {
|
89
|
+
json: { errors: record.errors },
|
90
|
+
status: :unprocessable_entity
|
91
|
+
}
|
92
|
+
.merge(options)
|
93
|
+
|
94
|
+
render rendering
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
85
98
|
def self.model_name
|
86
99
|
name.gsub('Api::', '').gsub('Controller', '').singularize
|
87
100
|
end
|
data/lib/softwear/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: softwear-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Baillie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|