Sha256: 7942f9de446825974e0921c313c1105dd6b291f9c4d32174ac75c4a26cd9b767

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

=begin
#Tripletex API



OpenAPI spec version: 2.69.5

Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.24

=end

module TripletexRubyClient
  class ApiError < StandardError
    attr_reader :code, :response_headers, :response_body

    # Usage examples:
    #   ApiError.new
    #   ApiError.new("message")
    #   ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
    #   ApiError.new(:code => 404, :message => "Not Found")
    def initialize(arg = nil)
      if arg.is_a? Hash
        if arg.key?(:message) || arg.key?('message')
          super(arg[:message] || arg['message'])
        else
          super arg
        end

        arg.each do |k, v|
          instance_variable_set "@#{k}", v
        end
      else
        super arg
      end
    end

    def to_s
      #Need to see the result in the output!
      self.instance_variables.reduce({}) do |h, attribute|
        h[attribute]= self.instance_variable_get(attribute)
        h
      end.to_s
    end
  end

  class ClientError < ApiError
  end

  class ServerError < ApiError
  end

  class RateLimitExceededError < ClientError
  end

  class UnauthorizedError < ClientError
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tripletex_ruby_client-1.0.12 lib/tripletex_ruby_client/api_error.rb