Sha256: c72abbd3ff10bb671cdec5d0016b072cb4fe8831b7f6109ee26fb37348440c86

Contents?: true

Size: 922 Bytes

Versions: 7

Compression:

Stored size: 922 Bytes

Contents

=begin
#API V1

#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

OpenAPI spec version: v1

Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.0-SNAPSHOT

=end

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

7 entries across 7 versions & 1 rubygems

Version Path
form_api-0.2.0 lib/form_api/api_error.rb
form_api-0.1.5 lib/form_api/api_error.rb
form_api-0.1.4 lib/form_api/api_error.rb
form_api-0.1.3 lib/form_api/api_error.rb
form_api-0.1.2 lib/form_api/api_error.rb
form_api-0.1.1 lib/form_api/api_error.rb
form_api-0.1.0 lib/form_api/api_error.rb