Sha256: 3fd0f5cc231b04ff3ccddb21512ef84b102fcbcb0ff784433e45c95ae72f02ad

Contents?: true

Size: 427 Bytes

Versions: 15

Compression:

Stored size: 427 Bytes

Contents

require 'rest_client'

module CobotClient
  module Exceptions
    EXCEPTIONS_MAP = {}
  end

  class Exception < RestClient::Exception
  end

  RestClient::STATUSES.each_pair do |code, message|
    superclass = RestClient::Exceptions::EXCEPTIONS_MAP.fetch code
    klass = Class.new(superclass)
    klass_constant = const_set message.delete(' \-\''), klass
    Exceptions::EXCEPTIONS_MAP[superclass] = klass_constant
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cobot_client-5.0.0 lib/cobot_client/exceptions.rb
cobot_client-4.0.0 lib/cobot_client/exceptions.rb
cobot_client-3.1.0 lib/cobot_client/exceptions.rb
cobot_client-3.0.0 lib/cobot_client/exceptions.rb
cobot_client-2.1.0 lib/cobot_client/exceptions.rb
cobot_client-2.0.0 lib/cobot_client/exceptions.rb
cobot_client-1.4.2 lib/cobot_client/exceptions.rb
cobot_client-1.4.0 lib/cobot_client/exceptions.rb
cobot_client-1.3.1 lib/cobot_client/exceptions.rb
cobot_client-1.3.0 lib/cobot_client/exceptions.rb
cobot_client-1.2.4 lib/cobot_client/exceptions.rb
cobot_client-1.2.3 lib/cobot_client/exceptions.rb
cobot_client-1.2.2 lib/cobot_client/exceptions.rb
cobot_client-1.2.1 lib/cobot_client/exceptions.rb
cobot_client-1.2.0 lib/cobot_client/exceptions.rb