datomic-client 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/README.md +4 -1
- data/datomic-client.gemspec +1 -1
- data/lib/datomic/client.rb +5 -3
- data/lib/datomic/client/version.rb +1 -1
- data/spec/datomic_client_spec.rb +6 -0
- metadata +7 -7
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -35,7 +35,7 @@ $ irb -rdatomic/client
|
|
35
35
|
=> ''
|
36
36
|
|
37
37
|
# Most responses are in edn and thus can be accessed natively
|
38
|
-
>> resp = datomic.query(
|
38
|
+
>> resp = datomic.query('[:find ?c :where [?c :community/name]]', dbname)
|
39
39
|
>> resp.data
|
40
40
|
=> [[1]]
|
41
41
|
|
@@ -58,6 +58,7 @@ Please report them [on github](http://github.com/cldwalker/datomic-client/issues
|
|
58
58
|
|
59
59
|
* @crnixon for adding edn support and improving #query
|
60
60
|
* @flyingmachine for starting this with me
|
61
|
+
* @timcraft for #db_alias
|
61
62
|
* @relevance for fridays to work on this
|
62
63
|
|
63
64
|
## Links
|
@@ -65,3 +66,5 @@ Please report them [on github](http://github.com/cldwalker/datomic-client/issues
|
|
65
66
|
* [API documentation](http://docs.datomic.com/rest.html) - Actual documentation now resides on root
|
66
67
|
url of datomic endpoint
|
67
68
|
* [Initial announcement](http://blog.datomic.com/2012/09/rest-api.html)
|
69
|
+
* [Sinatra Example](https://github.com/crnixon/datomic-sinatra-wiki) - Sinatra wiki that uses
|
70
|
+
datomic-client
|
data/datomic-client.gemspec
CHANGED
data/lib/datomic/client.rb
CHANGED
@@ -57,9 +57,7 @@ module Datomic
|
|
57
57
|
# pointing to that database.
|
58
58
|
def query(query, args_or_dbname, params = {})
|
59
59
|
query = transmute_data(query)
|
60
|
-
args = args_or_dbname.is_a?(String) ?
|
61
|
-
[{:"db/alias" => [@storage, args_or_dbname].join('/')}] :
|
62
|
-
args_or_dbname
|
60
|
+
args = args_or_dbname.is_a?(String) ? [db_alias(args_or_dbname)] : args_or_dbname
|
63
61
|
args = transmute_data(args)
|
64
62
|
get root_url("api/query"), params.merge(:q => query, :args => args)
|
65
63
|
end
|
@@ -74,6 +72,10 @@ module Datomic
|
|
74
72
|
:block_response => block, &HANDLE_RESPONSE)
|
75
73
|
end
|
76
74
|
|
75
|
+
def db_alias(dbname)
|
76
|
+
{:"db/alias" => "#@storage/#{dbname}"}
|
77
|
+
end
|
78
|
+
|
77
79
|
private
|
78
80
|
|
79
81
|
def get(url, params = {})
|
data/spec/datomic_client_spec.rb
CHANGED
@@ -194,4 +194,10 @@ describe Datomic::Client do
|
|
194
194
|
resp.code.should == 503
|
195
195
|
end
|
196
196
|
end
|
197
|
+
|
198
|
+
describe "#db_alias" do
|
199
|
+
it "returns an object that can be used as a database alias input to #query" do
|
200
|
+
client.db_alias('test').should == {:"db/alias" => "#{storage}/test"}
|
201
|
+
end
|
202
|
+
end
|
197
203
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datomic-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-02 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
85
|
+
version: 1.0.0
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.
|
93
|
+
version: 1.0.0
|
94
94
|
description: This gem provides a simple way to use datomic's http API - http://docs.datomic.com/rest.html.
|
95
95
|
email: gabriel.horner@gmail.com
|
96
96
|
executables: []
|
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
segments:
|
126
126
|
- 0
|
127
|
-
hash: -
|
127
|
+
hash: -2589337198056687659
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
none: false
|
130
130
|
requirements:
|
@@ -133,10 +133,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash: -
|
136
|
+
hash: -2589337198056687659
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 1.8.
|
139
|
+
rubygems_version: 1.8.19
|
140
140
|
signing_key:
|
141
141
|
specification_version: 3
|
142
142
|
summary: http client for datomic's API
|