Module: RestCore

Included in:
Builder, Client, ClientOauth1, Middleware, Payload, Promise, Wrapper
Defined in:
lib/rest-core.rb,
lib/rest-core/error.rb,
lib/rest-core/event.rb,
lib/rest-core/version.rb,
lib/rest-core/util/json.rb,
lib/rest-core/util/hmac.rb,
lib/rest-core/util/payload.rb,
lib/rest-core/util/parse_query.rb,
lib/rest-core/client/universal.rb,
lib/rest-core/middleware/bypass.rb

Defined Under Namespace

Modules: Client, ClientOauth1, Hmac, Json, Middleware, ParseQuery, Wrapper Classes: AuthBasic, Auto, Builder, Bypass, Cache, CommonLogger, DefaultHeaders, DefaultPayload, DefaultQuery, DefaultSite, Defaults, Dry, EmHttpRequest, Error, ErrorDetector, ErrorDetectorHttp, ErrorHandler, Event, EventStruct, FollowRedirect, JsonRequest, JsonResponse, Oauth1Header, Oauth2Header, Oauth2Query, Payload, Promise, RestClient, Timeout

Constant Summary

REQUEST_METHOD =
'REQUEST_METHOD'
REQUEST_PATH =
'REQUEST_PATH'
REQUEST_QUERY =
'REQUEST_QUERY'
REQUEST_PAYLOAD =
'REQUEST_PAYLOAD'
REQUEST_HEADERS =
'REQUEST_HEADERS'
RESPONSE_BODY =
'RESPONSE_BODY'
RESPONSE_STATUS =
'RESPONSE_STATUS'
RESPONSE_HEADERS =
'RESPONSE_HEADERS'
DRY =
'core.dry'
FAIL =
'core.fail'
LOG =
'core.log'
ASYNC =
'async.callback'
TIMER =
'async.timer'
PROMISE =
'async.promise'
RootFiber =
Fiber.respond_to?(:current) && Fiber.current
VERSION =
'2.1.2'
Universal =
Builder.client do
  use Timeout       , 0

  use DefaultSite   , nil
  use DefaultHeaders, {}
  use DefaultQuery  , {}
  use DefaultPayload, {}
  use JsonRequest   , false
  use AuthBasic     , nil, nil

  use FollowRedirect, 10
  use CommonLogger  , method(:puts)
  use Cache         ,  {}, 600 do
    use ErrorHandler, nil
    use ErrorDetectorHttp
    use JsonResponse, false
  end
end

Class Method Summary (collapse)

Class Method Details

+ (Object) eagerload(const = self, loaded = {})

You might want to call this before launching your application in a threaded environment to avoid thread-safety issue in autoload.



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/rest-core.rb', line 74

def self.eagerload const=self, loaded={}
  return if loaded[const.name]
  loaded[const.name] = true
  const.constants(false).each{ |n|
    begin
      c = const.const_get(n)
    rescue LoadError, NameError => e
      warn "RestCore: WARN: #{e} for #{const}\n" \
           "  from #{e.backtrace.grep(/top.+required/).first}"
    end
    eagerload(c, loaded) if c.respond_to?(:constants) && !loaded[n]
  }
end