Sha256: 6d5406409644755b849fd0f80fa843ea9a739fbcc53a58a172ab2ce35b1b3399

Contents?: true

Size: 875 Bytes

Versions: 4

Compression:

Stored size: 875 Bytes

Contents

=begin
#API v1

#DocSpring is a service that helps you fill out and sign PDF templates.

OpenAPI spec version: v1

Generated by: https://openapi-generator.tech
OpenAPI Generator version: 3.3.0-SNAPSHOT

=end

module DocSpring
  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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
docspring-1.2.1 lib/docspring/api_error.rb
docspring-1.2.0 lib/docspring/api_error.rb
docspring-1.1.0 lib/docspring/api_error.rb
docspring-1.0.0 lib/docspring/api_error.rb