Module: CopyTunerClient

Defined in:
lib/copy_tuner_client.rb,
lib/copy_tuner_client/cache.rb,
lib/copy_tuner_client/rails.rb,
lib/copy_tuner_client/client.rb,
lib/copy_tuner_client/engine.rb,
lib/copy_tuner_client/errors.rb,
lib/copy_tuner_client/poller.rb,
lib/copy_tuner_client/copyray.rb,
lib/copy_tuner_client/version.rb,
lib/copy_tuner_client/dotted_hash.rb,
lib/copy_tuner_client/i18n_backend.rb,
lib/copy_tuner_client/request_sync.rb,
lib/copy_tuner_client/configuration.rb,
lib/copy_tuner_client/process_guard.rb,
lib/copy_tuner_client/prefixed_logger.rb,
lib/copy_tuner_client/translation_log.rb,
lib/copy_tuner_client/copyray_middleware.rb,
lib/copy_tuner_client/queue_with_timeout.rb

Overview

cf) xray-rails : xray/middleware.rb

Defined Under Namespace

Modules: DottedHash, Rails Classes: Cache, Client, Configuration, ConnectionError, Copyray, CopyrayMiddleware, Engine, I18nBackend, InvalidApiKey, Poller, PrefixedLogger, ProcessGuard, QueueWithTimeout, RequestSync, TranslationLog

Constant Summary collapse

VERSION =

Client version

'0.5.2'.freeze
API_VERSION =

API version being used to communicate with the server

'2.0'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationConfiguration

Must act like a hash and return sensible values for all CopyTuner configuration options. Usually set when configure is called.

Returns:



14
15
16
# File 'lib/copy_tuner_client.rb', line 14

def configuration
  @configuration
end

Class Method Details

.cacheObject



34
35
36
# File 'lib/copy_tuner_client.rb', line 34

def self.cache
  CopyTunerClient.configuration.cache
end

.clientObject



38
39
40
# File 'lib/copy_tuner_client.rb', line 38

def self.client
  CopyTunerClient.configuration.client
end

.configure(apply = true) {|Configuration| ... } ⇒ Object

Call this method to modify defaults in your initializers.

Examples:

CopyTunerClient.configure do |config|
  config.api_key = '1234567890abcdef'
  config.host = 'your-copy-tuner-server.herokuapp.com'
  config.secure = true
end

Parameters:

  • apply (Boolean) (defaults to: true)

    (internal) whether the configuration should be applied yet.

Yields:



58
59
60
61
62
63
64
65
# File 'lib/copy_tuner_client.rb', line 58

def self.configure(apply = true)
  self.configuration ||= Configuration.new
  yield configuration

  if apply
    configuration.apply
  end
end

.deployObject

Issues a new deploy, marking all draft blurbs as published. This is called when the copy_tuner:deploy rake task is invoked.



19
20
21
# File 'lib/copy_tuner_client.rb', line 19

def self.deploy
  client.deploy
end

.exportObject

Issues a new export, returning yaml representation of blurb cache. This is called when the copy_tuner:export rake task is invoked.



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

def self.export
  cache.export
end

.flushObject

Flush queued changed synchronously



30
31
32
# File 'lib/copy_tuner_client.rb', line 30

def self.flush
  cache.flush
end

.pollerObject



42
43
44
# File 'lib/copy_tuner_client.rb', line 42

def self.poller
  CopyTunerClient.configuration.poller
end