error_response 0.0.3 → 0.0.4
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/README.md +42 -0
- data/lib/error_response.rb +1 -1
- data/lib/error_response.yml +45 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18ed19028d5a135d6c8f15aa20530917d29d7f11328afe2217deba0d7538eaf9
|
4
|
+
data.tar.gz: a032a65ea3a258b7bfab2d59f6c8b084e8a0ba1dd5443b607fa55b24f44f0fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5966f694761d1a78e76b9ded6486da61a09735260a4f64c7037bbaedc5b12203625bd245cd316031615c442863dd033a6227623c1cc77d5da36b8122cf54d2f9
|
7
|
+
data.tar.gz: 7d15799ea089125be1173dba842e27492ffef77cd3bebbc0bd645281b1225c6da9f15a9b40ac964ece769866f05f9f288278ce24eede7a666ec35a637653df60
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Error Response
|
2
|
+
|
3
|
+
### Installation
|
4
|
+
|
5
|
+
```
|
6
|
+
gem 'error_response'
|
7
|
+
```
|
8
|
+
|
9
|
+
### Use it perfectly with error_response
|
10
|
+
|
11
|
+
define a error_response method in Api::ApplicationController
|
12
|
+
|
13
|
+
```
|
14
|
+
def error_response(key)
|
15
|
+
render ErrorResponse.api_format(key)
|
16
|
+
end
|
17
|
+
```
|
18
|
+
|
19
|
+
simeply use it where you want
|
20
|
+
|
21
|
+
```
|
22
|
+
return error_reponse(:wrong_email) if @user.nil
|
23
|
+
```
|
24
|
+
|
25
|
+
the response will look like this
|
26
|
+
|
27
|
+
```
|
28
|
+
{
|
29
|
+
status: 403,
|
30
|
+
json:
|
31
|
+
{
|
32
|
+
error_code: 403004,
|
33
|
+
error_message: 'third-party provider is not allow'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
### Update
|
39
|
+
|
40
|
+
Update the error_code.yml if you want new error_code
|
41
|
+
|
42
|
+
Send Pull Request after update
|
data/lib/error_response.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
wrong_email:
|
2
|
+
error_code: '400_001'
|
3
|
+
error_message: user email not correct
|
4
|
+
wrong_password:
|
5
|
+
error_code: '400_002'
|
6
|
+
error_message: user password not correct
|
7
|
+
verify_receipt_failed:
|
8
|
+
error_code: '400_003'
|
9
|
+
error_message: receipt verify failed
|
10
|
+
resend_confirmation_failed:
|
11
|
+
error_code: '400_004'
|
12
|
+
error_message: confirmation mail resend failed
|
13
|
+
reset_password_failed:
|
14
|
+
error_code: '400_005'
|
15
|
+
error_message: reset password failed
|
16
|
+
upload_video_failed:
|
17
|
+
error_code: '400_060'
|
18
|
+
error_message: upload video failed
|
19
|
+
theme_not_found:
|
20
|
+
error_code: '400_061'
|
21
|
+
error_message: current theme is not found
|
22
|
+
client_not_found:
|
23
|
+
error_code: '403_001'
|
24
|
+
error_message: door_keeper client not found
|
25
|
+
access_token_invalid:
|
26
|
+
error_code: '403_002'
|
27
|
+
error_message: door_keeper access_token invalid
|
28
|
+
user_forbidden:
|
29
|
+
error_code: '403_003'
|
30
|
+
error_message: not enough privilege to access data
|
31
|
+
provider_not_allow:
|
32
|
+
error_code: '403_004'
|
33
|
+
error_message: third-party provider is not allow
|
34
|
+
third_party_missing_email:
|
35
|
+
error_code: '403_005'
|
36
|
+
error_message: third party login is missing email
|
37
|
+
email_existed:
|
38
|
+
error_code: '409_001'
|
39
|
+
error_message: email already existed
|
40
|
+
email_confirmed:
|
41
|
+
error_code: '409_002'
|
42
|
+
error_message: email already confirmed
|
43
|
+
preview_processing:
|
44
|
+
error_code: '418_001'
|
45
|
+
error_message: preview processing, please try it later
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: error_response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jameslee
|
@@ -14,15 +14,19 @@ description: use for error_response
|
|
14
14
|
email: jameslee@kdanmobile.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
|
-
extra_rdoc_files:
|
17
|
+
extra_rdoc_files:
|
18
|
+
- README.md
|
18
19
|
files:
|
20
|
+
- README.md
|
19
21
|
- lib/error_response.rb
|
22
|
+
- lib/error_response.yml
|
20
23
|
homepage: https://github.com/kdan-mobile-software-ltd/error_response
|
21
24
|
licenses:
|
22
25
|
- MIT
|
23
26
|
metadata: {}
|
24
27
|
post_install_message:
|
25
|
-
rdoc_options:
|
28
|
+
rdoc_options:
|
29
|
+
- "--charset=URF-8"
|
26
30
|
require_paths:
|
27
31
|
- lib
|
28
32
|
required_ruby_version: !ruby/object:Gem::Requirement
|