Class: IronCache::Client
- Inherits:
-
IronCore::Client
- Object
- IronCore::Client
- IronCache::Client
- Defined in:
- lib/iron_cache/client.rb
Constant Summary collapse
- AWS_US_EAST_HOST =
"cache-aws-us-east-1.iron.io"
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #base_url ⇒ Object
- #cache(name) ⇒ Object
- #caches ⇒ Object
- #headers ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #items ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/iron_cache/client.rb', line 14 def initialize(={}) = { :scheme => 'https', :host => IronCache::Client::AWS_US_EAST_HOST, :port => 443, :api_version => 1, :user_agent => 'iron_cache_ruby-' + IronCache::VERSION + ' (iron_core_ruby-' + IronCore.version + ')', :cache_name => 'default' } super('iron', 'cache', , , [:project_id, :token, :api_version, :cache_name]) IronCore::Logger.error 'IronCache', "Token is not set", IronCore::Error if @token.nil? check_id(@project_id, 'project_id') @logger = Logger.new(STDOUT) @logger.level = Logger::INFO end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'lib/iron_cache/client.rb', line 12 def logger @logger end |
Instance Method Details
#base_url ⇒ Object
38 39 40 |
# File 'lib/iron_cache/client.rb', line 38 def base_url super + @api_version.to_s + '/' end |
#cache(name) ⇒ Object
46 47 48 |
# File 'lib/iron_cache/client.rb', line 46 def cache(name) return Cache.new(self, {"name"=>name}) end |
#caches ⇒ Object
50 51 52 |
# File 'lib/iron_cache/client.rb', line 50 def caches return Caches.new(self) end |
#headers ⇒ Object
34 35 36 |
# File 'lib/iron_cache/client.rb', line 34 def headers super.merge({'Authorization' => "OAuth #{@token}"}) end |