error_response 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db8b74fbfc00dab269f2d31e3eeeb0ad1a6b621c36e6973f7b2496e7b058b307
4
- data.tar.gz: 667bded93a36377a778a63478807d7f5f2730eb130ab89e548b05c71eb77aa96
3
+ metadata.gz: 18ed19028d5a135d6c8f15aa20530917d29d7f11328afe2217deba0d7538eaf9
4
+ data.tar.gz: a032a65ea3a258b7bfab2d59f6c8b084e8a0ba1dd5443b607fa55b24f44f0fc2
5
5
  SHA512:
6
- metadata.gz: 7f627379bdac72e455bc5d8a1ac405569702fff59d57e8d99782b721b840effaa83a25a7e9ae4dd2cf1ccaefcfc564beba2af823d3ea8b65b23fa2ef1b226ea7
7
- data.tar.gz: 4fa9e8b21f30134dc9b7c9f6220355b8b894b3b987df7137633ccb452e950593f7ccb34fc2e84fc2332a6c94f27cb834b80c087dbbab4e62258cc5b8017145ca
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
@@ -1,6 +1,6 @@
1
1
  require 'settingslogic'
2
2
  class ErrorResponse < Settingslogic
3
- source "lib/error_code.yml"
3
+ source "lib/error_response.yml"
4
4
 
5
5
  def call(key, message=nil)
6
6
  error_data = send(key)
@@ -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.3
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