Sha256: f4707bc5eacc53562d86e16454cb728d4447ffab59a229133cb3b80c5c1edbce
Contents?: true
Size: 796 Bytes
Versions: 3
Compression:
Stored size: 796 Bytes
Contents
module Sendle module Api module Factories class Errors def self.new_error(rest_client_error) response = JSON.parse(rest_client_error.response) error_text = response['error_description'] messages = response['messages'] case rest_client_error when RestClient::Unauthorized Sendle::Api::Errors::Unauthorized.new(error_text) when RestClient::PaymentRequired Sendle::Api::Errors::PaymentRequired.new(error_text) when RestClient::UnprocessableEntity Sendle::Api::Errors::UnprocessableEntity.new(messages) when RestClient::PreconditionFailed Sendle::Api::Errors::PreconditionFailed.new(error_text) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sendle-api-0.0.13 | lib/sendle/api/factories/errors.rb |
sendle-api-0.0.12 | lib/sendle/api/factories/errors.rb |
sendle-api-0.0.11 | lib/sendle/api/factories/errors.rb |