Sha256: 765cd3df3a12f55ffc9a6102dae9a7937c9b1a16d075a0e2800b8180bd9be985
Contents?: true
Size: 1009 Bytes
Versions: 1
Compression:
Stored size: 1009 Bytes
Contents
module CurrencyCloud class ApiErrorMessage attr_reader :field, :code, :message, :params def initialize(field, error) @field = field @code = error['code'] @message = error['message'] @params = error['params'] end end class ApiError < StandardError attr_reader :code, :messages, :raw_response, :status_code def initialize(raw_response) @raw_response = raw_response @status_code = raw_response.code errors = raw_response.parsed_response @code = errors['error_code'] @messages = [] errors['error_messages'].each do |field, messages| messages.each do |message| @messages << ApiErrorMessage.new(field, message) end end end end class BadRequestError < ApiError; end class AuthenticationError < ApiError; end class ForbiddenError < ApiError; end class TooManyRequestsError < ApiError; end class InternalApplicationError < ApiError; end class NotFoundError < ApiError; end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
currency_cloud-0.5 | lib/currency_cloud/errors/api_error.rb |