Module: RestEasy

Defined in:
lib/rest_easy.rb,
lib/rest_easy/auth.rb,
lib/rest_easy/meta.rb,
lib/rest_easy/version.rb,
lib/rest_easy/auth/psk.rb,
lib/rest_easy/resource.rb,
lib/rest_easy/settings.rb,
lib/rest_easy/attribute.rb,
lib/rest_easy/auth/null.rb,
lib/rest_easy/auth/basic.rb,
lib/rest_easy/conventions.rb,
lib/rest_easy/refinements.rb

Defined Under Namespace

Modules: Auth, ClassMethods, Conventions, Refinements, Types Classes: Attribute, AttributeError, AuthenticationError, ConstraintError, Error, Meta, MissingAttributeError, RateLimitError, RemoteServerError, RequestError, Resource, Settings

Constant Summary collapse

TYPE_BRIDGE =

── Type bridge ─────────────────────────────────────────────────────Make bare Ruby types work with Dry::Types features like ‘constrained` inside Class.new blocks where constant lookup uses lexical scope.

{
  ::String  => Types::Coercible::String,
  ::Integer => Types::Coercible::Integer,
  ::Float   => Types::Coercible::Float
}.freeze
CHECK_ANCESTORS =

── Module setup ─────────────────────────────────────────────────────

false
VERSION =
"1.1.0"

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/rest_easy.rb', line 188

def extended(base)
  super

  # Guard against double registration and constant collisions
  if base.const_defined?(:ExtendedByRestEasy, CHECK_ANCESTORS)
    raise Error, "Double registration of #{base}."
  end

  if base.const_defined?(:Settings, CHECK_ANCESTORS)
    raise Error, "#{base} already defines Settings. RestEasy needs this constant."
  end

  # Clone settings so each API module gets its own config state.
  settings = Class.new(Settings)

  base.const_set(:Settings, settings)
  base.const_set(:ExtendedByRestEasy, true)
  base.extend ClassMethods
end