Module: ApiClient

Defined in:
lib/api-client.rb,
lib/api-client/base.rb,
lib/api-client/version.rb,
lib/api-client/class_methods.rb,
lib/api-client/configuration.rb,
lib/api-client/instance_methods.rb

Overview

High Level Namespace of the library ApiClient.

Defined Under Namespace

Modules: ClassMethods, Dispatcher, Exceptions, InstanceMethods, Parser Classes: Base, Collection, Configuration, Errors

Constant Summary collapse

VERSION =

Version of the library.

'3.1.0'

Class Method Summary collapse

Class Method Details

.configHash

Global settings for ApiClient

Returns:

  • (Hash)

    configuration attributes


29
30
31
# File 'lib/api-client.rb', line 29

def self.config
  @config
end

.configure {|block| ... } ⇒ Object

Configures global settings

ApiClient.configure do |config|
  config.path = "api.example.com"
end

Yields:

  • Yield the configuration object

Yield Parameters:

  • block

    The Configuration object

Yield Returns:


22
23
24
# File 'lib/api-client.rb', line 22

def self.configure(&block)
  yield @config ||= ApiClient::Configuration.new
end

.parallel {|block| ... } ⇒ False

Parallel api requisitions

Yields:

  • The requisitions to be made

Yield Parameters:

  • block

    A block with requisition objects

Returns:

  • (False)

    the value of the hydra config

Raises:


38
39
40
41
42
43
44
# File 'lib/api-client.rb', line 38

def self.parallel(&block)
  raise Exceptions::NotPossible unless defined?(::Typhoeus)
  config.hydra = ::Typhoeus::Hydra.new
  yield
  config.hydra.run
  config.hydra = false
end