ashikawa-core 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +7 -7
- data/CHANGELOG.md +25 -0
- data/CONTRIBUTING.md +4 -4
- data/Gemfile.devtools +32 -16
- data/README.md +9 -11
- data/Rakefile +3 -0
- data/ashikawa-core.gemspec +7 -5
- data/config/flay.yml +2 -2
- data/config/flog.yml +2 -1
- data/config/mutant.yml +14 -1
- data/config/reek.yml +9 -4
- data/config/rubocop.yml +14 -14
- data/lib/ashikawa-core/collection.rb +10 -6
- data/lib/ashikawa-core/configuration.rb +10 -5
- data/lib/ashikawa-core/connection.rb +30 -21
- data/lib/ashikawa-core/cursor.rb +2 -3
- data/lib/ashikawa-core/database.rb +12 -35
- data/lib/ashikawa-core/document.rb +3 -4
- data/lib/ashikawa-core/edge.rb +5 -5
- data/lib/ashikawa-core/error_response.rb +108 -0
- data/lib/ashikawa-core/index.rb +4 -14
- data/lib/ashikawa-core/query.rb +1 -1
- data/lib/ashikawa-core/transaction.rb +1 -16
- data/lib/ashikawa-core/version.rb +1 -1
- data/spec/acceptance/basic_spec.rb +9 -6
- data/spec/acceptance/spec_helper.rb +5 -4
- data/spec/setup/arangodb.sh +12 -17
- data/spec/unit/collection_spec.rb +60 -18
- data/spec/unit/configuration_spec.rb +35 -4
- data/spec/unit/connection_spec.rb +23 -65
- data/spec/unit/cursor_spec.rb +2 -2
- data/spec/unit/database_spec.rb +16 -28
- data/spec/unit/document_spec.rb +3 -3
- data/spec/unit/edge_spec.rb +1 -1
- data/spec/unit/index_spec.rb +1 -1
- data/spec/unit/query_spec.rb +1 -1
- data/spec/unit/spec_helper.rb +3 -2
- data/tasks/adjustments.rake +0 -14
- metadata +26 -13
- data/lib/ashikawa-core/request_preprocessor.rb +0 -50
- data/lib/ashikawa-core/response_preprocessor.rb +0 -160
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ac637ffe2cc3b5cc3ed883347d703b51ba3ccb3
|
4
|
+
data.tar.gz: a1791745822da535b4a18448c9813551aa510dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4a80e54218ce219f0c125bec825cd0369c345dc1f7beb8b1e05cf4997700e385da13c43d8819dfb6ceebd75b3d5e9e76e7973528a31fd372b39cb6ca2200a2
|
7
|
+
data.tar.gz: ac70032a5665a804dc83185c34103a8b641b4f6263bce00ddae96761150cf1ae1dd4fec8fe0286121f05f986027d20c05372bb939e1f92e980d80c797d068844
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.1.1
|
data/.travis.yml
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
language: ruby
|
2
|
+
before_install:
|
3
|
+
- gem install bundler -v '= 1.5.1' # http://changelog.travis-ci.com/post/71633370723/mri-ruby-2-1-0-and-jruby-1-7-9-available
|
2
4
|
before_script:
|
3
5
|
- ./spec/setup/arangodb.sh
|
4
6
|
rvm:
|
5
7
|
- 1.9.3
|
6
8
|
- 2.0.0
|
9
|
+
- 2.1.0
|
7
10
|
- jruby-19mode
|
8
|
-
-
|
9
|
-
- rbx-19mode
|
10
|
-
- ruby-head
|
11
|
+
- rbx-2.2.5
|
11
12
|
env:
|
12
|
-
- ARANGODB_DISABLE_AUTHENTIFICATION=
|
13
|
-
- ARANGODB_DISABLE_AUTHENTIFICATION=false VERSION=
|
13
|
+
- ARANGODB_DISABLE_AUTHENTIFICATION=false VERSION=1.4
|
14
|
+
- ARANGODB_DISABLE_AUTHENTIFICATION=false VERSION=2.0
|
14
15
|
matrix:
|
15
16
|
allow_failures:
|
16
|
-
- rvm:
|
17
|
-
- rvm: jruby-head
|
17
|
+
- rvm: 2.1.0
|
18
18
|
script: "bundle exec rake ci"
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
# Version 0.10
|
2
|
+
|
3
|
+
**Codename: Sepia Tone Laboratory**
|
4
|
+
|
5
|
+
* Support for ArangoDB 1.4 and 2.0
|
6
|
+
* Big Refactoring Release
|
7
|
+
* Including significant refactoring of the test suite
|
8
|
+
* Breaking change:
|
9
|
+
* `Document#hash` is now `Document#to_h`. This was a huge mistake before, sorry for that! #86
|
10
|
+
* Bug Fixes:
|
11
|
+
* Crashes on Rubinius have been fixed – it's now supported #75
|
12
|
+
* Allow the usage of both keys and IDs for `Collection#fetch` and `Collection#replace` #77
|
13
|
+
* Logging
|
14
|
+
* Don't spam the log files #88
|
15
|
+
* Use Faraday Middleware and middleware included in Faraday instead of custom tailored middleware #92
|
16
|
+
* The branching model has been changed: There's no development branch anymore
|
17
|
+
* This was confusing to both users and contributors #79
|
18
|
+
* Other adjustments:
|
19
|
+
* Most classes are now 100% mutation tested via mutant #37
|
20
|
+
* New Contributors
|
21
|
+
* Nikita Vasiliev (@sharpyfox)
|
22
|
+
* Dirk Breuer (@railsbros-dirk)
|
23
|
+
|
24
|
+
*Codename in honor of Lifeformed.*
|
25
|
+
|
1
26
|
# Version 0.9
|
2
27
|
|
3
28
|
**Codename: Weramur**
|
data/CONTRIBUTING.md
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
When you want to write code for the project, please follow these guidelines:
|
4
4
|
|
5
|
-
1. **Claim** the ticket: Tell us that you want to work on a certain ticket, we will assign it to you (We don't want two people to work on the same thing
|
6
|
-
2. **Fork** your feature branch from the `
|
5
|
+
1. **Claim** the ticket: Tell us that you want to work on a certain ticket, we will assign it to you (We don't want two people to work on the same thing :wink:)
|
6
|
+
2. **Fork** your feature branch from the `master` branch
|
7
7
|
3. Write an **acceptance test**: Describe what you want to do (our acceptance tests touch the database)
|
8
8
|
4. **Implement** it: Write a unit test, check that it fails, make the test pass – repeat (our unit tests don't touch the database)
|
9
|
-
5. Write **documentation** for it
|
10
|
-
6. Check with `bundle exec rake ci` (you need to have ArangoDB running for that) that everything is fine and send the pull request to the `development` branch :
|
9
|
+
5. Write **documentation** for it
|
10
|
+
6. Check with `bundle exec rake ci` (you need to have ArangoDB running for that) that everything is fine and send the pull request to the `development` branch :smiley:
|
11
11
|
|
12
12
|
## Setup
|
13
13
|
|
data/Gemfile.devtools
CHANGED
@@ -1,24 +1,28 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake',
|
5
|
-
gem 'rspec',
|
6
|
-
gem '
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'rspec-core', '~> 2.14.8'
|
7
|
+
gem 'yard', '~> 0.8.7'
|
8
|
+
|
9
|
+
platform :rbx do
|
10
|
+
gem 'rubysl-singleton', '~> 2.0.0'
|
11
|
+
end
|
7
12
|
end
|
8
13
|
|
9
14
|
group :yard do
|
10
|
-
gem 'kramdown', '~> 1.2
|
15
|
+
gem 'kramdown', '~> 1.3.2'
|
11
16
|
end
|
12
17
|
|
13
18
|
group :guard do
|
14
|
-
gem 'guard', '~>
|
15
|
-
gem 'guard-bundler', '~>
|
16
|
-
gem 'guard-rspec', '~>
|
17
|
-
gem 'guard-rubocop', '~> 0.2
|
18
|
-
gem 'guard-mutant', '~> 0.0.1'
|
19
|
+
gem 'guard', '~> 2.4.0'
|
20
|
+
gem 'guard-bundler', '~> 2.0.0'
|
21
|
+
gem 'guard-rspec', '~> 4.2.6'
|
22
|
+
gem 'guard-rubocop', '~> 1.0.2'
|
19
23
|
|
20
24
|
# file system change event handling
|
21
|
-
gem 'listen', '~>
|
25
|
+
gem 'listen', '~> 2.5.0'
|
22
26
|
gem 'rb-fchange', '~> 0.0.6', require: false
|
23
27
|
gem 'rb-fsevent', '~> 0.9.3', require: false
|
24
28
|
gem 'rb-inotify', '~> 0.9.0', require: false
|
@@ -30,18 +34,30 @@ group :guard do
|
|
30
34
|
end
|
31
35
|
|
32
36
|
group :metrics do
|
33
|
-
gem 'coveralls', '~> 0.
|
37
|
+
gem 'coveralls', '~> 0.7.0'
|
34
38
|
gem 'flay', '~> 2.4.0'
|
35
|
-
gem 'flog', '~> 4.
|
39
|
+
gem 'flog', '~> 4.2.0'
|
36
40
|
gem 'reek', '~> 1.3.2'
|
37
|
-
gem 'rubocop', '~> 0.
|
38
|
-
gem 'simplecov', '~> 0.
|
39
|
-
gem 'yardstick', '~> 0.9.
|
41
|
+
gem 'rubocop', '~> 0.18.1'
|
42
|
+
gem 'simplecov', '~> 0.8.2'
|
43
|
+
gem 'yardstick', '~> 0.9.9'
|
44
|
+
|
45
|
+
platforms :mri do
|
46
|
+
gem 'mutant', '~> 0.5.3'
|
47
|
+
gem 'mutant-rspec', '~> 0.5.3'
|
48
|
+
end
|
40
49
|
|
41
50
|
platforms :ruby_19, :ruby_20 do
|
42
|
-
gem 'mutant', git: 'https://github.com/mbj/mutant.git'
|
43
51
|
gem 'yard-spellcheck', '~> 0.1.5'
|
44
52
|
end
|
53
|
+
|
54
|
+
platform :rbx do
|
55
|
+
gem 'json', '~> 1.8.1'
|
56
|
+
gem 'racc', '~> 1.4'
|
57
|
+
gem 'rubysl-logger', '~> 2.0.0'
|
58
|
+
gem 'rubysl-open-uri', '~> 2.0.0'
|
59
|
+
gem 'rubysl-prettyprint', '~> 2.0.2'
|
60
|
+
end
|
45
61
|
end
|
46
62
|
|
47
63
|
group :benchmarks do
|
data/README.md
CHANGED
@@ -3,21 +3,19 @@
|
|
3
3
|
| Project | Ashikawa::Core
|
4
4
|
|:----------------|:--------------------------------------------------
|
5
5
|
| Homepage | http://triagens.github.io/ashikawa-core/
|
6
|
-
| Documentation | http://www.rubydoc.info/
|
6
|
+
| Documentation | [RubyDoc](http://www.rubydoc.info/gems/ashikawa-core)
|
7
7
|
| CI | [![Build Status](https://secure.travis-ci.org/triAGENS/ashikawa-core.png?branch=master)](http://travis-ci.org/triAGENS/ashikawa-core)
|
8
|
-
| Code Metrics | [![Code Climate](https://codeclimate.com/github/triAGENS/ashikawa-core.png)](https://codeclimate.com/github/triAGENS/ashikawa-core)
|
8
|
+
| Code Metrics | [![Code Climate](https://codeclimate.com/github/triAGENS/ashikawa-core.png)](https://codeclimate.com/github/triAGENS/ashikawa-core)
|
9
9
|
| Gem Version | [![Gem Version](https://badge.fury.io/rb/ashikawa-core.png)](http://badge.fury.io/rb/ashikawa-core)
|
10
10
|
| Dependencies | [![Dependency Status](https://gemnasium.com/triAGENS/ashikawa-core.png)](https://gemnasium.com/triAGENS/ashikawa-core)
|
11
11
|
|
12
|
-
Ashikawa Core is a Wrapper around the ArangoDB Rest API. It provides low level access and is intended to be used in ArangoDB ODMs and other projects related to the database. It is always working with the stable version of ArangoDB, this is currently version **1.4
|
12
|
+
Ashikawa Core is a Wrapper around the ArangoDB Rest API. It provides low level access and is intended to be used in ArangoDB ODMs and other projects related to the database. It is always working with the stable version of ArangoDB, this is currently version **1.4** and the preview of **2.0**.
|
13
13
|
|
14
14
|
All tests run on Travis CI for the following versions of Ruby:
|
15
15
|
|
16
|
-
* MRI 1.9.3 and 2.
|
17
|
-
* Rubinius
|
18
|
-
* JRuby 1.9 mode
|
19
|
-
|
20
|
-
We also run on JRuby and MRI Head, but they are allowed failures (Please see [Travis](http://travis-ci.org/triAGENS/ashikawa-core) for their build status).
|
16
|
+
* MRI 1.9.3, 2.0.0 and 2.1.0
|
17
|
+
* Rubinius 2.2.5
|
18
|
+
* JRuby 1.7.9 in 1.9 mode
|
21
19
|
|
22
20
|
Please note that the [`master`](https://github.com/triAGENS/ashikawa-core) branch is always the stable version released on Ruby Gems and documented on [RDoc](http://www.rubydoc.info/github/triAGENS/ashikawa-core). If you want the most recent version, please refer to the [`development`](https://github.com/triAGENS/ashikawa-core/tree/development) branch.
|
23
21
|
|
@@ -30,7 +28,7 @@ gem install ashikawa-core
|
|
30
28
|
or, when using bundler:
|
31
29
|
|
32
30
|
```ruby
|
33
|
-
gem "ashikawa-core", "~> 0.
|
31
|
+
gem "ashikawa-core", "~> 0.10"
|
34
32
|
```
|
35
33
|
|
36
34
|
## How to Setup a Connection?
|
@@ -48,7 +46,7 @@ If you want to access the `my_db` database of your ArangoDB instance (and not th
|
|
48
46
|
```ruby
|
49
47
|
database = Ashikawa::Core::Database.new do |config|
|
50
48
|
config.url = "http://localhost:8529/_db/my_db"
|
51
|
-
config.
|
49
|
+
config.username = "lebowski"
|
52
50
|
config.password = "i<3bowling"
|
53
51
|
end
|
54
52
|
```
|
@@ -68,7 +66,7 @@ database = Ashikawa::Core::Database.new do |config|
|
|
68
66
|
end
|
69
67
|
```
|
70
68
|
|
71
|
-
For a detailed description on how to use Ashikawa::Core please refer to the [documentation](http://rdoc.info/
|
69
|
+
For a detailed description on how to use Ashikawa::Core please refer to the [documentation](http://rdoc.info/gems/ashikawa-core/frames). An example:
|
72
70
|
|
73
71
|
```ruby
|
74
72
|
database["my_collection"] # => Returns the collection my_collection – creates it, if it doesn't exist
|
data/Rakefile
CHANGED
data/ashikawa-core.gemspec
CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.description = "Ashikawa Core is a wrapper around the ArangoDB REST API. It provides low level access and is intended to be used in ArangoDB ODMs and other tools."
|
13
13
|
gem.license = "Apache License 2.0"
|
14
14
|
|
15
|
-
gem.required_ruby_version = '>= 1.9.
|
16
|
-
gem.requirements << "ArangoDB, v1.4"
|
15
|
+
gem.required_ruby_version = '>= 1.9.3'
|
16
|
+
gem.requirements << "ArangoDB, v1.4 or v2.0"
|
17
17
|
|
18
18
|
gem.rubyforge_project = "ashikawa-core"
|
19
19
|
|
@@ -22,8 +22,10 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
23
|
gem.require_paths = ["lib"]
|
24
24
|
|
25
|
-
gem.add_dependency "faraday", "~> 0.8.
|
26
|
-
gem.add_dependency "
|
25
|
+
gem.add_dependency "faraday", "~> 0.8.8"
|
26
|
+
gem.add_dependency "faraday_middleware", "~> 0.9.0"
|
27
|
+
gem.add_dependency "json", "~> 1.8.1"
|
27
28
|
gem.add_dependency "null_logger", "~> 0.0.1"
|
28
|
-
gem.add_dependency "equalizer", "~> 0.0.
|
29
|
+
gem.add_dependency "equalizer", "~> 0.0.8"
|
30
|
+
gem.add_dependency "rubysl-base64" if RUBY_ENGINE == "rbx"
|
29
31
|
end
|
data/config/flay.yml
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
---
|
2
|
-
threshold:
|
3
|
-
total_score:
|
2
|
+
threshold: 11
|
3
|
+
total_score: 275
|
data/config/flog.yml
CHANGED
data/config/mutant.yml
CHANGED
@@ -1,3 +1,16 @@
|
|
1
1
|
---
|
2
2
|
name: ashikawa-core
|
3
|
-
namespace:
|
3
|
+
namespace:
|
4
|
+
# - Ashikawa::Core::Collection
|
5
|
+
- Ashikawa::Core::Configuration
|
6
|
+
# - Ashikawa::Core::Connection
|
7
|
+
# - Ashikawa::Core::Cursor
|
8
|
+
# - Ashikawa::Core::Database
|
9
|
+
- Ashikawa::Core::Document
|
10
|
+
- Ashikawa::Core::Edge
|
11
|
+
- Ashikawa::Core::Figure
|
12
|
+
- Ashikawa::Core::Index
|
13
|
+
- Ashikawa::Core::KeyOptions
|
14
|
+
# - Ashikawa::Core::Query
|
15
|
+
- Ashikawa::Core::Status
|
16
|
+
- Ashikawa::Core::Transaction
|
data/config/reek.yml
CHANGED
@@ -18,8 +18,7 @@ DataClump:
|
|
18
18
|
min_clump_size: 2
|
19
19
|
DuplicateMethodCall:
|
20
20
|
enabled: true
|
21
|
-
exclude:
|
22
|
-
- Ashikawa::Core::ResponsePreprocessor#handle_status
|
21
|
+
exclude: []
|
23
22
|
max_calls: 1
|
24
23
|
allow_calls: []
|
25
24
|
FeatureEnvy:
|
@@ -62,7 +61,10 @@ TooManyMethods:
|
|
62
61
|
max_methods: 15
|
63
62
|
TooManyStatements:
|
64
63
|
enabled: true
|
65
|
-
exclude:
|
64
|
+
exclude:
|
65
|
+
- Ashikawa::Core::Connection#initialize
|
66
|
+
- Ashikawa::Core::ErrorResponse#on_complete
|
67
|
+
- Ashikawa::Core::Figure#initialize
|
66
68
|
max_statements: 5
|
67
69
|
UncommunicativeMethodName:
|
68
70
|
enabled: true
|
@@ -91,7 +93,7 @@ UncommunicativeVariableName:
|
|
91
93
|
enabled: true
|
92
94
|
exclude: []
|
93
95
|
reject:
|
94
|
-
- !ruby/regexp
|
96
|
+
- !ruby/regexp /^[^_]$/
|
95
97
|
- !ruby/regexp /[0-9]$/
|
96
98
|
- !ruby/regexp /[A-Z]/
|
97
99
|
accept: []
|
@@ -102,3 +104,6 @@ UtilityFunction:
|
|
102
104
|
enabled: false
|
103
105
|
exclude: []
|
104
106
|
max_helper_calls: 0
|
107
|
+
PrimaDonnaMethod:
|
108
|
+
enabled: false
|
109
|
+
exclude: []
|
data/config/rubocop.yml
CHANGED
@@ -5,7 +5,7 @@ AllCops:
|
|
5
5
|
- 'Guardfile'
|
6
6
|
- 'Rakefile'
|
7
7
|
Excludes:
|
8
|
-
-
|
8
|
+
- !ruby/regexp /spec\/setup/
|
9
9
|
|
10
10
|
# Avoid parameter lists longer than five parameters.
|
11
11
|
ParameterLists:
|
@@ -24,15 +24,6 @@ CollectionMethods:
|
|
24
24
|
find: 'detect'
|
25
25
|
find_all: 'select'
|
26
26
|
|
27
|
-
# Do not force public/protected/private keyword to be indented at the same
|
28
|
-
# level as the def keyword. My personal preference is to outdent these keywords
|
29
|
-
# because I think when scanning code it makes it easier to identify the
|
30
|
-
# sections of code and visually separate them. When the keyword is at the same
|
31
|
-
# level I think it sort of blends in with the def keywords and makes it harder
|
32
|
-
# to scan the code and see where the sections are.
|
33
|
-
AccessControl:
|
34
|
-
Enabled: true
|
35
|
-
|
36
27
|
HashSyntax:
|
37
28
|
Enabled: true
|
38
29
|
|
@@ -56,9 +47,6 @@ AlignParameters:
|
|
56
47
|
Blocks:
|
57
48
|
Enabled: false
|
58
49
|
|
59
|
-
SymbolName:
|
60
|
-
Enabled: false
|
61
|
-
|
62
50
|
NumericLiterals:
|
63
51
|
Enabled: true
|
64
52
|
|
@@ -86,7 +74,7 @@ Alias:
|
|
86
74
|
Enabled: true
|
87
75
|
|
88
76
|
Loop:
|
89
|
-
Enabled:
|
77
|
+
Enabled: false
|
90
78
|
|
91
79
|
# Do not agree at all
|
92
80
|
AndOr:
|
@@ -95,3 +83,15 @@ AndOr:
|
|
95
83
|
# This is done by YARD Stick
|
96
84
|
Documentation:
|
97
85
|
Enabled: false
|
86
|
+
|
87
|
+
# Braces can be really, really useful for clarity
|
88
|
+
BracesAroundHashParameters:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
# I prefer raise over fail
|
92
|
+
SignalException:
|
93
|
+
EnforcedStyle: only_raise
|
94
|
+
|
95
|
+
ClassLength:
|
96
|
+
CountComments: false
|
97
|
+
Max: 140
|
@@ -411,18 +411,18 @@ module Ashikawa
|
|
411
411
|
# Add an index to the collection
|
412
412
|
#
|
413
413
|
# @param [Symbol] type specify the type of the index, for example `:hash`
|
414
|
-
# @option
|
415
|
-
# @option
|
414
|
+
# @option options [Array<Symbol>] on fields on which to apply the index
|
415
|
+
# @option options [Boolean] unique Should the index be unique? Default is false
|
416
416
|
# @return Index
|
417
417
|
# @api public
|
418
418
|
# @example Add a hash-index to the fields :name and :profession of a collection
|
419
419
|
# people = database['people']
|
420
420
|
# people.add_index(:hash, :on => [:name, :profession])
|
421
|
-
def add_index(type,
|
422
|
-
unique =
|
421
|
+
def add_index(type, options)
|
422
|
+
unique = options.fetch(:unique, false)
|
423
423
|
response = send_request("index?collection=#{@id}", post: {
|
424
424
|
'type' => type.to_s,
|
425
|
-
'fields' =>
|
425
|
+
'fields' => options.fetch(:on).map { |field| field.to_s },
|
426
426
|
'unique' => unique
|
427
427
|
})
|
428
428
|
|
@@ -540,7 +540,11 @@ module Ashikawa
|
|
540
540
|
# @return [Hash] parsed JSON response from the server
|
541
541
|
# @api private
|
542
542
|
def send_request_for_content_key(document_key, opts = {})
|
543
|
-
|
543
|
+
if document_key.to_s.include? '/'
|
544
|
+
send_request("#{@content_type}/#{document_key}", opts)
|
545
|
+
else
|
546
|
+
send_request("#{@content_type}/#{@id}/#{document_key}", opts)
|
547
|
+
end
|
544
548
|
end
|
545
549
|
|
546
550
|
# Send a request for the content of this collection
|
@@ -40,7 +40,7 @@ module Ashikawa
|
|
40
40
|
# @return Connection
|
41
41
|
def connection
|
42
42
|
@connection = @connection || setup_new_connection
|
43
|
-
@connection.authenticate_with(username
|
43
|
+
@connection.authenticate_with(username, password) if username && password
|
44
44
|
@connection
|
45
45
|
end
|
46
46
|
|
@@ -55,10 +55,15 @@ module Ashikawa
|
|
55
55
|
# @api private
|
56
56
|
def setup_new_connection
|
57
57
|
raise(ArgumentError, 'Please provide either an url or a connection to setup the database') if url.nil?
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
|
59
|
+
Connection.new(url, connection_options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def connection_options
|
63
|
+
opts = {}
|
64
|
+
opts[:logger] = logger if logger
|
65
|
+
opts[:adapter] = adapter if adapter
|
66
|
+
opts
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|