danarchy_couchdb 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +6 -21
- data/README.md +4 -4
- data/Rakefile +0 -4
- data/danarchy_couchdb.gemspec +3 -3
- data/lib/danarchy_couchdb/version.rb +1 -1
- data/lib/danarchy_couchdb.rb +9 -11
- metadata +10 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d14070e6cf7b541b44fc263fc5d94b6457e64f8a2f5570c896c36da14a967a9
|
4
|
+
data.tar.gz: a2a927f8b5e27b32f23886a3924f41126761553574ee8d60a0d49700b731ed52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b8bfcae57eb7518e24aed8e467158465e1013f1b45b97b1887713d9ad6b52ebb75a54bd14f663106f6c49860954b36711d4884b29712e59a2893b25b690d9e
|
7
|
+
data.tar.gz: ced414a0092120cfa29a1b497fd718c35e27a6ac3a2fd28673306e3d70ead6c3a4109d9c7fc759f5c4b4262da6db13518089f9b8457e4cfa40ba41b655de31e9
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danarchy_couchdb (0.1.
|
4
|
+
danarchy_couchdb (0.1.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
rake (10.5.0)
|
11
|
-
rspec (3.7.0)
|
12
|
-
rspec-core (~> 3.7.0)
|
13
|
-
rspec-expectations (~> 3.7.0)
|
14
|
-
rspec-mocks (~> 3.7.0)
|
15
|
-
rspec-core (3.7.1)
|
16
|
-
rspec-support (~> 3.7.0)
|
17
|
-
rspec-expectations (3.7.0)
|
18
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
-
rspec-support (~> 3.7.0)
|
20
|
-
rspec-mocks (3.7.0)
|
21
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
-
rspec-support (~> 3.7.0)
|
23
|
-
rspec-support (3.7.1)
|
9
|
+
rake (13.0.6)
|
24
10
|
|
25
11
|
PLATFORMS
|
26
|
-
|
12
|
+
x86_64-linux
|
27
13
|
|
28
14
|
DEPENDENCIES
|
29
|
-
bundler (~>
|
15
|
+
bundler (~> 2.3)
|
30
16
|
danarchy_couchdb!
|
31
|
-
rake (~>
|
32
|
-
rspec (~> 3.0)
|
17
|
+
rake (~> 13.0)
|
33
18
|
|
34
19
|
BUNDLED WITH
|
35
|
-
|
20
|
+
2.3.3
|
data/README.md
CHANGED
@@ -55,9 +55,9 @@ test_suite_db = cdb.get('test_suite_db', '3853a22cbc4520c65f81c86897060c60')
|
|
55
55
|
=> {:_id=>"3853a22cbc4520c65f81c86897060c60", :_rev=>"1-3975759ccff3842adf690a5c10caee42", :a=>2}
|
56
56
|
|
57
57
|
# Add a new key=>value to the document:
|
58
|
-
test_suite_db[:
|
58
|
+
test_suite_db[:key] = 'value'
|
59
59
|
p test_suite_db
|
60
|
-
=> {:_id=>"3853a22cbc4520c65f81c86897060c60", :_rev=>"1-3975759ccff3842adf690a5c10caee42", :a=>2, :
|
60
|
+
=> {:_id=>"3853a22cbc4520c65f81c86897060c60", :_rev=>"1-3975759ccff3842adf690a5c10caee42", :a=>2, :key=>"value"}
|
61
61
|
|
62
62
|
# Update the document within CouchDB:
|
63
63
|
cdb.put('test_suite_db', '3853a22cbc4520c65f81c86897060c60', test_suite_db)
|
@@ -65,11 +65,11 @@ cdb.put('test_suite_db', '3853a22cbc4520c65f81c86897060c60', test_suite_db)
|
|
65
65
|
|
66
66
|
# We can verify the update with another cdb.get to update the hash to the latest document revision:
|
67
67
|
test_suite_db = cdb.get('test_suite_db', '3853a22cbc4520c65f81c86897060c60')
|
68
|
-
=> {:_id=>"3853a22cbc4520c65f81c86897060c60", :_rev=>"2-743ac80b9a990d2644bc92bafb452fe5", :a=>2, :
|
68
|
+
=> {:_id=>"3853a22cbc4520c65f81c86897060c60", :_rev=>"2-743ac80b9a990d2644bc92bafb452fe5", :a=>2, :key=>"value"}
|
69
69
|
|
70
70
|
# cdb.get can also take an optional revision argument:
|
71
71
|
test_suite_db = cdb.get('test_suite_db', '3853a22cbc4520c65f81c86897060c60', '3-9de3ebabb6ea97fb4015cb698d228aec')
|
72
|
-
=> {:_id=>"3853a22cbc4520c65f81c86897060c60", :_rev=>"3-9de3ebabb6ea97fb4015cb698d228aec", :a=>2, :
|
72
|
+
=> {:_id=>"3853a22cbc4520c65f81c86897060c60", :_rev=>"3-9de3ebabb6ea97fb4015cb698d228aec", :a=>2, :key=>"value"}
|
73
73
|
|
74
74
|
# Delete a document with cdb.delete with a required revision:
|
75
75
|
cdb.delete('test_suite_db', '3853a22cbc4520c65f81c86897060c60', '3-9de3ebabb6ea97fb4015cb698d228aec')
|
data/Rakefile
CHANGED
data/danarchy_couchdb.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.add_development_dependency "bundler", "~>
|
34
|
-
spec.add_development_dependency "rake", "~>
|
35
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
spec.add_development_dependency "bundler", "~> 2.3"
|
34
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
35
|
+
# spec.add_development_dependency "rspec", "~> 3.0"
|
36
36
|
end
|
data/lib/danarchy_couchdb.rb
CHANGED
@@ -20,14 +20,14 @@ module DanarchyCouchDB
|
|
20
20
|
uri = "#{@uri}/#{database}"
|
21
21
|
uri += "/#{document}" if document
|
22
22
|
uri += "/?rev=#{revision}" if revision
|
23
|
+
uri = URI(uri)
|
23
24
|
|
24
|
-
|
25
|
-
JSON.parse(request(
|
25
|
+
response = Net::HTTP::Get.new(uri)
|
26
|
+
JSON.parse(request(response), symbolize_names: true)
|
26
27
|
end
|
27
28
|
|
28
29
|
def get_attachment(database, document, attachment)
|
29
|
-
uri
|
30
|
-
uri = URI.parse(URI.encode(uri))
|
30
|
+
uri = URI("#{@uri}/#{database}/#{document}/#{attachment}")
|
31
31
|
request(Net::HTTP::Get.new(uri))
|
32
32
|
end
|
33
33
|
|
@@ -38,8 +38,8 @@ module DanarchyCouchDB
|
|
38
38
|
|
39
39
|
uri = "#{@uri}/#{database}"
|
40
40
|
uri += "/#{document}" if document
|
41
|
+
uri = URI(uri)
|
41
42
|
|
42
|
-
uri = URI.parse(URI.encode("#{@uri}/#{database}/#{document}"))
|
43
43
|
req = Net::HTTP::Put.new(uri)
|
44
44
|
req["content-type"] = "application/json"
|
45
45
|
req.body = data.to_json if data
|
@@ -53,9 +53,8 @@ module DanarchyCouchDB
|
|
53
53
|
attachment = args.shift
|
54
54
|
data = args.shift
|
55
55
|
type = args.shift
|
56
|
-
|
57
|
-
uri
|
58
|
-
uri = URI.parse(URI.encode(uri))
|
56
|
+
|
57
|
+
uri = URI("#{@uri}/#{database}/#{document}/#{attachment}?rev=#{revision}")
|
59
58
|
req = Net::HTTP::Put.new(uri)
|
60
59
|
req["content-type"] = "#{type}"
|
61
60
|
req.body = data if data
|
@@ -71,7 +70,7 @@ module DanarchyCouchDB
|
|
71
70
|
uri += "/#{document}" if document
|
72
71
|
uri += "/?rev=#{revision}" if revision
|
73
72
|
|
74
|
-
uri = URI
|
73
|
+
uri = URI(uri)
|
75
74
|
JSON.parse(request(Net::HTTP::Delete.new(uri)), symbolize_names: true)
|
76
75
|
end
|
77
76
|
|
@@ -81,8 +80,7 @@ module DanarchyCouchDB
|
|
81
80
|
revision = args.shift
|
82
81
|
attachment = args.shift
|
83
82
|
|
84
|
-
uri
|
85
|
-
uri = URI.parse(URI.encode(uri))
|
83
|
+
uri = URI("#{@uri}/#{database}/#{document}/#{attachment}?rev=#{revision}")
|
86
84
|
JSON.parse(request(Net::HTTP::Delete.new(uri)), symbolize_names: true)
|
87
85
|
end
|
88
86
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danarchy_couchdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan James
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
40
|
+
version: '13.0'
|
55
41
|
description: A CouchDB API connector for dAnarchy gems.
|
56
42
|
email:
|
57
43
|
- dan@danarchy.me
|
@@ -80,7 +66,7 @@ licenses:
|
|
80
66
|
- MIT
|
81
67
|
metadata:
|
82
68
|
allowed_push_host: https://rubygems.org
|
83
|
-
post_install_message:
|
69
|
+
post_install_message:
|
84
70
|
rdoc_options: []
|
85
71
|
require_paths:
|
86
72
|
- lib
|
@@ -95,9 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
requirements: []
|
98
|
-
|
99
|
-
|
100
|
-
signing_key:
|
84
|
+
rubygems_version: 3.2.33
|
85
|
+
signing_key:
|
101
86
|
specification_version: 4
|
102
87
|
summary: dAnarchy CouchDB connector.
|
103
88
|
test_files: []
|