saoshyant 1.2 → 1.2.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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/README.md +54 -0
  4. data/saoshyant.gemspec +3 -2
  5. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e8f5039563d5adf7b102e4735e3af9f7ac53b003ec45116e49b8bfb2556a5b9
4
- data.tar.gz: a7510586753167922756af504696d79e707b65e43baecba6b9be4120565b6b46
3
+ metadata.gz: 2148ce17d37d35084ad0b7a83ef4b556d2bf5de51e18cd3e8690f9edddaaf064
4
+ data.tar.gz: 3e53a5664c30efe33da7aa56c1583a3797374e6efcf6275cd06e674d5af68c00
5
5
  SHA512:
6
- metadata.gz: 8a557ab6a290bd574415a47f05791be506a465cc5f39df37005e26ff3d5c2c9a55fc1d50194b01de286b3bae12847fe22dfd7e9083356812528e8fdbdb1eae40
7
- data.tar.gz: 0af188cc8d2ca50bc0462781c5b3d8188dc987021c8041baa22c9b360d1ebd5a36e05b634123124fbb13681f08e7f430a95cbfe77da4bb06d14a33f3bf6eca62
6
+ metadata.gz: c4ed69be543e4865f580e149974f24b4ff78b91aa4ccef8a68646e60d1a797b2b81cdd94e202d5311125e08b8ca6b5f72f2a143daf39aa93fef88b705d367f5f
7
+ data.tar.gz: 2e4804f2911e02da1706709b8a8454eb38a31e158b3d7f1786a14a0d03ca40a21c521d2c5fa39b4dfa5d5fe38c611c435388ba9ddc94000928436edfc77fa57c
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 majid imanzade
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,54 @@
1
+ # Saoshyant
2
+
3
+ **Saoshyant is an exception handler Gem** that allows you to customize your exceptions to have a custom reaction when error raised in rails Application.
4
+
5
+ When you Encountering to an error in Rails Application it shows Red Page and explains Exception. With Saoshyant you can log or render error with custom status code.
6
+
7
+ the Most Usage of Saoshyant is in Rest Apis Applications that you need to render errors with custom error code and messages.
8
+
9
+ ## Requirements
10
+ * Rails: 3.0.0+
11
+
12
+ ## Installation
13
+ Add Saoshyant to your Gemfile:
14
+ ```sh
15
+ gem 'saoshyant'
16
+ ```
17
+
18
+ ## Getting Start
19
+
20
+ in blowe Example we want to render `Exceptions` messages in json format.
21
+
22
+ ```rb
23
+ class PageController < ApplicationController
24
+ include Saoshyant
25
+
26
+ def initialize
27
+ saoshyant do |status_code, msg, exception_klass|
28
+ render json: {message: msg, error_class_name: exception_klass}, status: status_code
29
+ end
30
+ end
31
+ end
32
+
33
+ ```
34
+
35
+ ### How Customize Status Code and Log
36
+ default status code in saoshyant gem is `500` error code and it doesnt log Exceptions.
37
+
38
+ if you want to customize Status Code and Log you can use `saoshyant_option` methode:
39
+ ```rb
40
+ saoshyant_option(ExceptionClass, StatusCode, LogFlag)
41
+ ```
42
+ ```rb
43
+ class PageController < ApplicationController
44
+ include Saoshyant
45
+
46
+ def initialize
47
+ saoshyant_option(NameError, 402, true)
48
+ saoshyant do |status_code, msg, exception_klass|
49
+ render json: {message: msg, error_class_name: exception_klass}, status: status_code
50
+ end
51
+ end
52
+ end
53
+
54
+ ```
@@ -1,12 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'saoshyant'
3
- s.version = '1.2'
3
+ s.version = '1.2.1'
4
4
  s.date = '2020-02-10'
5
5
  s.summary = "Handle Rails Exception"
6
- s.description = "when exceptoin raised we dont want see it in ugly and red display, saoshyant present it in json response"
6
+ s.description = "Handle Unexpected Controller Exceptions using Saoshyant."
7
7
  s.authors = ["Majid Imanzade"]
8
8
  s.email = 'majidimanzade1@gmail.com'
9
9
  s.homepage = 'https://rubygems.org/gems/saoshyant'
10
+ s.homepage = "http://github.com/majidimanzade/saoshyant"
10
11
  s.license = 'MIT'
11
12
 
12
13
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saoshyant
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Majid Imanzade
@@ -52,8 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: when exceptoin raised we dont want see it in ugly and red display, saoshyant
56
- present it in json response
55
+ description: Handle Unexpected Controller Exceptions using Saoshyant.
57
56
  email: majidimanzade1@gmail.com
58
57
  executables: []
59
58
  extensions: []
@@ -63,13 +62,15 @@ files:
63
62
  - ".gitignore"
64
63
  - ".rspec"
65
64
  - Gemfile
65
+ - LICENSE
66
+ - README.md
66
67
  - lib/exception_handler.rb
67
68
  - lib/exception_logger.rb
68
69
  - lib/saoshyant.rb
69
70
  - saoshyant.gemspec
70
71
  - spec/saoshyant_test.rb
71
72
  - spec/spec_helper.rb
72
- homepage: https://rubygems.org/gems/saoshyant
73
+ homepage: http://github.com/majidimanzade/saoshyant
73
74
  licenses:
74
75
  - MIT
75
76
  metadata: {}