riakrest 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +18 -11
- data/VERSION +1 -1
- data/examples/basic_client.rb +2 -2
- data/examples/basic_resource.rb +5 -5
- data/examples/bucket_schemas.rb +36 -0
- data/examples/rest_interaction.rb +51 -0
- data/lib/riakrest/core/jiak_client.rb +7 -4
- data/lib/riakrest/core/jiak_object.rb +19 -23
- data/lib/riakrest/resource/jiak_resource.rb +2 -2
- data/lib/riakrest.rb +11 -0
- data/spec/core/jiak_client_spec.rb +10 -6
- data/spec/core/jiak_object_spec.rb +5 -0
- data/spec/resource/jiak_resource_spec.rb +28 -28
- metadata +4 -2
data/History.txt
CHANGED
@@ -1,27 +1,34 @@
|
|
1
|
+
=== 0.0.4 2009-11-10
|
2
|
+
* Mods
|
3
|
+
* Fixed bug when running ruby 1.8
|
4
|
+
* Changed client_store option for returning object to :return => :object
|
5
|
+
* Added check to eql? and == that both objects are either local or not.
|
6
|
+
* Refactored local? method to jiak_object.
|
7
|
+
|
1
8
|
=== 0.0.3 2009-11-03
|
2
9
|
|
3
10
|
* Mods:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
11
|
+
* Switched to jeweler for managing gem
|
12
|
+
* Allow passing an array for specifying schema fields/masks
|
13
|
+
* Added convenience accessors to rsrc.jiak
|
14
|
+
* Allow setting proxy on core client
|
8
15
|
|
9
16
|
Clean-up:
|
10
|
-
|
17
|
+
* More examples futzing.
|
11
18
|
|
12
19
|
=== 0.0.2 2009-10-30
|
13
20
|
|
14
21
|
* Mods:
|
15
|
-
|
16
|
-
|
17
|
-
|
22
|
+
* Fixed corner case for auto_post false / auto_update true.
|
23
|
+
* Explicitly reserve jiak field in user data classes.
|
24
|
+
* Changed walk to query. Kept walk as an alias.
|
18
25
|
|
19
26
|
* Clean-up:
|
20
|
-
|
21
|
-
|
27
|
+
* DRY'd some code
|
28
|
+
* Examples
|
22
29
|
|
23
30
|
|
24
31
|
=== 0.0.1 2009-10-20
|
25
32
|
|
26
33
|
* Initial release:
|
27
|
-
|
34
|
+
* To github, anyway. git log shows the prior activity.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/examples/basic_client.rb
CHANGED
@@ -10,11 +10,11 @@ client.set_schema(bucket)
|
|
10
10
|
remy = client.store(JiakObject.new(:bucket => bucket,
|
11
11
|
:data => Person.new(:name => "remy",
|
12
12
|
:age => 10)),
|
13
|
-
:
|
13
|
+
:return => :object)
|
14
14
|
callie = client.store(JiakObject.new(:bucket => bucket,
|
15
15
|
:data => Person.new(:name => "Callie",
|
16
16
|
:age => 12)),
|
17
|
-
:
|
17
|
+
:return => :object)
|
18
18
|
|
19
19
|
puts client.get(bucket,remy.key).data.name # => "remy"
|
20
20
|
|
data/examples/basic_resource.rb
CHANGED
@@ -13,14 +13,14 @@ class Person
|
|
13
13
|
auto_update true
|
14
14
|
end
|
15
15
|
|
16
|
-
remy = Person.new(:name => '
|
17
|
-
puts remy.name # => "
|
16
|
+
remy = Person.new(:name => 'Remy',:age => 10) # (auto-post)
|
17
|
+
puts remy.name # => "Remy"
|
18
18
|
|
19
|
-
puts Person.get('
|
20
|
-
puts Person.get('
|
19
|
+
puts Person.get('Remy').name # => "Remy" (from Jiak server)
|
20
|
+
puts Person.get('Remy').age # => 10 (from Jiak server)
|
21
21
|
|
22
22
|
remy.age = 11 # (auto-update)
|
23
|
-
puts Person.get('
|
23
|
+
puts Person.get('Remy').age # => 11 (from Jiak server)
|
24
24
|
|
25
25
|
callie = Person.new(:name => 'Callie', :age => 13)
|
26
26
|
remy.link(callie,'sister')
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'riakrest'
|
2
|
+
include RiakRest
|
3
|
+
|
4
|
+
DogData = JiakDataHash.create(:name,:age,:breeds)
|
5
|
+
|
6
|
+
# client = JiakClient.new("http://localhost:8002/jiak",:proxy=>"http://localhost:8888")
|
7
|
+
client = JiakClient.new("http://localhost:8002/jiak")
|
8
|
+
bucket = JiakBucket.new("dogs", DogData)
|
9
|
+
chili = JiakObject.new(:bucket => bucket,
|
10
|
+
:key => 'chili',
|
11
|
+
:data => DogData.new(:name => "Chili",
|
12
|
+
:age => 6,
|
13
|
+
:breeds => ["heeler","akita"]))
|
14
|
+
client.set_schema(bucket)
|
15
|
+
client.store(chili)
|
16
|
+
chili = client.get(bucket,'chili')
|
17
|
+
|
18
|
+
DogData.readable(:name,:breeds)
|
19
|
+
DogData.writable(:name,:age)
|
20
|
+
client.set_schema(bucket)
|
21
|
+
chili = client.get(bucket,'chili')
|
22
|
+
diego = JiakObject.new(:bucket => bucket,
|
23
|
+
:key => "diego",
|
24
|
+
:data => DogData.new(:name => "Diego",
|
25
|
+
:age => 7))
|
26
|
+
client.store(diego)
|
27
|
+
|
28
|
+
addie = JiakObject.new(:bucket => bucket,
|
29
|
+
:key => "addie",
|
30
|
+
:data => DogData.new(:name => "Adelaide",
|
31
|
+
:age => 14,
|
32
|
+
:breeds => ["heeler"]))
|
33
|
+
client.store(addie)
|
34
|
+
|
35
|
+
|
36
|
+
addie = client.get(bucket,'addie')
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'riakrest'
|
2
|
+
include RiakRest
|
3
|
+
|
4
|
+
DogData = JiakDataHash.create(:name,:age,:breeds)
|
5
|
+
# client = JiakClient.new("http://localhost:8002/jiak",:proxy=>"http://localhost:8888")
|
6
|
+
client = JiakClient.new("http://localhost:8002/jiak")
|
7
|
+
bucket = JiakBucket.new("dogs", DogData)
|
8
|
+
|
9
|
+
chili = JiakObject.new(:bucket => bucket,
|
10
|
+
:key => 'chili',
|
11
|
+
:data => DogData.new(:name => "Chili",
|
12
|
+
:age => 6,
|
13
|
+
:breeds => ["heeler","akita"]))
|
14
|
+
client.store(chili)
|
15
|
+
|
16
|
+
diego = JiakObject.new(:bucket => bucket,
|
17
|
+
:data => DogData.new(:name => "Diego",
|
18
|
+
:age => 7,
|
19
|
+
:breeds => ["pure mutt"]))
|
20
|
+
key = client.store(diego)
|
21
|
+
|
22
|
+
chili = client.get(bucket,'chili')
|
23
|
+
diego = client.get(bucket,key)
|
24
|
+
|
25
|
+
addie = JiakObject.new(:bucket => bucket,
|
26
|
+
:key => 'addie',
|
27
|
+
:data => DogData.new(:name => "Adelaide",
|
28
|
+
:age => 14,
|
29
|
+
:breeds => ["heeler"]))
|
30
|
+
client.store(addie) # Store addie
|
31
|
+
addie.data.age = 15 # Whoops, fix her age
|
32
|
+
client.store(addie) # Store that update
|
33
|
+
db_addie = client.get(bucket,'addie') # Get what we stored
|
34
|
+
puts db_addie.data.age # => 14 !?? Not 15??
|
35
|
+
|
36
|
+
strass = JiakObject.new(:bucket => bucket,
|
37
|
+
:key => 'strass',
|
38
|
+
:data => DogData.new(:name => "Cauchy Euler Weierstrass",
|
39
|
+
:age => 5,
|
40
|
+
:breeds => ["schnauzer","mutt"]))
|
41
|
+
strass = client.store(strass,:return => :object)
|
42
|
+
strass.data.age = 6
|
43
|
+
client.store(strass)
|
44
|
+
db_strass = client.get(bucket,'strass')
|
45
|
+
puts db_strass.data.age # => 6 Yeah!
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
# Clean-up
|
50
|
+
client.keys(bucket).each {|key| client.delete(bucket,key)}
|
51
|
+
|
@@ -30,6 +30,7 @@ module RiakRest
|
|
30
30
|
# Raise JiakClientException if server or proxy (if exists) URI are not strings.
|
31
31
|
#
|
32
32
|
def initialize(uri='http://127.0.0.1:8002/jiak/', opts={})
|
33
|
+
check_opts(opts,[:proxy],JiakClientException)
|
33
34
|
server(uri)
|
34
35
|
proxy(opts[:proxy]) if(opts[:proxy])
|
35
36
|
end
|
@@ -78,7 +79,6 @@ module RiakRest
|
|
78
79
|
resp = RestClient.put(jiak_uri(bucket),
|
79
80
|
bucket.schema.to_jiak,
|
80
81
|
:content_type => APP_JSON,
|
81
|
-
:data_type => JSON_DATA,
|
82
82
|
:accept => APP_JSON)
|
83
83
|
end
|
84
84
|
|
@@ -113,7 +113,7 @@ module RiakRest
|
|
113
113
|
# stored JiakObject depending on the option <code>key</code>. The object
|
114
114
|
# for storage must be JiakObject. Valid options are:
|
115
115
|
#
|
116
|
-
# <code>:
|
116
|
+
# <code>:return</code> :: If <code>:key</code>, return the key under which the data was stored. If <code>:object</code> return the stored JiakObject (which includes Riak context). Defaults to <code>:key</code>.
|
117
117
|
# <code>:writes</code> :: The number of Riak nodes that must successfully store the data.
|
118
118
|
# <code>:durable_writes</code> :: The number of Riak nodes (<code>< writes</code>) that must successfully store the data in a durable manner.
|
119
119
|
# <code>:reads</code> :: The number of Riak nodes that must successfully read data if a JiakObject is being returned.
|
@@ -128,20 +128,21 @@ module RiakRest
|
|
128
128
|
# Raise JiakResourceException on RESTful HTTP errors.
|
129
129
|
#
|
130
130
|
def store(jobj,opts={})
|
131
|
+
check_opts(opts,[:return,:reads,:writes,:durable_writes],
|
132
|
+
JiakClientException)
|
131
133
|
params = jobj.bucket.params
|
132
134
|
req_params = {
|
133
135
|
WRITES => opts[:writes] || params[:writes],
|
134
136
|
DURABLE_WRITES => opts[:durable_writes] || params[:durable_writes],
|
135
137
|
READS => opts[:reads] || params[:reads]
|
136
138
|
}
|
137
|
-
req_params[RETURN_BODY] = opts[:
|
139
|
+
req_params[RETURN_BODY] = (opts[:return] == :object)
|
138
140
|
|
139
141
|
begin
|
140
142
|
uri = jiak_uri(jobj.bucket,jobj.key,req_params)
|
141
143
|
payload = jobj.to_jiak
|
142
144
|
headers = {
|
143
145
|
:content_type => APP_JSON,
|
144
|
-
:data_type => JSON_DATA,
|
145
146
|
:accept => APP_JSON }
|
146
147
|
# Decision tree:
|
147
148
|
# If key empty POST
|
@@ -201,6 +202,7 @@ module RiakRest
|
|
201
202
|
unless bucket.is_a?(JiakBucket)
|
202
203
|
raise JiakClientException, "Bucket must be a JiakBucket."
|
203
204
|
end
|
205
|
+
check_opts(opts,[:reads],JiakClientException)
|
204
206
|
req_params = {READS => opts[:reads] || bucket.params[:reads]}
|
205
207
|
|
206
208
|
begin
|
@@ -229,6 +231,7 @@ module RiakRest
|
|
229
231
|
# Raise JiakResourceException on RESTful HTTP errors.
|
230
232
|
#
|
231
233
|
def delete(bucket,key,opts={})
|
234
|
+
check_opts(opts,[:waits],JiakClientException)
|
232
235
|
begin
|
233
236
|
req_params = {RESPONSE_WAITS => opts[:waits] || bucket.params[:waits]}
|
234
237
|
uri = jiak_uri(bucket,key,req_params)
|
@@ -27,7 +27,7 @@ module RiakRest
|
|
27
27
|
# altered and are purposely not described here.
|
28
28
|
def initialize(opts)
|
29
29
|
opts[:links] ||= []
|
30
|
-
check_opts(opts)
|
30
|
+
check_opts(opts,VALID_OPTS,JiakObjectException)
|
31
31
|
|
32
32
|
@bucket = check_bucket(opts[:bucket])
|
33
33
|
@data = check_data(opts[:data])
|
@@ -36,7 +36,7 @@ module RiakRest
|
|
36
36
|
|
37
37
|
# The Riak context for the object if provided.
|
38
38
|
if opts[:vclock]
|
39
|
-
@riak =
|
39
|
+
@riak = {}.merge(opts)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -127,9 +127,20 @@ module RiakRest
|
|
127
127
|
# :call-seq:
|
128
128
|
# jiak_object.riak = riak
|
129
129
|
#
|
130
|
-
# Set the Riak context for a JiakObject.
|
130
|
+
# Set the Riak context for a JiakObject. This is a public method due to
|
131
|
+
# implementation needs, but in general should not be called by library
|
132
|
+
# clients.
|
131
133
|
def riak=(riak)
|
132
|
-
@riak =
|
134
|
+
@riak = riak.nil? ? nil : check_opts(riak,VALID_RIAK,JiakObjectException)
|
135
|
+
end
|
136
|
+
|
137
|
+
# :call-seq:
|
138
|
+
# local? -> true or false
|
139
|
+
#
|
140
|
+
# <code>true</code> if a JiakObject is local only, i.e., has not been
|
141
|
+
# stored via the Jiak server.
|
142
|
+
def local?
|
143
|
+
@riak.nil?
|
133
144
|
end
|
134
145
|
|
135
146
|
# :call-seq:
|
@@ -141,7 +152,8 @@ module RiakRest
|
|
141
152
|
(@bucket == other.bucket &&
|
142
153
|
@key == other.key &&
|
143
154
|
@data == other.data &&
|
144
|
-
@links == other.links
|
155
|
+
@links == other.links &&
|
156
|
+
@riak.nil? == other.riak.nil?
|
145
157
|
) rescue false
|
146
158
|
end
|
147
159
|
|
@@ -155,22 +167,14 @@ module RiakRest
|
|
155
167
|
@bucket.eql?(other.bucket) &&
|
156
168
|
@key.eql?(other.key) &&
|
157
169
|
@data.eql?(other.data) &&
|
158
|
-
@links.eql?(other.links)
|
170
|
+
@links.eql?(other.links) &&
|
171
|
+
@riak.nil?.eql?(other.riak.nil?)
|
159
172
|
end
|
160
173
|
|
161
174
|
def hash # :nodoc:
|
162
175
|
@bucket.name.hash + @key.hash + @data.hash + @links.hash + @riak.hash
|
163
176
|
end
|
164
177
|
|
165
|
-
def check_opts(opts)
|
166
|
-
err = opts.select {|k,v| !VALID_OPTS.include?(k)}
|
167
|
-
unless err.empty?
|
168
|
-
raise JiakObjectException, "unrecognized options: #{err.keys}"
|
169
|
-
end
|
170
|
-
opts
|
171
|
-
end
|
172
|
-
private :check_opts
|
173
|
-
|
174
178
|
def check_bucket(bucket)
|
175
179
|
unless bucket.is_a?(JiakBucket)
|
176
180
|
raise JiakObjectException, "Bucket must be a JiakBucket."
|
@@ -217,14 +221,6 @@ module RiakRest
|
|
217
221
|
end
|
218
222
|
private :check_link
|
219
223
|
|
220
|
-
def check_riak(riak)
|
221
|
-
err = riak.select {|k,v| !VALID_RIAK.include?(k)}
|
222
|
-
unless err.empty?
|
223
|
-
raise JiakObjectException, "unrecognized options: #{err.keys}"
|
224
|
-
end
|
225
|
-
riak
|
226
|
-
end
|
227
|
-
|
228
224
|
private
|
229
225
|
VALID_RIAK = [:vclock,:vtag,:lastmod]
|
230
226
|
VALID_OPTS = [:bucket,:key,:data,:links] + VALID_RIAK
|
@@ -274,7 +274,7 @@ module RiakRest
|
|
274
274
|
# JiakResource class, then to the value set on the Riak cluster. In
|
275
275
|
# general the values set on the Riak cluster should suffice.
|
276
276
|
def put(resource,opts={})
|
277
|
-
opts[:
|
277
|
+
opts[:return] = :object
|
278
278
|
resource.jiak.object = jiak.server.store(resource.jiak.object,opts)
|
279
279
|
resource.convenient_jiak
|
280
280
|
resource
|
@@ -633,7 +633,7 @@ module RiakRest
|
|
633
633
|
# post/put to the Jiak server. This test is used in the guards for class
|
634
634
|
# and instance level post/update methods.
|
635
635
|
def local?
|
636
|
-
jiak.object.
|
636
|
+
jiak.object.local?
|
637
637
|
end
|
638
638
|
|
639
639
|
# :call-seq:
|
data/lib/riakrest.rb
CHANGED
@@ -136,6 +136,17 @@ $:.unshift(dirname) unless
|
|
136
136
|
module RiakRest
|
137
137
|
version_file = File.join(File.dirname(__FILE__),"..","VERSION")
|
138
138
|
VERSION = IO.read(version_file).chomp
|
139
|
+
|
140
|
+
# Convenience method for checking validity of method options. If any of the
|
141
|
+
# options in opt are not in valid, raise the exception with the invalid
|
142
|
+
# options in the message.
|
143
|
+
def check_opts(opts,valid,exception)
|
144
|
+
err = opts.select {|k,v| !valid.include?(k)}
|
145
|
+
unless err.empty?
|
146
|
+
raise exception, "unrecognized options: #{err.keys}"
|
147
|
+
end
|
148
|
+
opts
|
149
|
+
end
|
139
150
|
end
|
140
151
|
|
141
152
|
require 'riakrest/core/exceptions'
|
@@ -152,17 +152,21 @@ describe "JiakClient processing" do
|
|
152
152
|
it "should return a JiakObject at time of storage" do
|
153
153
|
key = 'store_key_2'
|
154
154
|
jobj = JiakObject.new(:bucket => @bucket, :key => key, :data => @data)
|
155
|
-
resp = @client.store(jobj,{:
|
155
|
+
resp = @client.store(jobj,{:return => :object})
|
156
156
|
resp.should be_a JiakObject
|
157
157
|
resp.bucket.should eql @bucket
|
158
158
|
resp.key.should eql key
|
159
159
|
resp.data.should be_a FooBarBaz
|
160
160
|
|
161
161
|
jobj = JiakObject.new(:bucket => @bucket, :data => @data)
|
162
|
-
|
162
|
+
jobj.local?.should be true
|
163
|
+
resp = @client.store(jobj,{:return => :object})
|
163
164
|
resp.should be_a JiakObject
|
164
165
|
resp.key.should_not be_nil
|
165
166
|
resp.data.should be_a FooBarBaz
|
167
|
+
|
168
|
+
jobj.local?.should be true
|
169
|
+
resp.local?.should be false
|
166
170
|
end
|
167
171
|
|
168
172
|
it "should handle odd key values" do
|
@@ -201,7 +205,7 @@ describe "JiakClient processing" do
|
|
201
205
|
it "should update a previously stored JiakObject" do
|
202
206
|
jobj =
|
203
207
|
@client.store(JiakObject.new(:bucket => @bucket, :data => @data),
|
204
|
-
{:
|
208
|
+
{:return => :object})
|
205
209
|
|
206
210
|
jobj.data.should eql @data
|
207
211
|
[:vclock,:vtag,:lastmod].each do |field|
|
@@ -213,7 +217,7 @@ describe "JiakClient processing" do
|
|
213
217
|
updated_data = FooBarBaz.new(:foo => 'new val')
|
214
218
|
jobj.data = updated_data
|
215
219
|
updated_object =
|
216
|
-
@client.store(jobj,{:
|
220
|
+
@client.store(jobj,{:return => :object})
|
217
221
|
updated_data = updated_object.data
|
218
222
|
updated_data.should_not eql @data
|
219
223
|
updated_data.foo.should eql 'new val'
|
@@ -276,7 +280,7 @@ describe "JiakClient links" do
|
|
276
280
|
p_obj = JiakObject.new(:bucket => @p_bucket,
|
277
281
|
:key => p_name,
|
278
282
|
:data => p_data)
|
279
|
-
parent = @client.store(p_obj,:
|
283
|
+
parent = @client.store(p_obj,:return => :object)
|
280
284
|
p_link = JiakLink.new(@p_bucket,parent.key,'parent')
|
281
285
|
c_names.each do |c_name|
|
282
286
|
begin
|
@@ -286,7 +290,7 @@ describe "JiakClient links" do
|
|
286
290
|
c_obj = JiakObject.new(:bucket => @c_bucket,
|
287
291
|
:key => c_name,
|
288
292
|
:data => c_data)
|
289
|
-
child = @client.store(c_obj, :
|
293
|
+
child = @client.store(c_obj, :return => :object)
|
290
294
|
end
|
291
295
|
c_link = JiakLink.new(@c_bucket,child.key,'child')
|
292
296
|
child << p_link
|
@@ -37,6 +37,7 @@ describe "JiakObject" do
|
|
37
37
|
@object.should respond_to(:data,:data=)
|
38
38
|
@object.should respond_to(:links,:links=)
|
39
39
|
@object.should respond_to(:riak,:riak=)
|
40
|
+
@object.should respond_to(:local?)
|
40
41
|
@object.should respond_to(:<<)
|
41
42
|
@object.should respond_to(:==,:eql?)
|
42
43
|
@object.should respond_to(:to_jiak)
|
@@ -53,6 +54,7 @@ describe "JiakObject" do
|
|
53
54
|
jobj = JiakObject.new(:bucket => @bucket, :key => @key, :data => @data)
|
54
55
|
jobj.bucket.should eql @bucket
|
55
56
|
jobj.links.should be_empty
|
57
|
+
jobj.local?.should be true
|
56
58
|
end
|
57
59
|
|
58
60
|
it "should allow nil, missing, blank or empty key" do
|
@@ -159,6 +161,9 @@ describe "JiakObject" do
|
|
159
161
|
@object.riak = riak
|
160
162
|
@object.riak.should eql riak
|
161
163
|
|
164
|
+
@object.riak = nil
|
165
|
+
@object.riak.should be nil
|
166
|
+
|
162
167
|
bad_bucket = lambda {@object.bucket = 'bucket'}
|
163
168
|
bad_bucket.should raise_error(JiakObjectException,/Bucket/)
|
164
169
|
|
@@ -4,11 +4,11 @@ describe "JiakResource default" do
|
|
4
4
|
F1F2 = JiakDataHash.create(:f1,:f2)
|
5
5
|
class Rsrc # :nodoc:
|
6
6
|
include JiakResource
|
7
|
-
server
|
8
|
-
group
|
9
|
-
data_class
|
7
|
+
server 'http://localhost:8002/jiak/'
|
8
|
+
group 'group'
|
9
|
+
data_class F1F2
|
10
|
+
point_of_view
|
10
11
|
end
|
11
|
-
Rsrc.pov
|
12
12
|
|
13
13
|
before do
|
14
14
|
@server = 'http://localhost:8002/jiak/'
|
@@ -111,11 +111,11 @@ describe "JiakResource default class-level auto-post/auto-update" do
|
|
111
111
|
PersonData.keygen :name
|
112
112
|
class Person # :nodoc:
|
113
113
|
include JiakResource
|
114
|
-
server
|
115
|
-
group
|
116
|
-
data_class
|
114
|
+
server 'http://localhost:8002/jiak'
|
115
|
+
group 'people'
|
116
|
+
data_class PersonData
|
117
|
+
point_of_view
|
117
118
|
end
|
118
|
-
Person.pov
|
119
119
|
|
120
120
|
before do
|
121
121
|
@name = 'p default'
|
@@ -162,11 +162,11 @@ describe "JiakResource class auto-post" do
|
|
162
162
|
PersonData.keygen :name
|
163
163
|
class Person # :nodoc:
|
164
164
|
include JiakResource
|
165
|
-
server
|
166
|
-
group
|
167
|
-
data_class
|
165
|
+
server 'http://localhost:8002/jiak'
|
166
|
+
group 'people'
|
167
|
+
data_class PersonData
|
168
|
+
point_of_view
|
168
169
|
end
|
169
|
-
Person.pov
|
170
170
|
|
171
171
|
before do
|
172
172
|
@name = 'p auto-post'
|
@@ -242,13 +242,13 @@ describe "JiakResource class auto-update" do
|
|
242
242
|
DogData.keygen :name
|
243
243
|
class Dog # :nodoc:
|
244
244
|
include JiakResource
|
245
|
-
server
|
246
|
-
group
|
247
|
-
data_class
|
248
|
-
|
249
|
-
|
245
|
+
server 'http://localhost:8002/jiak'
|
246
|
+
group 'dogs'
|
247
|
+
data_class DogData
|
248
|
+
point_of_view
|
249
|
+
auto_post true
|
250
|
+
auto_update true
|
250
251
|
end
|
251
|
-
Dog.pov
|
252
252
|
|
253
253
|
before do
|
254
254
|
@pname = 'p auto-update'
|
@@ -339,13 +339,13 @@ describe "JiakResource simple" do
|
|
339
339
|
DogData.keygen :name
|
340
340
|
class Dog # :nodoc:
|
341
341
|
include JiakResource
|
342
|
-
server
|
343
|
-
group
|
344
|
-
data_class
|
345
|
-
|
346
|
-
|
342
|
+
server 'http://localhost:8002/jiak'
|
343
|
+
group 'dogs'
|
344
|
+
data_class DogData
|
345
|
+
point_of_view
|
346
|
+
auto_post true
|
347
|
+
auto_update true
|
347
348
|
end
|
348
|
-
Dog.pov
|
349
349
|
|
350
350
|
before do
|
351
351
|
@pname = 'p'
|
@@ -404,11 +404,11 @@ describe "JiakResource complex" do
|
|
404
404
|
class Parent # :nodoc:
|
405
405
|
include JiakResource
|
406
406
|
|
407
|
-
server
|
408
|
-
group
|
409
|
-
data_class
|
407
|
+
server 'http://localhost:8002/jiak'
|
408
|
+
group 'parents'
|
409
|
+
data_class PersonData
|
410
|
+
point_of_view
|
410
411
|
end
|
411
|
-
Parent.pov
|
412
412
|
|
413
413
|
Child = Parent.copy(:group => 'children')
|
414
414
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riakrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Rogers
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-10 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -133,7 +133,9 @@ test_files:
|
|
133
133
|
- examples/auto_update_links.rb
|
134
134
|
- examples/basic_client.rb
|
135
135
|
- examples/basic_resource.rb
|
136
|
+
- examples/bucket_schemas.rb
|
136
137
|
- examples/linked_resources.rb
|
137
138
|
- examples/links_only_pov.rb
|
138
139
|
- examples/multiple_pov.rb
|
140
|
+
- examples/rest_interaction.rb
|
139
141
|
- examples/ruby_json_data.rb
|