smart_error 1.0.0 → 1.0.1
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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +4 -3
- data/lib/smart_error/model_error.rb +9 -7
- data/lib/smart_error/version.rb +1 -1
- data/smart_error.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b67e12df357da1c51895c6ad58306b3d9ac7ac19
|
4
|
+
data.tar.gz: 31311ae4ff084a94b859ee030d76fc0ecc2974f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afb89b4bae27faa2df0afab59c9846980283c8bc9d7ac645730e5eda97f711a3291367591cc396e683ad70c815c20435533acd59820756eeec43ec22964c298f
|
7
|
+
data.tar.gz: d0d1316e688730265a9f69f4e4c36134d0d06bb5ffd766b8637932ca3c975eaee79f783d3264d50deba6db009a2d9d8545f828623822c5525f9a385dfc4c7bba
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# ${project-name} Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
|
+
|
7
|
+
## 1.0.1
|
8
|
+
### Changed
|
9
|
+
- Downgrade `i18n` version to work on old projects
|
10
|
+
- Update Model Mockup and the tests
|
11
|
+
- Fix and add test for Model error `details` value
|
12
|
+
|
13
|
+
## 1.0.0
|
14
|
+
### Added
|
15
|
+
- inital build of the gem.
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# SmartError
|
2
2
|
|
3
|
+
[](https://rubygems.org/gems/opta_sd)
|
3
4
|
[](https://travis-ci.org/ali-sheiba/smart_error)
|
4
5
|
|
5
|
-
|
6
|
+
Simple gem that can handle Exceptions, ActiveRecord Errors and Custom Errors and return readable message and error number/code as usable Hash.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
9
|
-
Add this line to your application
|
10
|
+
Add this line to your application’s Gemfile:
|
10
11
|
|
11
12
|
```ruby
|
12
13
|
gem 'smart_error'
|
@@ -38,4 +39,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
38
39
|
|
39
40
|
## Code of Conduct
|
40
41
|
|
41
|
-
Everyone interacting in the SmartError project
|
42
|
+
Everyone interacting in the SmartError project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ali-sheiba/smart_error/blob/master/CODE_OF_CONDUCT.md).
|
@@ -7,16 +7,18 @@ module SmartError
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def message
|
10
|
-
case SmartError.model_error_message
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
action = case SmartError.model_error_message
|
11
|
+
when :first then :first
|
12
|
+
when :sentence then :to_sentence
|
13
|
+
when :last then :last
|
14
|
+
else :first
|
15
|
+
end
|
16
|
+
|
17
|
+
@error.errors.full_messages.send(action)
|
16
18
|
end
|
17
19
|
|
18
20
|
def details
|
19
|
-
@error.errors.
|
21
|
+
@error.errors.messages.transform_values(&:to_sentence)
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
data/lib/smart_error/version.rb
CHANGED
data/smart_error.gemspec
CHANGED
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.6'
|
30
30
|
spec.add_dependency 'activesupport', '~> 5.1'
|
31
|
-
spec.add_dependency 'i18n', '~> 0.
|
31
|
+
spec.add_dependency 'i18n', '~> 0.8'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_error
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Al-Sheiba
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: '0.8'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: '0.8'
|
97
97
|
description: Simple way to maintain custom error codes and there messages with I18n.
|
98
98
|
email:
|
99
99
|
- ali.alsheiba@gmail.com
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- ".ruby-gemset"
|
107
107
|
- ".ruby-version"
|
108
108
|
- ".travis.yml"
|
109
|
+
- CHANGELOG.md
|
109
110
|
- CODE_OF_CONDUCT.md
|
110
111
|
- Gemfile
|
111
112
|
- LICENSE.txt
|