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.
@@ -1,3 +1,7 @@
1
+ ## 0.4.1
2
+ * Make #db_alias available
3
+ * Upgrade edn
4
+
1
5
  ## 0.4.0
2
6
  * query endpoint takes query arg first to match endpoint syntax
3
7
  * query endpoint can a take user's args
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(dbname, '[:find ?c :where [?c :community/name]]')
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
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency 'rspec', '~> 2.11'
20
20
  s.add_development_dependency 'rake', '~> 0.9.2.2'
21
21
  s.add_dependency 'rest-client', '~> 1.6.7'
22
- s.add_dependency 'edn', '~> 0.9.4'
22
+ s.add_dependency 'edn', '~> 1.0.0'
23
23
  end
@@ -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 = {})
@@ -1,5 +1,5 @@
1
1
  module Datomic
2
2
  class Client
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.1'
4
4
  end
5
5
  end
@@ -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.0
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-09-21 00:00:00.000000000 Z
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.9.4
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.9.4
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: -555568115578253090
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: -555568115578253090
136
+ hash: -2589337198056687659
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 1.8.24
139
+ rubygems_version: 1.8.19
140
140
  signing_key:
141
141
  specification_version: 3
142
142
  summary: http client for datomic's API