couchrest 2.0.0.rc2 → 2.0.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/VERSION +1 -1
- data/couchrest.gemspec +2 -1
- data/examples/word_count/word_count_query.rb +2 -2
- data/history.txt +12 -1
- data/lib/couchrest/connection.rb +15 -4
- data/lib/couchrest/database.rb +15 -5
- data/spec/couchrest/connection_spec.rb +62 -2
- data/spec/couchrest/database_spec.rb +27 -17
- data/spec/couchrest/document_spec.rb +4 -4
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b17f1a8431dbf297df05649b3e3ef50da87ec5
|
4
|
+
data.tar.gz: d6c33fc6dfd9651d3cafb18d75a91a363542026f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c690201c7ca0cde422405fc26e1399e18d0b98c435cfb6ca37e38fb2dd194351f06188930ebe805fd7201fb5f089dbde9df1fea1f12913c8ecf0be8f602ef4c9
|
7
|
+
data.tar.gz: 0d012252eb5d4a89302d2f069d76b855763aba3e65d6a17dbfe6f78b2d129ff381211ed96d08250ae6bef6edea8224983a03245db5bf06b0851af8a777bb5d35
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.
|
1
|
+
2.0.0.rc3
|
data/couchrest.gemspec
CHANGED
@@ -27,11 +27,12 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.rubygems_version = %q{1.3.7}
|
28
28
|
s.summary = %q{Lean and RESTful interface to CouchDB.}
|
29
29
|
|
30
|
-
s.add_dependency("httpclient", ["~> 2.
|
30
|
+
s.add_dependency("httpclient", ["~> 2.7"])
|
31
31
|
s.add_dependency("mime-types", [">= 1.15"])
|
32
32
|
s.add_dependency("multi_json", ["~> 1.7"])
|
33
33
|
s.add_development_dependency("json", [">= 1.7.0"])
|
34
34
|
s.add_development_dependency("rspec", "~> 2.14.1")
|
35
35
|
s.add_development_dependency("rake")
|
36
36
|
s.add_development_dependency("webmock")
|
37
|
+
s.add_development_dependency("mime-types", "2.6.2") # Avoid Errors with 3.0 series
|
37
38
|
end
|
@@ -6,7 +6,7 @@ db = couch.database('word-count-example')
|
|
6
6
|
|
7
7
|
puts "Now that we've parsed all those books into CouchDB, the queries we can run are incredibly flexible."
|
8
8
|
puts "\nThe simplest query we can run is the total word count for all words in all documents:"
|
9
|
-
puts "this will take a few minutes the first time. if it times out, just rerun this script in a few
|
9
|
+
puts "this will take a few minutes the first time. if it times out, just rerun this script in a few minutes."
|
10
10
|
puts db.view('word_count/words').inspect
|
11
11
|
|
12
12
|
puts "\nWe can also narrow the query down to just one word, across all documents. Here is the count for 'flight' in all three books:"
|
@@ -37,4 +37,4 @@ puts params.inspect
|
|
37
37
|
puts
|
38
38
|
puts 'The url looks like this:'
|
39
39
|
puts 'http://127.0.0.1:5984/word-count-example/_view/word_count/count?key=["flight","da-vinci"]'
|
40
|
-
puts "\nTry dropping that in your browser..."
|
40
|
+
puts "\nTry dropping that in your browser..."
|
data/history.txt
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
== 2.0.0.
|
1
|
+
== 2.0.0.rc3
|
2
|
+
|
3
|
+
* Major Changes
|
4
|
+
* At the risk of causing chaos, `Database#get` now returns nil for 404 (@samlown)
|
5
|
+
|
6
|
+
* Minor changes
|
7
|
+
* Updating HTTPClient dependency to > 2.7 for Ruby 2.3 support. (@samlown)
|
8
|
+
* Added `:ssl_ca_file` configuration option (@joelnb)
|
9
|
+
* Return headers content for HEAD requests (@solenko)
|
10
|
+
* Changing to options hash for bulk_save (@samlown via @matthiasjakel)
|
11
|
+
|
12
|
+
== 2.0.0.rc2 - 2015-08-18
|
2
13
|
|
3
14
|
* Minor changes
|
4
15
|
* Forcing HTTP basic connections when user+pass provided to avoid 401 (@samlown via @cloudant)
|
data/lib/couchrest/connection.rb
CHANGED
@@ -25,7 +25,9 @@ module CouchRest
|
|
25
25
|
# * `:payload` override the document or data sent in the message body (only PUT or POST).
|
26
26
|
# * `:headers` any additional headers (overrides :content_type and :accept)
|
27
27
|
# * `:timeout` (or `:read_timeout`) and `:open_timeout` the time in miliseconds to wait for the request, see the [Net HTTP Persistent documentation](http://docs.seattlerb.org/net-http-persistent/Net/HTTP/Persistent.html#attribute-i-read_timeout) for more details.
|
28
|
-
#
|
28
|
+
# * `:verify_ssl` verify ssl certificates (or not)
|
29
|
+
# * `:ssl_client_cert`, `:ssl_client_key` parameters controlling ssl client certificate authentication
|
30
|
+
# * `:ssl_ca_file` load additional CA certificates from a file (or directory)
|
29
31
|
#
|
30
32
|
# When :raw is true in PUT and POST requests, no attempt will be made to convert the document payload to JSON. This is
|
31
33
|
# not normally necessary as IO and Tempfile objects will not be parsed anyway. The result of the request will
|
@@ -38,7 +40,7 @@ module CouchRest
|
|
38
40
|
|
39
41
|
HEADER_CONTENT_SYMBOL_MAP = {
|
40
42
|
:content_type => 'Content-Type',
|
41
|
-
:accept => 'Accept'
|
43
|
+
:accept => 'Accept'
|
42
44
|
}
|
43
45
|
|
44
46
|
DEFAULT_HEADERS = {
|
@@ -90,7 +92,7 @@ module CouchRest
|
|
90
92
|
|
91
93
|
# Send a HEAD request.
|
92
94
|
def head(path, options = {})
|
93
|
-
options = options.merge(:
|
95
|
+
options = options.merge(:head => true) # No parsing!
|
94
96
|
execute('HEAD', path, options)
|
95
97
|
end
|
96
98
|
|
@@ -122,6 +124,7 @@ module CouchRest
|
|
122
124
|
end
|
123
125
|
http.ssl_config.client_cert = opts[:ssl_client_cert] if opts.include?(:ssl_client_cert)
|
124
126
|
http.ssl_config.client_key = opts[:ssl_client_key] if opts.include?(:ssl_client_key)
|
127
|
+
http.ssl_config.set_trust_ca(opts[:ssl_ca_file]) if opts.include?(:ssl_ca_file)
|
125
128
|
|
126
129
|
# Timeout options
|
127
130
|
http.receive_timeout = opts[:timeout] if opts.include?(:timeout)
|
@@ -164,7 +167,7 @@ module CouchRest
|
|
164
167
|
else
|
165
168
|
response = send_request(req)
|
166
169
|
handle_response_code(response)
|
167
|
-
|
170
|
+
parse_response(response, options)
|
168
171
|
end
|
169
172
|
end
|
170
173
|
|
@@ -177,6 +180,14 @@ module CouchRest
|
|
177
180
|
raise_response_error(response) unless SUCCESS_RESPONSE_CODES.include?(response.status)
|
178
181
|
end
|
179
182
|
|
183
|
+
def parse_response(response, opts)
|
184
|
+
if opts[:head]
|
185
|
+
opts[:raw] ? response.http_header.dump : response.headers
|
186
|
+
else
|
187
|
+
parse_body(response.body, opts)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
180
191
|
def parse_body(body, opts)
|
181
192
|
if opts[:raw]
|
182
193
|
# passthru
|
data/lib/couchrest/database.rb
CHANGED
@@ -90,8 +90,9 @@ module CouchRest
|
|
90
90
|
|
91
91
|
# == Retrieving and saving single documents
|
92
92
|
|
93
|
-
# GET a document from CouchDB, by id. Returns a Document or
|
94
|
-
|
93
|
+
# GET a document from CouchDB, by id. Returns a Document, Design, or raises an exception
|
94
|
+
# if the document does not exist.
|
95
|
+
def get!(id, params = {})
|
95
96
|
slug = escape_docid(id)
|
96
97
|
url = CouchRest.paramify_url("#{path}/#{slug}", params)
|
97
98
|
result = connection.get(url)
|
@@ -105,6 +106,14 @@ module CouchRest
|
|
105
106
|
doc
|
106
107
|
end
|
107
108
|
|
109
|
+
# GET the requested document by ID like `get!`, but returns nil if the document
|
110
|
+
# does not exist.
|
111
|
+
def get(*args)
|
112
|
+
get!(*args)
|
113
|
+
rescue CouchRest::NotFound
|
114
|
+
nil
|
115
|
+
end
|
116
|
+
|
108
117
|
# Save a document to CouchDB. This will use the <tt>_id</tt> field from
|
109
118
|
# the document as the id for PUT, or request a new UUID from CouchDB, if
|
110
119
|
# no <tt>_id</tt> is present on the document. IDs are attached to
|
@@ -175,12 +184,13 @@ module CouchRest
|
|
175
184
|
# missing ids, supply one from the uuid cache.
|
176
185
|
#
|
177
186
|
# If called with no arguments, bulk saves the cache of documents to be bulk saved.
|
178
|
-
def bulk_save(docs = nil,
|
187
|
+
def bulk_save(docs = nil, opts = {})
|
188
|
+
opts = { :use_uuids => true, :all_or_nothing => false }.update(opts)
|
179
189
|
if docs.nil?
|
180
190
|
docs = @bulk_save_cache
|
181
191
|
@bulk_save_cache = []
|
182
192
|
end
|
183
|
-
if
|
193
|
+
if opts[:use_uuids]
|
184
194
|
ids, noids = docs.partition{|d|d['_id']}
|
185
195
|
uuid_count = [noids.length, @server.uuid_batch_count].max
|
186
196
|
noids.each do |doc|
|
@@ -189,7 +199,7 @@ module CouchRest
|
|
189
199
|
end
|
190
200
|
end
|
191
201
|
request_body = {:docs => docs}
|
192
|
-
if all_or_nothing
|
202
|
+
if opts[:all_or_nothing]
|
193
203
|
request_body[:all_or_nothing] = true
|
194
204
|
end
|
195
205
|
connection.post "#{path}/_bulk_docs", request_body
|
@@ -64,22 +64,26 @@ describe CouchRest::Connection do
|
|
64
64
|
conn = CouchRest::Connection.new(URI "http://user:pass@mock")
|
65
65
|
expect(conn.http.www_auth.basic_auth.set?).to be_true
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
describe "with SSL options" do
|
69
|
+
|
69
70
|
it "should leave the default if nothing set" do
|
70
71
|
default = HTTPClient.new.ssl_config.verify_mode
|
71
72
|
conn = CouchRest::Connection.new(URI "https://localhost:5984")
|
72
73
|
expect(conn.http.ssl_config.verify_mode).to eql(default)
|
73
74
|
end
|
75
|
+
|
74
76
|
it "should support disabling SSL verify mode" do
|
75
77
|
conn = CouchRest::Connection.new(URI("https://localhost:5984"), :verify_ssl => false)
|
76
78
|
expect(conn.http.ssl_config.verify_mode).to eql(OpenSSL::SSL::VERIFY_NONE)
|
77
79
|
end
|
80
|
+
|
78
81
|
it "should support enabling SSL verify mode" do
|
79
82
|
conn = CouchRest::Connection.new(URI("https://localhost:5984"), :verify_ssl => true)
|
80
83
|
expect(conn.http.ssl_config.verify_mode).to eql(OpenSSL::SSL::VERIFY_PEER)
|
81
84
|
end
|
82
|
-
|
85
|
+
|
86
|
+
it "should support setting specific client cert & key" do
|
83
87
|
conn = CouchRest::Connection.new(URI("https://localhost:5984"),
|
84
88
|
:ssl_client_cert => 'cert',
|
85
89
|
:ssl_client_key => 'key',
|
@@ -88,6 +92,42 @@ describe CouchRest::Connection do
|
|
88
92
|
expect(conn.http.ssl_config.client_key).to eql('key')
|
89
93
|
end
|
90
94
|
|
95
|
+
it "should support adding the ca to trust from a file" do
|
96
|
+
file = Tempfile.new(['server', '.pem'])
|
97
|
+
File.write(file.path, "-----BEGIN CERTIFICATE-----
|
98
|
+
MIIDrTCCAxagAwIBAgIBADANBgkqhkiG9w0BAQQFADCBnDEbMBkGA1UEChMSVGhl
|
99
|
+
IFNhbXBsZSBDb21wYW55MRQwEgYDVQQLEwtDQSBEaXZpc2lvbjEcMBoGCSqGSIb3
|
100
|
+
DQEJARYNY2FAc2FtcGxlLmNvbTETMBEGA1UEBxMKTWV0cm9wb2xpczERMA8GA1UE
|
101
|
+
CBMITmV3IFlvcmsxCzAJBgNVBAYTAlVTMRQwEgYDVQQDEwtUU0MgUm9vdCBDQTAe
|
102
|
+
Fw0wMTEyMDgwNDI3MDVaFw0wMjEyMDgwNDI3MDVaMIGcMRswGQYDVQQKExJUaGUg
|
103
|
+
U2FtcGxlIENvbXBhbnkxFDASBgNVBAsTC0NBIERpdmlzaW9uMRwwGgYJKoZIhvcN
|
104
|
+
AQkBFg1jYUBzYW1wbGUuY29tMRMwEQYDVQQHEwpNZXRyb3BvbGlzMREwDwYDVQQI
|
105
|
+
EwhOZXcgWW9yazELMAkGA1UEBhMCVVMxFDASBgNVBAMTC1RTQyBSb290IENBMIGf
|
106
|
+
MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDaiAwfKB6ZBtnTRTIo6ddomt0S9ec0
|
107
|
+
NcuvtJogt0s9dXpHowh98FCDjnLtCi8du6LDTZluhlOtTFARPlV/LVnpsbyMCXMs
|
108
|
+
G2qpdjJop+XIBdvoCz2HpGXjUmym8WLqt+coWwJqUSwiEba74JG93v7TU+Xcvc00
|
109
|
+
5MWnxmKZzD/R3QIDAQABo4H8MIH5MAwGA1UdEwQFMAMBAf8wHQYDVR0OBBYEFG/v
|
110
|
+
yytrBtEquMX2dreysix/MlPMMIHJBgNVHSMEgcEwgb6AFG/vyytrBtEquMX2drey
|
111
|
+
six/MlPMoYGipIGfMIGcMRswGQYDVQQKExJUaGUgU2FtcGxlIENvbXBhbnkxFDAS
|
112
|
+
BgNVBAsTC0NBIERpdmlzaW9uMRwwGgYJKoZIhvcNAQkBFg1jYUBzYW1wbGUuY29t
|
113
|
+
MRMwEQYDVQQHEwpNZXRyb3BvbGlzMREwDwYDVQQIEwhOZXcgWW9yazELMAkGA1UE
|
114
|
+
BhMCVVMxFDASBgNVBAMTC1RTQyBSb290IENBggEAMA0GCSqGSIb3DQEBBAUAA4GB
|
115
|
+
ABclymJfsPOUazNQO8aIaxwVbXWS+8AFEkMMRx6O68ICAMubQBvs8Buz3ALXhqYe
|
116
|
+
FS5G13pW2ZnAlSdTkSTKkE5wGZ1RYSfyiEKXb+uOKhDN9LnajDzaMPkNDU2NDXDz
|
117
|
+
SqHk9ZiE1boQaMzjNLu+KabTLpmL9uXvFA/i+gdenFHv
|
118
|
+
-----END CERTIFICATE-----".gsub(/^\s+/, ''))
|
119
|
+
conn = CouchRest::Connection.new(URI("https://localhost:5984"),
|
120
|
+
:ssl_ca_file => file.path
|
121
|
+
)
|
122
|
+
conn.http.ssl_config.cert_store_items.should include(file.path)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should support adding multiple ca certificates from a directory" do
|
126
|
+
conn = CouchRest::Connection.new(URI("https://localhost:5984"),
|
127
|
+
:ssl_ca_file => '.'
|
128
|
+
)
|
129
|
+
conn.http.ssl_config.cert_store_items.should include('.')
|
130
|
+
end
|
91
131
|
end
|
92
132
|
|
93
133
|
describe "with timeout options" do
|
@@ -417,6 +457,26 @@ describe CouchRest::Connection do
|
|
417
457
|
.to_return(:body => "")
|
418
458
|
expect { mock_conn.head('db/test-head') }.to_not raise_error
|
419
459
|
end
|
460
|
+
it "should returns headers hash" do
|
461
|
+
response_headers = { "Etag" => "document-version-number" }
|
462
|
+
stub_request(:head, "http://mock/db/test-head")
|
463
|
+
.to_return(
|
464
|
+
:body => "",
|
465
|
+
:headers => response_headers
|
466
|
+
)
|
467
|
+
expect(mock_conn.head('db/test-head')).to eq(response_headers)
|
468
|
+
end
|
469
|
+
|
470
|
+
it "should returns raw headers if opts[:raw] true" do
|
471
|
+
response_headers = { "Etag" => "document-version-number" }
|
472
|
+
stub_request(:head, "http://mock/db/test-head")
|
473
|
+
.to_return(
|
474
|
+
:body => "",
|
475
|
+
:headers => response_headers
|
476
|
+
)
|
477
|
+
expect(mock_conn.head('db/test-head', {raw: true})).to include("Etag: document-version-number" )
|
478
|
+
end
|
479
|
+
|
420
480
|
it "should handle head request when document missing" do
|
421
481
|
stub_request(:head, "http://mock/db/test-missing-head")
|
422
482
|
.to_return(:status => 404)
|
@@ -233,6 +233,17 @@ describe CouchRest::Database do
|
|
233
233
|
expect(@db.get(@docid)['will-exist']).to eq 'here'
|
234
234
|
end
|
235
235
|
end
|
236
|
+
|
237
|
+
describe "GET (document by id) when the doc does not exist)" do
|
238
|
+
it "should provide nil" do
|
239
|
+
expect(@db.get('fooooobar')).to be_nil
|
240
|
+
end
|
241
|
+
it "should raise an exception" do
|
242
|
+
expect do
|
243
|
+
@db.get!('fooooobar')
|
244
|
+
end.to raise_error(CouchRest::NotFound)
|
245
|
+
end
|
246
|
+
end
|
236
247
|
|
237
248
|
describe "POST (adding bulk documents)" do
|
238
249
|
it "should add them without ids" do
|
@@ -256,6 +267,13 @@ describe CouchRest::Database do
|
|
256
267
|
|
257
268
|
@db.bulk_save(docs)
|
258
269
|
end
|
270
|
+
|
271
|
+
it "should allow UUID assignment to be disabled" do
|
272
|
+
expect(@db.connection).to_not receive(:next_uuid)
|
273
|
+
docs = [{'key' => 'value'}, {'_id' => 'totally-uniq'}]
|
274
|
+
expect(@db.connection).to receive(:post).with("/couchrest-test/_bulk_docs", {:docs => docs})
|
275
|
+
@db.bulk_save(docs, :use_uuids => false)
|
276
|
+
end
|
259
277
|
|
260
278
|
it "should add them with uniq ids" do
|
261
279
|
rs = @db.bulk_save([
|
@@ -270,9 +288,7 @@ describe CouchRest::Database do
|
|
270
288
|
|
271
289
|
it "should empty the bulk save cache if no documents are given" do
|
272
290
|
@db.save_doc({"_id" => "bulk_cache_1", "val" => "test"}, true)
|
273
|
-
expect
|
274
|
-
@db.get('bulk_cache_1')
|
275
|
-
end.to raise_error(CouchRest::NotFound)
|
291
|
+
expect(@db.get('bulk_cache_1')).to be_nil
|
276
292
|
@db.bulk_save
|
277
293
|
expect(@db.get("bulk_cache_1")["val"]).to eq "test"
|
278
294
|
end
|
@@ -281,7 +297,7 @@ describe CouchRest::Database do
|
|
281
297
|
docs = [{"_id" => "oneB", "wild" => "and random"}, {"_id" => "twoB", "mild" => "yet local"}]
|
282
298
|
expect(@db.connection).to receive(:post).with("/couchrest-test/_bulk_docs", {:all_or_nothing => true, :docs => docs})
|
283
299
|
|
284
|
-
@db.bulk_save(docs,
|
300
|
+
@db.bulk_save(docs, :all_or_nothing => true)
|
285
301
|
end
|
286
302
|
|
287
303
|
it "should raise an error that is useful for recovery" do
|
@@ -577,12 +593,8 @@ describe CouchRest::Database do
|
|
577
593
|
td2 = {"_id" => "td2", "val" => 4}
|
578
594
|
@db.save_doc(td1, true)
|
579
595
|
@db.save_doc(td2, true)
|
580
|
-
expect
|
581
|
-
|
582
|
-
end.to raise_error(CouchRest::NotFound)
|
583
|
-
expect do
|
584
|
-
@db.get(td2["_id"])
|
585
|
-
end.to raise_error(CouchRest::NotFound)
|
596
|
+
expect(@db.get(td1["_id"])).to be_nil
|
597
|
+
expect(@db.get(td2["_id"])).to be_nil
|
586
598
|
td3 = {"_id" => "td3", "val" => "foo"}
|
587
599
|
@db.save_doc(td3, true)
|
588
600
|
expect(@db.get(td1["_id"])["val"]).to eq td1["val"]
|
@@ -595,9 +607,7 @@ describe CouchRest::Database do
|
|
595
607
|
td2 = {"_id" => "steve", "val" => 3}
|
596
608
|
@db.bulk_save_cache_limit = 50
|
597
609
|
@db.save_doc(td1, true)
|
598
|
-
expect
|
599
|
-
@db.get(td1["_id"])
|
600
|
-
end.to raise_error(CouchRest::NotFound)
|
610
|
+
expect(@db.get(td1["_id"])).to be_nil
|
601
611
|
@db.save_doc(td2)
|
602
612
|
expect(@db.get(td1["_id"])["val"]).to eq td1["val"]
|
603
613
|
expect(@db.get(td2["_id"])["val"]).to eq td2["val"]
|
@@ -614,12 +624,12 @@ describe CouchRest::Database do
|
|
614
624
|
doc = @db.get(@r['id'])
|
615
625
|
expect(doc['and']).to eq 'spain'
|
616
626
|
@db.delete_doc doc
|
617
|
-
expect(
|
627
|
+
expect(@db.get(@r['id'])).to be_nil
|
618
628
|
end
|
619
629
|
it "should work with uri id" do
|
620
630
|
doc = @db.get(@docid)
|
621
631
|
@db.delete_doc doc
|
622
|
-
expect(
|
632
|
+
expect(@db.get @docid).to be_nil
|
623
633
|
end
|
624
634
|
it "should fail without an _id" do
|
625
635
|
expect(lambda{@db.delete_doc({"not"=>"a real doc"})}).to raise_error(ArgumentError)
|
@@ -627,9 +637,9 @@ describe CouchRest::Database do
|
|
627
637
|
it "should defer actual deletion when using bulk save" do
|
628
638
|
doc = @db.get(@docid)
|
629
639
|
@db.delete_doc doc, true
|
630
|
-
expect(
|
640
|
+
expect(@db.get @docid).to_not be_nil
|
631
641
|
@db.bulk_save
|
632
|
-
expect(
|
642
|
+
expect(@db.get @docid).to be_nil
|
633
643
|
end
|
634
644
|
|
635
645
|
end
|
@@ -227,7 +227,7 @@ describe CouchRest::Document do
|
|
227
227
|
doc = CouchRest::Document.new({"_id" => "bulkdoc", "val" => 3})
|
228
228
|
doc.database = @db
|
229
229
|
doc.save(true)
|
230
|
-
expect(
|
230
|
+
expect(doc.database.get(doc["_id"])).to be_nil
|
231
231
|
doc.database.bulk_save
|
232
232
|
expect(doc.database.get(doc["_id"])["val"]).to eql doc["val"]
|
233
233
|
end
|
@@ -267,7 +267,7 @@ describe CouchRest::Document do
|
|
267
267
|
end
|
268
268
|
it "should make it disappear" do
|
269
269
|
@doc.destroy
|
270
|
-
expect(
|
270
|
+
expect(@db.get @resp['id']).to be_nil
|
271
271
|
end
|
272
272
|
it "should error when there's no db" do
|
273
273
|
@doc = CouchRest::Document.new("key" => [1,2,3], :more => "values")
|
@@ -288,9 +288,9 @@ describe CouchRest::Document do
|
|
288
288
|
@doc.destroy(true)
|
289
289
|
expect(@doc['_id']).to be_nil
|
290
290
|
expect(@doc['_rev']).to be_nil
|
291
|
-
expect(
|
291
|
+
expect(@db.get @resp['id']).to_not be_nil
|
292
292
|
@db.bulk_save
|
293
|
-
expect(
|
293
|
+
expect(@db.get @resp['id']).to be_nil
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J. Chris Anderson
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: httpclient
|
@@ -20,14 +20,14 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "~>"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.
|
23
|
+
version: '2.7'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: 2.
|
30
|
+
version: '2.7'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: mime-types
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,6 +112,20 @@ dependencies:
|
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: mime-types
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 2.6.2
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - '='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 2.6.2
|
115
129
|
description: CouchRest provides a simple interface on top of CouchDB's RESTful HTTP
|
116
130
|
API, as well as including some utility scripts for managing views and attachments.
|
117
131
|
email: jchris@apache.org
|
@@ -206,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
220
|
version: 1.3.1
|
207
221
|
requirements: []
|
208
222
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
223
|
+
rubygems_version: 2.5.1
|
210
224
|
signing_key:
|
211
225
|
specification_version: 4
|
212
226
|
summary: Lean and RESTful interface to CouchDB.
|