riakrest 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/History.txt +4 -1
- data/LICENSE +22 -0
- data/README.rdoc +52 -26
- data/Rakefile +55 -24
- data/VERSION +1 -0
- data/examples/auto_update_data.rb +1 -7
- data/examples/auto_update_links.rb +8 -8
- data/examples/basic_client.rb +8 -10
- data/examples/basic_resource.rb +16 -18
- data/examples/json_data_resource.rb +5 -0
- data/examples/linked_resource.rb +32 -27
- data/examples/links_only.rb +38 -0
- data/lib/riakrest/core/jiak_client.rb +5 -0
- data/lib/riakrest/core/jiak_data.rb +19 -13
- data/lib/riakrest/core/query_link.rb +1 -1
- data/lib/riakrest/resource/jiak_resource.rb +135 -54
- data/lib/riakrest/version.rb +1 -1
- data/lib/riakrest.rb +33 -30
- data/spec/resource/jiak_resource_spec.rb +388 -34
- metadata +56 -29
- data/Manifest.txt +0 -41
- data/PostInstall.txt +0 -2
- data/riakrest.gemspec +0 -38
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/tasks/rspec.rake +0 -21
@@ -1,38 +1,36 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
2
|
|
3
|
-
describe "JiakResource" do
|
3
|
+
describe "JiakResource default" do
|
4
4
|
F1F2 = JiakDataHash.create(:f1,:f2)
|
5
|
-
class Rsrc
|
5
|
+
class Rsrc # :nodoc:
|
6
6
|
include JiakResource
|
7
|
-
server 'http://localhost:8002/jiak'
|
7
|
+
server 'http://localhost:8002/jiak/'
|
8
8
|
group 'group'
|
9
9
|
data_class F1F2
|
10
10
|
end
|
11
11
|
|
12
12
|
before do
|
13
|
-
@server = 'http://localhost:8002/jiak'
|
13
|
+
@server = 'http://localhost:8002/jiak/'
|
14
14
|
@group = 'group'
|
15
15
|
@data_class = F1F2
|
16
16
|
end
|
17
17
|
|
18
|
-
describe "class" do
|
18
|
+
describe "class creation" do
|
19
19
|
it "should respond to" do
|
20
20
|
Rsrc.should respond_to(:server,:group,:data_class)
|
21
21
|
Rsrc.should respond_to(:params,:auto_update,:schema,:keys)
|
22
22
|
Rsrc.should respond_to(:allowed,:required,:readable,:writable,:readwrite)
|
23
23
|
Rsrc.should respond_to(:point_of_view,:pov,:point_of_view?,:pov?)
|
24
24
|
Rsrc.should respond_to(:post,:put,:get,:delete)
|
25
|
-
Rsrc.should respond_to(:refresh,:update)
|
26
|
-
Rsrc.should respond_to(:link,:bi_link,:walk)
|
25
|
+
Rsrc.should respond_to(:refresh,:update,:exist?)
|
26
|
+
Rsrc.should respond_to(:link,:bi_link,:query,:walk)
|
27
27
|
Rsrc.should respond_to(:new,:copy)
|
28
28
|
Rsrc.should respond_to(:auto_post,:auto_update,:auto_post?,:auto_update?)
|
29
29
|
|
30
30
|
Rsrc.jiak.should respond_to(:server,:uri,:group,:data,:bucket,:auto_update)
|
31
|
-
|
32
|
-
|
33
31
|
end
|
34
32
|
|
35
|
-
it "
|
33
|
+
it "should have specified settings" do
|
36
34
|
Rsrc.params.should be_empty
|
37
35
|
Rsrc.auto_update?.should be false
|
38
36
|
Rsrc.schema.should eql F1F2.schema
|
@@ -48,9 +46,28 @@ describe "JiakResource" do
|
|
48
46
|
Rsrc.jiak.bucket.data_class.should == F1F2
|
49
47
|
Rsrc.jiak.auto_update.should be false
|
50
48
|
end
|
49
|
+
|
50
|
+
it "should copy with defaults and overrides" do
|
51
|
+
Rsrc_default = Rsrc.copy
|
52
|
+
Rsrc_default.jiak.uri.should eql @server
|
53
|
+
Rsrc_default.jiak.group.should eql @group
|
54
|
+
Rsrc_default.jiak.data.should == F1F2
|
55
|
+
Rsrc_default.auto_post?.should == Rsrc.auto_post?
|
56
|
+
Rsrc_default.auto_update?.should == Rsrc.auto_update?
|
57
|
+
|
58
|
+
DiffData = JiakDataHash.create
|
59
|
+
Rsrc_diff = Rsrc.copy(:server => 'scopy', :group => 'gcopy',
|
60
|
+
:data_class => DiffData,
|
61
|
+
:auto_post => true, :auto_update => true)
|
62
|
+
Rsrc_diff.jiak.uri.should eql 'scopy'
|
63
|
+
Rsrc_diff.jiak.group.should eql 'gcopy'
|
64
|
+
Rsrc_diff.jiak.data.should == DiffData
|
65
|
+
Rsrc_diff.auto_post?.should be true
|
66
|
+
Rsrc_diff.auto_update?.should be true
|
67
|
+
end
|
51
68
|
end
|
52
69
|
|
53
|
-
describe "instance" do
|
70
|
+
describe "instance creation" do
|
54
71
|
before do
|
55
72
|
@rsrc = Rsrc.new
|
56
73
|
end
|
@@ -58,71 +75,408 @@ describe "JiakResource" do
|
|
58
75
|
it "should respond to" do
|
59
76
|
@rsrc.should respond_to(:jiak,:jiak=)
|
60
77
|
@rsrc.should respond_to(:auto_update=,:auto_update?)
|
61
|
-
@rsrc.should respond_to(:post,:put,:
|
62
|
-
@rsrc.should respond_to(:
|
78
|
+
@rsrc.should respond_to(:post,:put,:delete)
|
79
|
+
@rsrc.should respond_to(:update,:push,:refresh,:pull)
|
80
|
+
@rsrc.should respond_to(:local?)
|
81
|
+
@rsrc.should respond_to(:link,:bi_link,:query,:walk)
|
63
82
|
@rsrc.should respond_to(:eql?,:==)
|
83
|
+
|
84
|
+
@rsrc.should respond_to(:f1,:f2)
|
64
85
|
end
|
65
86
|
|
66
87
|
it "should have default settings" do
|
67
88
|
@rsrc.jiak.should be_a Struct
|
68
|
-
@rsrc.jiak.should respond_to(:
|
89
|
+
@rsrc.jiak.should respond_to(:object)
|
90
|
+
@rsrc.jiak.should respond_to(:bucket,:key,:data,:links)
|
91
|
+
@rsrc.jiak.should respond_to(:auto_update)
|
92
|
+
|
93
|
+
@rsrc.jiak.bucket.should == @rsrc.jiak.object.bucket
|
94
|
+
@rsrc.jiak.key.should == @rsrc.jiak.object.key
|
95
|
+
@rsrc.jiak.data.should == @rsrc.jiak.object.data
|
96
|
+
@rsrc.jiak.links.should == @rsrc.jiak.object.links
|
69
97
|
|
70
|
-
@rsrc.jiak.
|
71
|
-
@rsrc.jiak.
|
72
|
-
@rsrc.jiak.
|
73
|
-
@rsrc.jiak.
|
98
|
+
@rsrc.jiak.object.should be_a JiakObject
|
99
|
+
@rsrc.jiak.object.bucket.should be_a JiakBucket
|
100
|
+
@rsrc.jiak.object.bucket.name.should eql @group
|
101
|
+
@rsrc.jiak.object.bucket.data_class.should == F1F2
|
74
102
|
|
75
103
|
@rsrc.jiak.auto_update.should be_nil
|
76
104
|
end
|
77
105
|
end
|
78
106
|
end
|
79
107
|
|
80
|
-
describe "JiakResource default class-level auto-post" do
|
108
|
+
describe "JiakResource default class-level auto-post/auto-update" do
|
81
109
|
PersonData = JiakDataHash.create(:name,:age)
|
82
110
|
PersonData.keygen :name
|
83
|
-
class Person
|
111
|
+
class Person # :nodoc:
|
84
112
|
include JiakResource
|
85
113
|
server 'http://localhost:8002/jiak'
|
86
114
|
group 'people'
|
87
115
|
data_class PersonData
|
88
116
|
end
|
89
117
|
|
118
|
+
before do
|
119
|
+
@name = 'p default'
|
120
|
+
@p = Person.new(:name => @name, :age => 10)
|
121
|
+
end
|
122
|
+
|
90
123
|
it "should create instance without posting" do
|
91
124
|
Person.auto_post?.should be false
|
125
|
+
|
126
|
+
Person.exist?(@name).should be false
|
127
|
+
@p.local?.should be true
|
128
|
+
@p.post
|
129
|
+
Person.get(@name).name.should eql @name
|
130
|
+
@p.local?.should be false
|
131
|
+
@p.delete
|
132
|
+
end
|
92
133
|
|
93
|
-
|
94
|
-
p
|
134
|
+
it "should change local data without updating" do
|
135
|
+
@p.post
|
136
|
+
Person.get(@name).age.should eql 10
|
137
|
+
@p.age = 12
|
138
|
+
Person.get(@name).age.should eql 10
|
139
|
+
@p.update
|
140
|
+
Person.get(@name).age.should eql 12
|
141
|
+
@p.delete
|
142
|
+
end
|
95
143
|
|
96
|
-
|
97
|
-
|
144
|
+
it "should check if resource is local and if it exists on server" do
|
145
|
+
name = 'p local'
|
146
|
+
p = Person.new(:name => name)
|
147
|
+
p.local?.should be true
|
148
|
+
Person.exist?(name).should be false
|
98
149
|
|
99
150
|
p.post
|
100
|
-
|
151
|
+
p.local?.should be false
|
152
|
+
Person.exist?(name).should be true
|
101
153
|
|
102
154
|
p.delete
|
103
155
|
end
|
104
156
|
end
|
105
157
|
|
106
|
-
describe "JiakResource class
|
158
|
+
describe "JiakResource class auto-post" do
|
107
159
|
PersonData = JiakDataHash.create(:name,:age)
|
108
160
|
PersonData.keygen :name
|
109
|
-
class Person
|
161
|
+
class Person # :nodoc:
|
110
162
|
include JiakResource
|
111
163
|
server 'http://localhost:8002/jiak'
|
112
164
|
group 'people'
|
113
165
|
data_class PersonData
|
166
|
+
end
|
167
|
+
|
168
|
+
before do
|
169
|
+
@name = 'p auto-post'
|
170
|
+
end
|
171
|
+
|
172
|
+
describe "false" do
|
173
|
+
before do
|
174
|
+
Person.auto_post false
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should not auto-post, or auto-update a local object" do
|
178
|
+
Person.auto_post?.should be false
|
179
|
+
|
180
|
+
Person.exist?(@name).should be false
|
181
|
+
|
182
|
+
Person.auto_update true
|
183
|
+
p = Person.new(:name => @name, :age => 10)
|
184
|
+
p.local?.should be true
|
185
|
+
p.age = 12
|
186
|
+
p.local?.should be true
|
187
|
+
|
188
|
+
q = Person.new(:name => 'q', :age => 20)
|
189
|
+
|
190
|
+
link_to_local = lambda {p.link(q,'link')}
|
191
|
+
link_to_local.should raise_error(JiakResourceException,/local/)
|
192
|
+
q.post
|
193
|
+
|
194
|
+
q.local?.should be false
|
195
|
+
|
196
|
+
p.link(q,'link')
|
197
|
+
p.local?.should be true
|
198
|
+
p.jiak.object.links.size.should be 1
|
199
|
+
|
200
|
+
p.post
|
201
|
+
p.local?.should be false
|
202
|
+
p.age.should be 12
|
203
|
+
Person.get(@name).age.should be 12
|
204
|
+
p.query(Person,'link')[0].should eql q
|
205
|
+
|
206
|
+
p.age = 10
|
207
|
+
Person.get(@name).age.should be 10
|
208
|
+
|
209
|
+
p.delete
|
210
|
+
q.delete
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe "true" do
|
215
|
+
before do
|
216
|
+
Person.auto_post true
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should auto-post a new instance" do
|
220
|
+
Person.auto_post?.should be true
|
221
|
+
|
222
|
+
Person.exist?(@name).should be false
|
223
|
+
p = Person.new(:name => @name, :age => 10)
|
224
|
+
Person.get(@name).name.should eql @name
|
225
|
+
p.delete
|
226
|
+
end
|
227
|
+
|
228
|
+
it "should reject auto-post of a new instance with an existing key" do
|
229
|
+
p = Person.new(:name => @name, :age => 10)
|
230
|
+
duplicate_key = lambda {Person.new(:name => p.name, :age => 0)}
|
231
|
+
duplicate_key.should raise_error(JiakResourceException,/exist/)
|
232
|
+
p.delete
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe "JiakResource class auto-update" do
|
238
|
+
DogData = JiakDataHash.create(:name,:age)
|
239
|
+
DogData.keygen :name
|
240
|
+
class Dog # :nodoc:
|
241
|
+
include JiakResource
|
242
|
+
server 'http://localhost:8002/jiak'
|
243
|
+
group 'dogs'
|
244
|
+
data_class DogData
|
114
245
|
auto_post true
|
246
|
+
auto_update true
|
247
|
+
end
|
248
|
+
|
249
|
+
before do
|
250
|
+
@pname = 'p auto-update'
|
251
|
+
@c1name = 'c1 auto-update'
|
252
|
+
@c2name = 'c2 auto-update'
|
253
|
+
@p = Dog.new(:name => @pname, :age => 10)
|
254
|
+
@c1 = Dog.new(:name => @cname, :age => 4)
|
255
|
+
@c2 = Dog.new(:name => @cname, :age => 4)
|
256
|
+
end
|
257
|
+
|
258
|
+
after do
|
259
|
+
@p.delete
|
260
|
+
@c1.delete
|
261
|
+
@c2.delete
|
262
|
+
Dog.auto_update true
|
115
263
|
end
|
116
264
|
|
117
|
-
it "should auto-
|
118
|
-
|
265
|
+
it "should auto-update local changes" do
|
266
|
+
Dog.get(@pname).age.should eql 10
|
267
|
+
@p.age = 12
|
268
|
+
Dog.get(@pname).age.should eql 12
|
269
|
+
|
270
|
+
Dog.get(@pname).name.should eql @pname
|
271
|
+
@p.name = @pname.upcase
|
272
|
+
Dog.get(@pname).name.should eql @pname.upcase
|
273
|
+
|
274
|
+
@p.query(Dog,'pup').size.should eql 0
|
275
|
+
@p.link(@c1,'pup')
|
276
|
+
@p.query(Dog,'pup').size.should eql 1
|
277
|
+
|
278
|
+
[@c1,@c2].each {|c| c.query(Dog,'sibling').size.should eql 0}
|
279
|
+
@c1.bi_link(@c2,'sibling')
|
280
|
+
[@c1,@c2].each {|c| c.query(Dog,'sibling').size.should eql 1}
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should allow instance level override of class level auto-update true" do
|
284
|
+
@p.auto_update?.should be nil
|
119
285
|
|
120
|
-
|
121
|
-
p =
|
122
|
-
|
123
|
-
p.
|
286
|
+
Dog.get(@pname).age.should eql 10
|
287
|
+
@p.auto_update = false
|
288
|
+
@p.auto_update?.should be false
|
289
|
+
@p.age = 12
|
290
|
+
Dog.get(@pname).age.should eql 10
|
291
|
+
@p.update
|
292
|
+
Dog.get(@pname).age.should eql 12
|
293
|
+
|
294
|
+
[@c1,@c2].each {|c| c.query(Dog,'sibling').size.should eql 0}
|
295
|
+
@c2.auto_update = false
|
296
|
+
@c1.bi_link(@c2,'sibling')
|
297
|
+
@c1.query(Dog,'sibling').size.should eql 1
|
298
|
+
@c2.query(Dog,'sibling').size.should eql 0
|
299
|
+
end
|
300
|
+
|
301
|
+
it "should allow instance level override of class level auto-update false" do
|
302
|
+
Dog.auto_update false
|
303
|
+
|
304
|
+
Dog.get(@pname).age.should eql 10
|
305
|
+
@p.auto_update = true
|
306
|
+
@p.auto_update?.should be true
|
307
|
+
@p.age = 12
|
308
|
+
Dog.get(@pname).age.should eql 12
|
309
|
+
|
310
|
+
[@c1,@c2].each {|c| c.query(Dog,'sibling').size.should eql 0}
|
311
|
+
@c2.auto_update = true
|
312
|
+
@c1.bi_link(@c2,'sibling')
|
313
|
+
@c1.query(Dog,'sibling').size.should eql 0
|
314
|
+
@c2.query(Dog,'sibling').size.should eql 1
|
315
|
+
end
|
316
|
+
|
317
|
+
it "should allow instance level deferring back to class level" do
|
318
|
+
Dog.get(@pname).age.should eql 10
|
319
|
+
@p.auto_update = false
|
320
|
+
@p.age = 12
|
321
|
+
Dog.get(@pname).age.should eql 10
|
322
|
+
@p.update
|
323
|
+
Dog.get(@pname).age.should eql 12
|
324
|
+
|
325
|
+
@p.auto_update = nil
|
326
|
+
@p.auto_update?.should be nil
|
327
|
+
@p.age = 10
|
328
|
+
Dog.get(@pname).age.should eql 10
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
|
333
|
+
describe "JiakResource simple" do
|
334
|
+
DogData = JiakDataHash.create(:name,:age)
|
335
|
+
DogData.keygen :name
|
336
|
+
class Dog # :nodoc:
|
337
|
+
include JiakResource
|
338
|
+
server 'http://localhost:8002/jiak'
|
339
|
+
group 'dogs'
|
340
|
+
data_class DogData
|
341
|
+
auto_post true
|
342
|
+
auto_update true
|
343
|
+
end
|
344
|
+
|
345
|
+
before do
|
346
|
+
@pname = 'p'
|
347
|
+
@c1name = 'c1'
|
348
|
+
@c2name = 'c2'
|
349
|
+
@p = Dog.new(:name => @pname, :age => 10)
|
350
|
+
@c1 = Dog.new(:name => @c1name, :age => 4)
|
351
|
+
@c2 = Dog.new(:name => @c2name, :age => 4)
|
352
|
+
end
|
353
|
+
|
354
|
+
after do
|
355
|
+
@p.delete
|
356
|
+
@c1.delete
|
357
|
+
@c2.delete
|
358
|
+
end
|
359
|
+
|
360
|
+
it "should do basic interaction and single-step relationships" do
|
361
|
+
Dog.exist?(@pname).should be true
|
362
|
+
Dog.get(@pname).should eql @p
|
363
|
+
|
364
|
+
@p.name.should eql @pname
|
365
|
+
@p.age.should eql 10
|
366
|
+
|
367
|
+
@p.age = 11
|
368
|
+
@p = Dog.get(@pname)
|
369
|
+
@p.age.should eql 11
|
370
|
+
|
371
|
+
[@c1,@c2].each {|c| @p.link(c,'pup')}
|
372
|
+
pups = @p.query(Dog,'pup')
|
373
|
+
pups.size.should eql 2
|
374
|
+
same_elements = pups.map {|c| c.name}.same_elements?([@c1.name,@c2.name])
|
375
|
+
same_elements.should be true
|
376
|
+
|
377
|
+
@c1.bi_link(@c2,'sibling')
|
378
|
+
[@c1,@c2].each {|c| c.query(Dog,'sibling').size.should eql 1}
|
379
|
+
@c1.query(Dog,'sibling')[0].should eql @c2
|
380
|
+
@c2.query(Dog,'sibling')[0].should eql @c1
|
381
|
+
|
382
|
+
@c1.remove_link(@c2,'sibling')
|
383
|
+
@c1.query(Dog,'sibling').size.should eql 0
|
384
|
+
@c2.query(Dog,'sibling').size.should eql 1
|
385
|
+
|
386
|
+
[@c1,@c2].each {|c| c.link(@p,'parent')}
|
387
|
+
|
388
|
+
@c1.query(Dog).size.should eql 1
|
389
|
+
@c2.query(Dog).size.should eql 2
|
390
|
+
@c2.query(Dog,'sibling').size.should eql 1
|
391
|
+
@c2.query(Dog,'parent').size.should eql 1
|
124
392
|
end
|
125
393
|
end
|
126
394
|
|
395
|
+
describe "JiakResource complex" do
|
396
|
+
PersonData = JiakDataHash.create(:name)
|
397
|
+
PersonData.keygen :name
|
398
|
+
|
399
|
+
class Parent # :nodoc:
|
400
|
+
include JiakResource
|
401
|
+
|
402
|
+
server 'http://localhost:8002/jiak'
|
403
|
+
group 'parents'
|
404
|
+
data_class PersonData
|
405
|
+
end
|
406
|
+
Child = Parent.copy(:group => 'children')
|
407
|
+
|
408
|
+
it "should do multi-step relationships" do
|
409
|
+
# relationships
|
410
|
+
parent_children = {
|
411
|
+
'p0' => ['c0'],
|
412
|
+
'p1' => ['c0','c1','c2'],
|
413
|
+
'p2' => ['c2','c3'],
|
414
|
+
'p3' => ['c3'],
|
415
|
+
'p4' => ['c4']
|
416
|
+
}
|
417
|
+
# invert relationships
|
418
|
+
child_parents = parent_children.inject({}) do |build, (p,cs)|
|
419
|
+
cs.each do |c|
|
420
|
+
build[c] ? build[c] << p : build[c] = [p]
|
421
|
+
end
|
422
|
+
build
|
423
|
+
end
|
424
|
+
|
425
|
+
# store data and relationships
|
426
|
+
parent_children.each do |pname,cnames|
|
427
|
+
p = Parent.new(:name => pname).post
|
428
|
+
cnames.each do |cname|
|
429
|
+
begin
|
430
|
+
c = Child.get(cname)
|
431
|
+
rescue
|
432
|
+
c = Child.new(:name => cname)
|
433
|
+
end
|
434
|
+
c.link(p,'parent')
|
435
|
+
c.put
|
436
|
+
p.link(c,'child')
|
437
|
+
end
|
438
|
+
p.update
|
439
|
+
end
|
440
|
+
|
441
|
+
parents = parent_children.keys.map {|p| Parent.get(p)}
|
442
|
+
children = child_parents.keys.map {|c| Child.get(c)}
|
443
|
+
c0,c1,c2,c3,c4 = children
|
444
|
+
|
445
|
+
# siblings
|
446
|
+
c0s,c1s,c2s,c3s,c4s = children.map do |c|
|
447
|
+
c.query(Parent,'parent',Child,'child').delete_if{|s| s.eql?(c)}
|
448
|
+
end
|
449
|
+
c0s.size.should eql 2
|
450
|
+
c1s.size.should eql 2
|
451
|
+
c2s.size.should eql 3
|
452
|
+
c3s.size.should eql 1
|
453
|
+
c4s.size.should eql 0
|
454
|
+
|
455
|
+
# check c2 siblings
|
456
|
+
c2s_names = [c0.name,c1.name,c3.name]
|
457
|
+
same_elements = c2s.map {|c| c.name}.same_elements?(c2s_names)
|
458
|
+
same_elements.should be true
|
459
|
+
|
460
|
+
# c3's step-sibling's other parent?
|
461
|
+
c3sp = c3.query(Parent,'parent',Child,'child',Parent,'parent')
|
462
|
+
c3.query(Parent,'parent').each {|p| c3sp.delete_if{|sp| p.eql?(sp)}}
|
463
|
+
c3sp[0].name.should eql parents[1].name
|
464
|
+
|
465
|
+
# add sibling links
|
466
|
+
Child.auto_update true
|
467
|
+
children.each do |c|
|
468
|
+
siblings = c.query(Parent,'parent',Child,'child').delete_if{|s| s.eql?(c)}
|
469
|
+
siblings.each {|s| c.link(s,'sibling')}
|
470
|
+
end
|
471
|
+
c0.query(Child,'sibling').size.should eql 2
|
472
|
+
c1.query(Child,'sibling').size.should eql 2
|
473
|
+
c2.query(Child,'sibling').size.should eql 3
|
474
|
+
c3.query(Child,'sibling').size.should eql 1
|
475
|
+
c4.query(Child,'sibling').size.should eql 0
|
476
|
+
|
477
|
+
parents.each {|p| p.delete}
|
478
|
+
children.each {|c| c.delete}
|
479
|
+
end
|
480
|
+
end
|
127
481
|
|
128
|
-
# CxINC Many
|
482
|
+
# CxINC Many more tests to go
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Rogers
|
@@ -9,47 +9,62 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-31 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: rest-client
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rest-client
|
17
27
|
type: :development
|
18
28
|
version_requirement:
|
19
29
|
version_requirements: !ruby/object:Gem::Requirement
|
20
30
|
requirements:
|
21
31
|
- - ">="
|
22
32
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
33
|
+
version: 1.0.0
|
24
34
|
version:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
-
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.2.9
|
44
|
+
version:
|
45
|
+
description: " RiakRest provides structured, RESTful interaction with\n the HTTP/JSON interface of a Riak[http://riak.basho.com] document data\n store. RiakRest provides two levels of interaction: Core Client and\n Resource. Core Client works at the Jiak level and exposes Jiak\n internals. JiakResource is an abstraction built on top of the Core Client\n that gives a true RESTful feel.\n"
|
46
|
+
email: paul@dingosky.com
|
33
47
|
executables: []
|
34
48
|
|
35
49
|
extensions: []
|
36
50
|
|
37
51
|
extra_rdoc_files:
|
38
|
-
-
|
39
|
-
-
|
40
|
-
- PostInstall.txt
|
52
|
+
- LICENSE
|
53
|
+
- README.rdoc
|
41
54
|
files:
|
55
|
+
- .gitignore
|
42
56
|
- History.txt
|
43
|
-
-
|
44
|
-
- PostInstall.txt
|
57
|
+
- LICENSE
|
45
58
|
- README.rdoc
|
46
59
|
- Rakefile
|
60
|
+
- VERSION
|
47
61
|
- examples/auto_update_data.rb
|
48
62
|
- examples/auto_update_links.rb
|
49
63
|
- examples/basic_client.rb
|
50
64
|
- examples/basic_resource.rb
|
51
65
|
- examples/json_data_resource.rb
|
52
66
|
- examples/linked_resource.rb
|
67
|
+
- examples/links_only.rb
|
53
68
|
- examples/multiple_resources.rb
|
54
69
|
- lib/riakrest.rb
|
55
70
|
- lib/riakrest/core/exceptions.rb
|
@@ -63,10 +78,6 @@ files:
|
|
63
78
|
- lib/riakrest/data/jiak_data_hash.rb
|
64
79
|
- lib/riakrest/resource/jiak_resource.rb
|
65
80
|
- lib/riakrest/version.rb
|
66
|
-
- riakrest.gemspec
|
67
|
-
- script/console
|
68
|
-
- script/destroy
|
69
|
-
- script/generate
|
70
81
|
- spec/core/exceptions_spec.rb
|
71
82
|
- spec/core/jiak_bucket_spec.rb
|
72
83
|
- spec/core/jiak_client_spec.rb
|
@@ -79,15 +90,13 @@ files:
|
|
79
90
|
- spec/riakrest_spec.rb
|
80
91
|
- spec/spec.opts
|
81
92
|
- spec/spec_helper.rb
|
82
|
-
- tasks/rspec.rake
|
83
93
|
has_rdoc: true
|
84
94
|
homepage: http://github.com/wcpr/riakrest
|
85
95
|
licenses: []
|
86
96
|
|
87
|
-
post_install_message:
|
97
|
+
post_install_message:
|
88
98
|
rdoc_options:
|
89
|
-
- --
|
90
|
-
- README.rdoc
|
99
|
+
- --charset=UTF-8
|
91
100
|
require_paths:
|
92
101
|
- lib
|
93
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -104,10 +113,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
113
|
version:
|
105
114
|
requirements: []
|
106
115
|
|
107
|
-
rubyforge_project:
|
116
|
+
rubyforge_project:
|
108
117
|
rubygems_version: 1.3.5
|
109
118
|
signing_key:
|
110
119
|
specification_version: 3
|
111
|
-
summary: RiakRest provides structured, RESTful interaction with a Riak document store
|
112
|
-
test_files:
|
113
|
-
|
120
|
+
summary: RiakRest provides structured, RESTful interaction with a Riak document store.
|
121
|
+
test_files:
|
122
|
+
- spec/core/exceptions_spec.rb
|
123
|
+
- spec/core/jiak_bucket_spec.rb
|
124
|
+
- spec/core/jiak_client_spec.rb
|
125
|
+
- spec/core/jiak_link_spec.rb
|
126
|
+
- spec/core/jiak_object_spec.rb
|
127
|
+
- spec/core/jiak_schema_spec.rb
|
128
|
+
- spec/core/query_link_spec.rb
|
129
|
+
- spec/data/jiak_data_hash_spec.rb
|
130
|
+
- spec/resource/jiak_resource_spec.rb
|
131
|
+
- spec/riakrest_spec.rb
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
- examples/auto_update_data.rb
|
134
|
+
- examples/auto_update_links.rb
|
135
|
+
- examples/basic_client.rb
|
136
|
+
- examples/basic_resource.rb
|
137
|
+
- examples/json_data_resource.rb
|
138
|
+
- examples/linked_resource.rb
|
139
|
+
- examples/links_only.rb
|
140
|
+
- examples/multiple_resources.rb
|
data/Manifest.txt
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
PostInstall.txt
|
4
|
-
README.rdoc
|
5
|
-
Rakefile
|
6
|
-
examples/auto_update_data.rb
|
7
|
-
examples/auto_update_links.rb
|
8
|
-
examples/basic_client.rb
|
9
|
-
examples/basic_resource.rb
|
10
|
-
examples/json_data_resource.rb
|
11
|
-
examples/linked_resource.rb
|
12
|
-
examples/multiple_resources.rb
|
13
|
-
lib/riakrest.rb
|
14
|
-
lib/riakrest/core/exceptions.rb
|
15
|
-
lib/riakrest/core/jiak_bucket.rb
|
16
|
-
lib/riakrest/core/jiak_client.rb
|
17
|
-
lib/riakrest/core/jiak_data.rb
|
18
|
-
lib/riakrest/core/jiak_link.rb
|
19
|
-
lib/riakrest/core/jiak_object.rb
|
20
|
-
lib/riakrest/core/jiak_schema.rb
|
21
|
-
lib/riakrest/core/query_link.rb
|
22
|
-
lib/riakrest/data/jiak_data_hash.rb
|
23
|
-
lib/riakrest/resource/jiak_resource.rb
|
24
|
-
lib/riakrest/version.rb
|
25
|
-
riakrest.gemspec
|
26
|
-
script/console
|
27
|
-
script/destroy
|
28
|
-
script/generate
|
29
|
-
spec/core/exceptions_spec.rb
|
30
|
-
spec/core/jiak_bucket_spec.rb
|
31
|
-
spec/core/jiak_client_spec.rb
|
32
|
-
spec/core/jiak_link_spec.rb
|
33
|
-
spec/core/jiak_object_spec.rb
|
34
|
-
spec/core/jiak_schema_spec.rb
|
35
|
-
spec/core/query_link_spec.rb
|
36
|
-
spec/data/jiak_data_hash_spec.rb
|
37
|
-
spec/resource/jiak_resource_spec.rb
|
38
|
-
spec/riakrest_spec.rb
|
39
|
-
spec/spec.opts
|
40
|
-
spec/spec_helper.rb
|
41
|
-
tasks/rspec.rake
|
data/PostInstall.txt
DELETED