Sha256: add6ee0c617860b7ed0004282ce3db87a0a3a182a511d829c21b6f63b22beb47

Contents?: true

Size: 890 Bytes

Versions: 5

Compression:

Stored size: 890 Bytes

Contents

=begin
#Cloudsmith API

#The API to the Cloudsmith Service

OpenAPI spec version: v1
Contact: support@cloudsmith.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.26

=end

module CloudsmithApi
  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 & 1 rubygems

Version Path
cloudsmith-api-1.142.3 lib/cloudsmith-api/api_error.rb
cloudsmith-api-1.120.3 lib/cloudsmith-api/api_error.rb
cloudsmith-api-1.61.3 lib/cloudsmith-api/api_error.rb
cloudsmith-api-1.42.3 lib/cloudsmith-api/api_error.rb
cloudsmith-api-1.33.7 lib/cloudsmith-api/api_error.rb