json_http_error 0.0.2 → 0.0.8

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
  SHA1:
3
- metadata.gz: 8f2d3f04058e00fbf6f7750c1075226d1dc690da
4
- data.tar.gz: 12fef04fefd54f1b02cc50e2b6b550505a6ba77c
3
+ metadata.gz: 4bcca68566fc3d3294b207bc015cfffceae3ad85
4
+ data.tar.gz: 8fedc687ee88d3d26438e582b176bbda41626fb9
5
5
  SHA512:
6
- metadata.gz: 9b3d81b4ea69781086396be8eb280ec15f34cba3b8108cf248c70787a3a897c5ff942651e01c4a2dca33eedd2b387749d06641eded86e79a6fa56baa33e0a1a1
7
- data.tar.gz: 8307a924a109fb7ac1385aeca403de4b73eb7be0da38e61ba6e820210eb17a28e14fc242fd0e2d3d954440727f477b3348e97df99f104e06e23a70e2188d9e90
6
+ metadata.gz: 9221e932944296881c3f642b5cb7b8fbf41542b0e9efbefb78402729280bc1e7840c65b82fe1e17084e78fb466f990d02aae2825eb0ca6906892342e79b9f537
7
+ data.tar.gz: 7a3e15e218fbcd4d1fc8a1bdfdc16d175a679ca37b5c4b8c84de9dd67c8ebef1a2e54c89b913e4586cd946963662a8fedeb17ee8c88e5473c2e76b78b9e112c5
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ rails_version = '~> 4.0.0'
4
+
5
+ gem 'activerecord', rails_version
6
+ gem 'actionpack', rails_version
@@ -1,9 +1,7 @@
1
- $:.push File.expand_path('../lib', __FILE__)
2
- require 'json_http_error'
3
1
 
4
2
  Gem::Specification.new do |s|
5
3
  s.name = 'json_http_error'
6
- s.version = JsonHttpError::VERSION.dup
4
+ s.version = '0.0.8'
7
5
  s.platform = Gem::Platform::RUBY
8
6
  s.licenses = ['MIT']
9
7
  s.summary = 'DRY module for APIs to render HTTP errors in JSON'
@@ -0,0 +1,6 @@
1
+ class JsonHttpError
2
+ class Railtie < Rails::Railtie
3
+ locales_path = File.expand_path('../../../locales', __FILE__)
4
+ config.i18n.load_path += Dir["#{locales_path}/*.{rb,yml}"]
5
+ end
6
+ end
@@ -1,6 +1,4 @@
1
1
  class JsonHttpError < StandardError
2
- VERSION = '0.0.2'.freeze
3
-
4
2
  attr_accessor :code, :opts
5
3
 
6
4
  def initialize(error_code, error_opts = {})
@@ -26,3 +24,5 @@ class JsonHttpError < StandardError
26
24
  end
27
25
  end
28
26
  end
27
+
28
+ require 'json_http_error/railtie' if defined?(Rails)
data/locales/en.yml ADDED
@@ -0,0 +1,46 @@
1
+ en:
2
+ http_status:
3
+ # Source: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error
4
+ '400': Bad Request
5
+ '401': Unauthorized
6
+ '402': Payment Required
7
+ '403': Forbidden
8
+ '404': Not Found
9
+ '405': Method Not Allowed
10
+ '406': Not Acceptable
11
+ '407': Proxy Authentication Required
12
+ '408': Request Timeout
13
+ '409': Conflict
14
+ '410': Gone
15
+ '411': Length Required
16
+ '412': Precondition Failed
17
+ '413': Request Entity Too Large
18
+ '414': Request-URI Too Long
19
+ '415': Unsupported Media Type
20
+ '416': Requested Range Not Satisfiable
21
+ '417': Expectation Failed
22
+ '418': I'm a teapot
23
+ '419': Authentication Timeout
24
+ '420': Method Failure
25
+ '420': Enhance Your Calm
26
+ '421': Misdirected Request
27
+ '422': Unprocessable Entity
28
+ '423': Locked
29
+ '424': Failed Dependency
30
+ '426': Upgrade Required
31
+ '428': Precondition Required
32
+ '429': Too Many Requests
33
+ '431': Request Header Fields Too Large
34
+ '440': Login Timeout
35
+ '444': No Response
36
+ '449': Retry With
37
+ '450': Blocked by Windows Parental Controls
38
+ '451': Unavailable For Legal Reasons
39
+ '451': Redirect
40
+ '494': Request Header Too Large
41
+ '495': Cert Error
42
+ '496': No Cert
43
+ '497': HTTP to HTTPS
44
+ '498': Token expired/invalid
45
+ '499': Client Closed Request
46
+ '499': Token required
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_http_error
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud 'red' Rouyer
@@ -17,11 +17,13 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - ".gitignore"
20
+ - Gemfile
20
21
  - LICENSE
21
22
  - README.md
22
- - config/locales/en.yml
23
23
  - json_http_error.gemspec
24
24
  - lib/json_http_error.rb
25
+ - lib/json_http_error/railtie.rb
26
+ - locales/en.yml
25
27
  homepage: https://github.com/savemysmartphone/json_http_error
26
28
  licenses:
27
29
  - MIT
@@ -1,46 +0,0 @@
1
- en:
2
- http_status:
3
- # Source: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error
4
- 400: Bad Request
5
- 401: Unauthorized
6
- 402: Payment Required
7
- 403: Forbidden
8
- 404: Not Found
9
- 405: Method Not Allowed
10
- 406: Not Acceptable
11
- 407: Proxy Authentication Required
12
- 408: Request Timeout
13
- 409: Conflict
14
- 410: Gone
15
- 411: Length Required
16
- 412: Precondition Failed
17
- 413: Request Entity Too Large
18
- 414: Request-URI Too Long
19
- 415: Unsupported Media Type
20
- 416: Requested Range Not Satisfiable
21
- 417: Expectation Failed
22
- 418: I'm a teapot
23
- 419: Authentication Timeout
24
- 420: Method Failure
25
- 420: Enhance Your Calm
26
- 421: Misdirected Request
27
- 422: Unprocessable Entity
28
- 423: Locked
29
- 424: Failed Dependency
30
- 426: Upgrade Required
31
- 428: Precondition Required
32
- 429: Too Many Requests
33
- 431: Request Header Fields Too Large
34
- 440: Login Timeout
35
- 444: No Response
36
- 449: Retry With
37
- 450: Blocked by Windows Parental Controls
38
- 451: Unavailable For Legal Reasons
39
- 451: Redirect
40
- 494: Request Header Too Large
41
- 495: Cert Error
42
- 496: No Cert
43
- 497: HTTP to HTTPS
44
- 498: Token expired/invalid
45
- 499: Client Closed Request
46
- 499: Token required