Sha256: 8840839912bc2e5be89605dcbf53196bdb7128db41c6ec2affa9983887bbb92c
Contents?: true
Size: 505 Bytes
Versions: 2
Compression:
Stored size: 505 Bytes
Contents
module Dirigible # @private module Utils def self.handle_api_error(response) error = case response.status when 400 then BadRequest.new when 401 then Unauthorized.new when 404 then NotFound.new when 405 then MethodNotAllowed.new when 406 then NotAcceptable.new else Error.new end error.error = parse_json(response.body) raise error end def self.parse_json(json) MultiJson.load(json, symbolize_keys: true) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dirigible-0.0.2 | lib/dirigible/utils.rb |
dirigible-0.0.1 | lib/dirigible/utils.rb |