Module: BatchApi

Defined in:
lib/batch_api.rb,
lib/batch_api/utils.rb,
lib/batch_api/version.rb,
lib/batch_api/response.rb,
lib/batch_api/processor.rb,
lib/batch_api/batch_error.rb,
lib/batch_api/configuration.rb,
lib/batch_api/error_wrapper.rb,
lib/batch_api/operation/rack.rb,
lib/batch_api/operation/rails.rb,
lib/batch_api/rack_middleware.rb,
lib/batch_api/processor/executor.rb,
lib/batch_api/internal_middleware.rb,
lib/batch_api/processor/sequential.rb,
lib/batch_api/internal_middleware/response_filter.rb,
lib/batch_api/internal_middleware/decode_json_body.rb

Defined Under Namespace

Modules: Errors, InternalMiddleware, Operation, Utils Classes: Configuration, ErrorWrapper, Processor, RackMiddleware, Response

Constant Summary collapse

VERSION =
"0.3.2"
CONFIGURATION_OPTIONS =

Public: configuration options. Currently, you can set:

  • endpoint: (URL) through which the Batch API will be exposed (default

“/batch)

  • verb: through which it’s accessed (default “POST”)

  • limit: how many requests can be processed in a single request

(default 50)

There are also two middleware-related options – check out middleware.rb for more information.

  • global_middleware: any middlewares to use round the entire batch request

(such as authentication, etc.)

  • per_op_middleware: any middlewares to run around each individual request

(adding headers, decoding JSON, etc.)

{
  verb: :post,
  endpoint: "/batch",
  limit: 50,
  batch_middleware: InternalMiddleware::DEFAULT_BATCH_MIDDLEWARE,
  operation_middleware: InternalMiddleware::DEFAULT_OPERATION_MIDDLEWARE
}

Class Method Summary collapse

Class Method Details

.configObject

Public: access the main Batch API configuration object.

Returns a BatchApi::Configuration instance



17
18
19
# File 'lib/batch_api.rb', line 17

def self.config
  @config ||= Configuration.new
end

.rails?Boolean

Public: are we in Rails? This partly exists just so that you can stub it in the tests.

Returns true if Rails is a defined constant, false otherwise.

Returns:

  • (Boolean)


25
26
27
# File 'lib/batch_api.rb', line 25

def self.rails?
  defined?(Rails)
end