Sha256: 66b8169df0639ac4720409523838dcddedd7cd59283b090333fa08edb48c9c15

Contents?: true

Size: 685 Bytes

Versions: 2

Compression:

Stored size: 685 Bytes

Contents

module ManageIQ
  module API
    class Client
      class Error
        attr_reader :status
        attr_reader :kind
        attr_reader :message
        attr_reader :klass

        def initialize(status = 0, json_response = {})
          update(status, json_response)
        end

        def clear
          update(0)
        end

        def update(status, json_response = {})
          @status = status
          @kind, @message, @klass = nil
          error_hash = json_response["error"]
          if status >= 400 && error_hash.present?
            @kind, @message, @klass = error_hash.values_at("kind", "message", "klass")
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
manageiq-api-client-0.1.1 lib/manageiq/api/client/error.rb
manageiq-api-client-0.1.0 lib/manageiq/api/client/error.rb