Module: Blanket
- Defined in:
- lib/blanket.rb,
lib/blanket/utils.rb,
lib/blanket/version.rb,
lib/blanket/wrapper.rb,
lib/blanket/response.rb,
lib/blanket/exception.rb
Overview
The main Blanket module
Defined Under Namespace
Modules: Exceptions Classes: Exception, Response, Wrapper
Constant Summary collapse
- VERSION =
Current gem version
"3.0.2"
- STATUSES =
A Map of “error” HTTP status codes and their names
{ 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Resource Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long', 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m A Teapot', #RFC2324 421 => 'Too Many Connections From This IP', 422 => 'Unprocessable Entity', #WebDAV 423 => 'Locked', #WebDAV 424 => 'Failed Dependency', #WebDAV 425 => 'Unordered Collection', #WebDAV 426 => 'Upgrade Required', 428 => 'Precondition Required', #RFC6585 429 => 'Too Many Requests', #RFC6585 431 => 'Request Header Fields Too Large', #RFC6585 449 => 'Retry With', #Microsoft 450 => 'Blocked By Windows Parental Controls', #Microsoft 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', #WebDAV 509 => 'Bandwidth Limit Exceeded', #Apache 510 => 'Not Extended', 511 => 'Network Authentication Required', # RFC6585 }
Class Method Summary collapse
- .stringify_keys(hash) ⇒ Object
-
.wrap(*args) ⇒ Object
Wraps an API using Blanket::Wrapper.
Class Method Details
.stringify_keys(hash) ⇒ Object
2 3 4 |
# File 'lib/blanket/utils.rb', line 2 def self.stringify_keys(hash) hash.inject({}) {|memo,(k,v)| memo[k.to_s] = v; memo} end |