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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48e245a0dd140bdf5277d1c53407be8a84fdd4e6
4
- data.tar.gz: ac2b5878659fbbe4536b8ba8aca1d32f03b3a622
3
+ metadata.gz: b67e12df357da1c51895c6ad58306b3d9ac7ac19
4
+ data.tar.gz: 31311ae4ff084a94b859ee030d76fc0ecc2974f1
5
5
  SHA512:
6
- metadata.gz: da8ddf2c97ec03590b249d040faefad187ee599dd96e46e61e2d7c71a04932263fbc7991835a562a3a0fb5375ee47173403e162a469a8455d9d8f501032b0b5f
7
- data.tar.gz: f4b45188d111b8d06338731f74239ab6951e297fd6d5b15c4288446ef0aa7d1bbe71cfb2e4f99dfe59389706d048eb8bc2ac488d5468d92ba9eeffb3e809d818
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
+ [![Ruby Gem](https://img.shields.io/gem/v/smart_error.svg)](https://rubygems.org/gems/opta_sd)
3
4
  [![Build Status](https://travis-ci.org/ali-sheiba/smart_error.svg?branch=master)](https://travis-ci.org/ali-sheiba/smart_error)
4
5
 
5
- WIP
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's Gemfile:
10
+ Add this line to your applications 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'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).
42
+ Everyone interacting in the SmartError projects 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
- when :first then @error.errors.full_messages.first
12
- when :sentence then @error.errors.full_messages.to_sentence
13
- when :last then @error.errors.full_messages.last
14
- else @error.errors.full_messages.first
15
- end
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.details
21
+ @error.errors.messages.transform_values(&:to_sentence)
20
22
  end
21
23
  end
22
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmartError
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'.freeze
5
5
  end
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.9.1'
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.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-10 00:00:00.000000000 Z
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.9.1
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.9.1
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