Sha256: 9546f6c63c15fbae1353f21254e3774a0b23adc6c878d38658aae8802fbf73ec

Contents?: true

Size: 1.7 KB

Versions: 47

Compression:

Stored size: 1.7 KB

Contents

=begin
Copyright (c) 2019 Aspose Pty Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=end

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

47 entries across 47 versions & 1 rubygems

Version Path
aspose_slides_cloud-20.6.0 lib/aspose_slides_cloud/api_error.rb
aspose_slides_cloud-20.5.0 lib/aspose_slides_cloud/api_error.rb
aspose_slides_cloud-20.4.0 lib/aspose_slides_cloud/api_error.rb
aspose_slides_cloud-20.2.0 lib/aspose_slides_cloud/api_error.rb
aspose_slides_cloud-19.12.0 lib/aspose_slides_cloud/api_error.rb
aspose_slides_cloud-19.10.0 lib/aspose_slides_cloud/api_error.rb
aspose_slides_cloud-19.9.0 lib/aspose_slides_cloud/api_error.rb