Sha256: 606b3493eec6e80c2d6daf806f8ffdee2e05babc4b8e4d62e6f2165456e2f40e

Contents?: true

Size: 944 Bytes

Versions: 324

Compression:

Stored size: 944 Bytes

Contents

=begin
#UltraCart Rest API V2

#UltraCart REST API Version 2

OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.15-SNAPSHOT

=end

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

324 entries across 324 versions & 1 rubygems

Version Path
ultracart_api-3.1.0 lib/ultracart_api/api_error.rb
ultracart_api-3.0.76 lib/ultracart_api/api_error.rb
ultracart_api-3.0.75 lib/ultracart_api/api_error.rb
ultracart_api-3.0.74 lib/ultracart_api/api_error.rb