Sha256: b08ecbd750eb5f16b1cb1ac97fa5ae671a32475367cdeda603d5d836035ab00f

Contents?: true

Size: 995 Bytes

Versions: 8

Compression:

Stored size: 995 Bytes

Contents

=begin
# Mux Ruby - Copyright 2019 Mux Inc.
# NOTE: This file is auto generated. Do not edit this file manually.
=end

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

  class NotFoundError < ApiError
  end

  class UnauthorizedError < ApiError
  end

  class ForbiddenError < ApiError
  end

  class ServiceError < ApiError
  end

  class TooManyRequestsError < ApiError
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mux_ruby-1.9.0 lib/mux_ruby/api_error.rb
mux_ruby-1.8.1 lib/mux_ruby/api_error.rb
mux_ruby-1.7.0 lib/mux_ruby/api_error.rb
mux_ruby-1.6.0 lib/mux_ruby/api_error.rb
mux_ruby-1.5.1 lib/mux_ruby/api_error.rb
mux_ruby-1.5.0 lib/mux_ruby/api_error.rb
mux_ruby-1.4.0 lib/mux_ruby/api_error.rb
mux_ruby-1.3.1 lib/mux_ruby/api_error.rb