Bump version 1.3.1

Change-Id: Id4c79892bdc0d0bc73b6d07496ed4b58f18d51cf
Reviewed-on: http://review.couchbase.org/26758
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Fix JSON monkey patch for StringIO-like objects

Reads all objects with a StringIO-like interface,
not only StringIO itself. One use-case being
Unicorn::TeeInput, but others may exist.

Change-Id: I9dee666d7d1161853b933cfa164d5edf671c6fe8
Reviewed-on: http://review.couchbase.org/26760
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Protect library from connection_pool for 1.8.7+ rubies

It work well without ConnectionPool there, because ruby 1.8 uses green
threads and doesn't need to be synchronized

Change-Id: I5803cf6438eeaf7b3ac5c484debedf335b7d48f3
Reviewed-on: http://review.couchbase.org/26883
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Update minitest to avoid warnings

"MiniTest::Unit::TestCase is now Minitest::Test."

Change-Id: Ib78b7b0b41581e1195083c1e8ca54bda46352eca
Reviewed-on: http://review.couchbase.org/26885
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Fix "Can't modify frozen string" error

Change-Id: I7eb2b66ed08bde3fc703358a86e578ff115db54a
Reviewed-on: http://review.couchbase.org/26979
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
RCBC-133 Allow to specify strategy of selecting replica nodes.

This version require libcouchbase >= 2.0.7

Now three strategies available:

* `:first` - synonym to `true`, previous behaviour and currently
  default. It means that the library will sequentially iterate
  over all replicas and will return as soon as find successful
  response, or report error from the latest.

        c.get("foo", :replica => true)
        c.get("foo", :replica => :first)
        #=> "bar"
        c.get("foo", :replica => :first, :extended => true)
        #=> ["bar", 0, 11218368683493556224]

* `:all` - query all replicas in parallel. In this case the method
  will return array of the values on the all replica nodes without
  particular order. Also if the key isn't on the node, it will be
  skipped in the result array.

        c.get("foo", :replica => :all)
        #=> ["bar", "bar", "bar"]
        c.get("foo", :replica => :all, :extended => true)
        #=> [["bar", 0, 11218368683493556224],
        #    ["bar", 0, 11218368683493556224],
        #    ["bar", 0, 11218368683493556224]]

* `Fixnum` - you can also select specific replica node by its
  index in the cluster configuration. It should be in interval
  `0...c.num_replicas`

        0...c.num_replicas
        #=> 0...3
        c.get("foo", :replica => 1)
        #=> "bar"
        c.get("foo", :replica => 42)
        #=> ArgumentError: replica index should be in interval 0...3

Change-Id: I8e9ba48eaff8debe590dc58bc6cb3cc03ff7dcbc
Reviewed-on: http://review.couchbase.org/27343
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Fix minor phrasing issues in replica read docblock.

Change-Id: Ia9d515326758e9ea46ccf2bfa95375f2b434d1e1
Reviewed-on: http://review.couchbase.org/27351
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Bump version 1.3.2

Change-Id: I1f6be0827157e9c93d3745f32d1842ac80b28981
Reviewed-on: http://review.couchbase.org/27353
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Remove usage of RARRAY_PTR in favor of rb_ary_entry

This improves performance significantly on Rubinius and also improves
compatibility with future CRuby 2.1 which introduces generational
garbage collection.

This results in these arrays not having to be rescanned in Rubinius and
not marked as shady in RBGCENC in CRuby 2.1. It is a good practice to
not use internal data structures here and also I've never seen this
change affect any real world performance out there.

For more discussion, also see:

https://bugs.ruby-lang.org/issues/8399

Pull-Request: https://github.com/couchbase/couchbase-ruby-client/pull/14
Change-Id: I1dde798acedc96df67464f79ea775671b92f25e9
Reviewed-on: http://review.couchbase.org/27483
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Update list of libcouchbase exceptions

Change-Id: I44d1c42be3922d74fdd4971473bdddaffc847d78
Reviewed-on: http://review.couchbase.org/27637
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Use cb_bucket_disconnect() to avoid duplication

Change-Id: I0524181c80b93cbfcf00b30d917cbba5bf8213fd
Reviewed-on: http://review.couchbase.org/27638
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Force handle to be NULL on lcb_create() failure

lcb_create() can leave garbage in the pointer even if the call itself
was failed. This behaviour could lead to illegal memory access on GC

Change-Id: Iab23068fe22df4931a31d78b274d1a7782f1950c
Related-To: http://review.couchbase.org/27636
Reviewed-on: http://review.couchbase.org/27639
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Do not try to compile with plugins for Windows platform

Change-Id: Ibf6f7f598b1a646e222f325fdb42e4b500daa121
Reviewed-on: http://review.couchbase.org/27640
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Allow to use several connections with thread-local singleton

Change-Id: Iab694b8ba9df2655297fc7e3fc8b2502d139db67