Module: NContent::SDK

Extended by:
ActiveSupport::Autoload
Defined in:
lib/ncontent-sdk.rb,
lib/ncontent/sdk/config.rb,
lib/ncontent-sdk-testing.rb,
lib/ncontent/sdk/railtie.rb,
lib/ncontent/sdk/storage.rb,
lib/ncontent/sdk/rest_client.rb,
lib/ncontent/sdk/testing/server_mock.rb,
lib/ncontent/sdk/faraday_middleware/response_parser.rb,
lib/ncontent/sdk/faraday_middleware/rest_api_call_benchmark.rb,
lib/ncontent/sdk/faraday_middleware/required_response_format.rb,
lib/ncontent/sdk/faraday_middleware/request_body_on_environment.rb

Defined Under Namespace

Modules: FaradayMiddleware, Testing Classes: Config, RESTClient, Railtie, Storage

Class Method Summary collapse

Class Method Details

.cacheObject



45
46
47
# File 'lib/ncontent-sdk.rb', line 45

def self.cache
  @@cache ||= ActiveSupport::Cache.lookup_store *config.cache
end

.configObject



15
16
17
# File 'lib/ncontent-sdk.rb', line 15

def self.config
  @@config ||= NContent::SDK::Config.new
end

.configure(config_hash = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ncontent-sdk.rb', line 19

def self.configure(config_hash = {})
  if block_given?
    yield config
  else
    config_hash.each do |config_key, config_value|
      if config.respond_to? "#{config_key}="
        config.public_send "#{config_key}=", config_value
      end
    end
  end
end

.loggerObject



32
33
34
# File 'lib/ncontent-sdk.rb', line 32

def self.logger
  @@logger ||= Logger.new($stdout)
end

.root_directoryObject



40
41
42
# File 'lib/ncontent-sdk.rb', line 40

def self.root_directory
  @@root_directory ||= storage.directories.get(config.bucket_name)
end

.storageObject



36
37
38
# File 'lib/ncontent-sdk.rb', line 36

def self.storage
  @@storage ||= ::NContent::SDK::Storage.new
end