Sha256: ec018844f95185ef691bc8bb975b035ff29fbd1aef9b8570f60e5542f1650241

Contents?: true

Size: 926 Bytes

Versions: 5

Compression:

Stored size: 926 Bytes

Contents

=begin
#ApproveAPISwagger

#The simple API to request a user's approval on anything via email + sms.

OpenAPI spec version: 1.0.0
Contact: dev@approveapi.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.0.0-SNAPSHOT

=end

module ApproveAPISwagger
  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

5 entries across 5 versions & 2 rubygems

Version Path
approveapi-1.0.8 vendor/bundle/ruby/2.6.0/gems/approveapi_swagger-1.0.1/lib/approveapi_swagger/api_error.rb
approveapi_swagger-1.0.2 lib/approveapi_swagger/api_error.rb
approveapi-1.0.5 vendor/bundle/ruby/2.6.0/gems/approveapi_swagger-1.0.1/lib/approveapi_swagger/api_error.rb
approveapi_swagger-1.0.1 lib/approveapi_swagger/api_error.rb
approveapi_swagger-1.0.0 lib/approveapi_swagger/api_error.rb