lib/couchbase.rb in couchbase-0.9.8 vs lib/couchbase.rb in couchbase-1.0.0
- old
+ new
@@ -1,7 +1,7 @@
# Author:: Couchbase <info@couchbase.com>
-# Copyright:: 2011 Couchbase, Inc.
+# Copyright:: 2011, 2012 Couchbase, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -13,43 +13,33 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
+require 'couchbase/version'
+require 'yajl/json_gem'
+require 'couchbase_ext'
+require 'couchbase/bucket'
+
+# Couchbase ruby client
module Couchbase
- autoload :Bucket, 'couchbase/bucket'
- autoload :Couchdb, 'couchbase/couchdb'
- autoload :Document, 'couchbase/document'
- autoload :HttpStatus, 'couchbase/http_status'
- autoload :Latch, 'couchbase/latch'
- autoload :Memcached, 'couchbase/memcached'
- autoload :Node, 'couchbase/node'
- autoload :RestClient, 'couchbase/rest_client'
- autoload :VERSION, 'couchbase/version'
- autoload :View, 'couchbase/view'
- # This error is raising when library detects that some operation
- # doesn't implemented by the server. For example views API doesn't
- # implemented by Membase 1.7.x
- class NotImplemented < Exception; end
-
- class ViewError < Exception
- attr_reader :from, :reason
-
- def initialize(from, reason)
- @from = from
- @reason = reason
- super("#{from}: #{reason}")
- end
- end
-
class << self
# The method +new+ initializes new Bucket instance with all arguments passed.
#
- # === Examples
- # Couchbase.new("http://localhost:8091/pools/default") #=> establish connection with couchbase default pool and default bucket
- # Couchbase.new("http://localhost:8091/pools/default", :bucket_name => 'blog') #=> select custom bucket
- # Couchbase.new("http://localhost:8091/pools/default", :bucket_name => 'blog', :bucket_password => 'secret') #=> specify password for bucket (and SASL auth for memcached client)
+ # @example Use default values for all options
+ # Couchbase.new
+ #
+ # @example Establish connection with couchbase default pool and default bucket
+ # Couchbase.new("http://localhost:8091/pools/default")
+ #
+ # @example Select custom bucket
+ # Couchbase.new("http://localhost:8091/pools/default", :bucket => 'blog')
+ #
+ # @example Specify bucket credentials
+ # Couchbase.new("http://localhost:8091/pools/default", :bucket => 'blog', :username => 'bucket', :password => 'secret')
+ #
+ # @return [Bucket] connection instance
def new(*args)
Bucket.new(*args)
end
end