eipiai 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -2
- data/features/resources/collection/post.feature +1 -1
- data/features/resources/singular/post.feature +1 -1
- data/lib/eipiai/representers/api.rb +1 -0
- data/lib/eipiai/resources/base.rb +2 -2
- data/lib/eipiai/validators/concerns/formatted_errors.rb +4 -22
- data/lib/eipiai/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: 9c5396f773589fbc8a0dfc3703e987cc832894ce
|
4
|
+
data.tar.gz: 751a5734b70ee80075fe96cb92850e8f2e385724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c4ba3fbcb33ed689a47d0877be428800fd6f4323b021a4e999ed57e9691d84657013df9e6467c677f618b7cf6939204e5e0f3903ee618ea2b83dbe72a28761
|
7
|
+
data.tar.gz: 3a8e2b999c7d9ff0ce7a377a0c3a7511056f87a267df030cfcc8aa1d1bd5a117dec2bf92a15282ebb19eb69ef1da0323774bec316a80c46731cdb0f19cfdab21
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
## [
|
4
|
-
[Full Changelog](https://github.com/blendle/eipiai/compare/v0.7.0...
|
3
|
+
## [v0.8.0](https://github.com/blendle/eipiai/tree/v0.8.0) (2016-06-02)
|
4
|
+
[Full Changelog](https://github.com/blendle/eipiai/compare/v0.7.0...v0.8.0)
|
5
5
|
|
6
6
|
**Closed issues:**
|
7
7
|
|
8
|
+
- Add caching headers to `service\_available?` [\#20](https://github.com/blendle/eipiai/issues/20)
|
8
9
|
- make HealthCheck a singleton [\#19](https://github.com/blendle/eipiai/issues/19)
|
9
10
|
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Some more caching tweaks [\#27](https://github.com/blendle/eipiai/pull/27) ([JeanMertz](https://github.com/JeanMertz))
|
14
|
+
- Caching headers [\#25](https://github.com/blendle/eipiai/pull/25) ([JeanMertz](https://github.com/JeanMertz))
|
15
|
+
- rename/order files more logically [\#24](https://github.com/blendle/eipiai/pull/24) ([JeanMertz](https://github.com/JeanMertz))
|
16
|
+
|
10
17
|
## [v0.7.0](https://github.com/blendle/eipiai/tree/v0.7.0) (2016-05-03)
|
11
18
|
[Full Changelog](https://github.com/blendle/eipiai/compare/v0.6.0...v0.7.0)
|
12
19
|
|
@@ -253,9 +253,9 @@ module Eipiai
|
|
253
253
|
'no-cache, no-store, must-revalidate, private'
|
254
254
|
end
|
255
255
|
|
256
|
-
def json_error_body(errors)
|
256
|
+
def json_error_body(*errors)
|
257
257
|
response.headers['Content-Type'] = 'application/json'
|
258
|
-
response.body = FormattedErrors.parse(errors).to_json
|
258
|
+
response.body = FormattedErrors.parse(*errors).to_json
|
259
259
|
true
|
260
260
|
end
|
261
261
|
|
@@ -7,33 +7,15 @@
|
|
7
7
|
module FormattedErrors
|
8
8
|
class << self
|
9
9
|
def parse(*errors)
|
10
|
-
|
11
|
-
# an array
|
12
|
-
errors = errors.flatten(1) if errors.length == 1 && errors.first.is_a?(Array)
|
13
|
-
errors = errors.first if errors.length == 1 && errors.first.is_a?(Hash)
|
14
|
-
|
15
|
-
errors = errors.map do |key, value|
|
16
|
-
parse_single(key, **value || {})
|
17
|
-
end
|
18
|
-
|
19
|
-
{ _errors: errors }
|
10
|
+
{ _errors: errors.map { |e| error(e.respond_to?(:to_a) ? e.to_a.flatten : [e]) } }
|
20
11
|
end
|
21
12
|
|
22
13
|
private
|
23
14
|
|
24
|
-
def
|
25
|
-
|
26
|
-
id: capitalize(error.to_s),
|
27
|
-
message: humanize(error.to_s)
|
28
|
-
}.merge(properties)
|
29
|
-
end
|
30
|
-
|
31
|
-
def capitalize(string)
|
32
|
-
string.split('_').map(&:capitalize).join
|
33
|
-
end
|
15
|
+
def error(array)
|
16
|
+
error, properties = array
|
34
17
|
|
35
|
-
|
36
|
-
string.split('_').join(' ').downcase
|
18
|
+
{ id: error.to_s.tr('.', '_').classify, message: error.to_s.humanize }.merge(properties || {})
|
37
19
|
end
|
38
20
|
end
|
39
21
|
end
|
data/lib/eipiai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eipiai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Mertz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|