Module: Dyndrop

Defined in:
lib/dyndrop/version.rb,
lib/dyndrop/client.rb,
lib/dyndrop/errors.rb,
lib/dyndrop/validator.rb,
lib/dyndrop/auth_token.rb,
lib/dyndrop/baseclient.rb,
lib/dyndrop/rest_client.rb,
lib/dyndrop/trace_helpers.rb

Overview

:nodoc:

Defined Under Namespace

Modules: TraceHelpers, V1, Validator Classes: APIError, AuthToken, BadResponse, BaseClient, Client, Denied, Deprecated, Error, InvalidTarget, Mismatch, NotFound, RestClient, TargetRefused, Timeout, UAAError

Constant Summary collapse

VERSION =

Dyndrop library version number.

"0.0.2".freeze

Class Method Summary collapse

Class Method Details

.define_error(class_name, code) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/dyndrop/errors.rb', line 130

def self.define_error(class_name, code)
  base =
    case class_name
    when /NotFound$/
      NotFound
    else
      APIError
    end

  klass =
    if const_defined?(class_name)
      const_get(class_name)
    else
      Class.new(base)
    end

  APIError.error_classes[code] = klass

  unless const_defined?(class_name)
    const_set(class_name, klass)
  end
end