riakrest 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.rdoc +35 -25
- data/VERSION +1 -1
- data/examples/auto_manage_data.rb +51 -0
- data/examples/auto_update_links.rb +31 -14
- data/examples/basic_client.rb +33 -10
- data/examples/basic_resource.rb +29 -12
- data/examples/basic_resource_pov.rb +65 -0
- data/examples/buoy.rb +102 -0
- data/examples/buoy_pov.rb +46 -0
- data/examples/example_helper.rb +1 -0
- data/examples/linked_resources.rb +38 -70
- data/lib/riakrest/core/jiak_client.rb +56 -31
- data/lib/riakrest/core/jiak_data.rb +24 -14
- data/lib/riakrest/core/jiak_data_fields.rb +4 -4
- data/lib/riakrest/core/query_link.rb +13 -6
- data/lib/riakrest/resource/jiak_resource.rb +85 -71
- data/lib/riakrest/resource/jiak_resource_pov.rb +279 -0
- data/lib/riakrest.rb +3 -2
- data/spec/core/jiak_client_spec.rb +20 -5
- data/spec/resource/jiak_resource_spec.rb +111 -119
- metadata +11 -4
- data/examples/auto_update_data.rb +0 -38
@@ -4,7 +4,7 @@ describe "JiakResource default" do
|
|
4
4
|
class Rsrc # :nodoc:
|
5
5
|
include JiakResource
|
6
6
|
server SERVER_URI
|
7
|
-
|
7
|
+
attr_accessor :f1, :f2
|
8
8
|
end
|
9
9
|
|
10
10
|
before do
|
@@ -16,7 +16,7 @@ describe "JiakResource default" do
|
|
16
16
|
describe "class creation" do
|
17
17
|
it "should respond to" do
|
18
18
|
Rsrc.should respond_to(:server,:group)
|
19
|
-
Rsrc.should respond_to(:
|
19
|
+
Rsrc.should respond_to(:attr_reader,:attr,:attr_writer,:attr_accessor)
|
20
20
|
Rsrc.should respond_to(:params,:auto_update,:keys)
|
21
21
|
Rsrc.should respond_to(:schema,:push_schema,:server_schema?)
|
22
22
|
Rsrc.should respond_to(:post,:put,:get,:delete)
|
@@ -63,15 +63,8 @@ describe "JiakResource default" do
|
|
63
63
|
|
64
64
|
it "should have default settings" do
|
65
65
|
@rsrc.jiak.should be_a Struct
|
66
|
-
@rsrc.jiak.should respond_to(:object)
|
67
|
-
|
68
|
-
@rsrc.jiak.should respond_to(:auto_update)
|
69
|
-
|
70
|
-
@rsrc.jiak.bucket.should == @rsrc.jiak.object.bucket
|
71
|
-
@rsrc.jiak.key.should == @rsrc.jiak.object.key
|
72
|
-
@rsrc.jiak.data.should == @rsrc.jiak.object.data
|
73
|
-
@rsrc.jiak.links.should == @rsrc.jiak.object.links
|
74
|
-
|
66
|
+
@rsrc.jiak.should respond_to(:object,:auto_update)
|
67
|
+
|
75
68
|
@rsrc.jiak.object.should be_a JiakObject
|
76
69
|
@rsrc.jiak.object.bucket.should be_a JiakBucket
|
77
70
|
@rsrc.jiak.object.bucket.name.should eql @group
|
@@ -82,84 +75,83 @@ describe "JiakResource default" do
|
|
82
75
|
end
|
83
76
|
|
84
77
|
describe "JiakResource schema" do
|
85
|
-
class
|
78
|
+
class Person # :nodoc:
|
86
79
|
include JiakResource
|
87
80
|
server SERVER_URI
|
88
81
|
group 'schema'
|
89
|
-
|
82
|
+
attr_accessor :name, :age
|
90
83
|
keygen { name }
|
91
84
|
end
|
92
85
|
|
93
86
|
it "should have data schema" do
|
94
87
|
jiak_schema = JiakSchema.new([:name,:age])
|
95
|
-
|
88
|
+
Person.schema.should eql jiak_schema
|
96
89
|
end
|
97
90
|
|
98
91
|
it "should push/check server schema" do
|
99
|
-
|
100
|
-
|
101
|
-
People.server_schema?.should be true
|
92
|
+
Person.push_schema
|
93
|
+
Person.server_schema?.should be true
|
102
94
|
|
103
|
-
|
104
|
-
|
95
|
+
Person.push_schema(JiakSchema::WIDE_OPEN)
|
96
|
+
Person.server_schema?.should be false
|
105
97
|
end
|
106
98
|
end
|
107
99
|
|
108
100
|
describe "JiakResource default class-level auto-post/auto-update" do
|
109
|
-
class
|
101
|
+
class Person # :nodoc:
|
110
102
|
include JiakResource
|
111
103
|
server SERVER_URI
|
112
104
|
group 'people'
|
113
|
-
|
105
|
+
attr_accessor :name, :age
|
114
106
|
keygen { name }
|
115
107
|
end
|
116
108
|
|
117
109
|
before do
|
118
110
|
@name = 'p default'
|
119
|
-
@p =
|
111
|
+
@p = Person.new(:name => @name, :age => 10)
|
120
112
|
end
|
121
113
|
|
122
114
|
it "should create instance without posting" do
|
123
|
-
|
115
|
+
Person.auto_post?.should be false
|
124
116
|
|
125
|
-
|
117
|
+
Person.exist?(@name).should be false
|
126
118
|
@p.local?.should be true
|
127
119
|
@p.post
|
128
|
-
|
120
|
+
Person.get(@name).name.should eql @name
|
129
121
|
@p.local?.should be false
|
130
122
|
@p.delete
|
131
123
|
end
|
132
124
|
|
133
125
|
it "should change local data without updating" do
|
134
126
|
@p.post
|
135
|
-
|
127
|
+
Person.get(@name).age.should eql 10
|
136
128
|
@p.age = 12
|
137
|
-
|
129
|
+
Person.get(@name).age.should eql 10
|
138
130
|
@p.update
|
139
|
-
|
131
|
+
Person.get(@name).age.should eql 12
|
140
132
|
@p.delete
|
141
133
|
end
|
142
134
|
|
143
135
|
it "should check if resource is local and if it exists on server" do
|
144
136
|
name = 'p local'
|
145
|
-
p =
|
137
|
+
p = Person.new(:name => name)
|
146
138
|
p.local?.should be true
|
147
|
-
|
139
|
+
Person.exist?(name).should be false
|
148
140
|
|
149
141
|
p.post
|
150
142
|
p.local?.should be false
|
151
|
-
|
143
|
+
Person.exist?(name).should be true
|
152
144
|
|
153
145
|
p.delete
|
154
146
|
end
|
155
147
|
end
|
156
148
|
|
157
149
|
describe "JiakResource class auto-post" do
|
158
|
-
class
|
150
|
+
class Person # :nodoc:
|
159
151
|
include JiakResource
|
160
152
|
server SERVER_URI
|
161
153
|
group 'people'
|
162
|
-
|
154
|
+
attr_accessor :name, :age
|
163
155
|
keygen { name }
|
164
156
|
end
|
165
157
|
|
@@ -169,21 +161,21 @@ describe "JiakResource class auto-post" do
|
|
169
161
|
|
170
162
|
describe "false" do
|
171
163
|
before do
|
172
|
-
|
164
|
+
Person.auto_post false
|
173
165
|
end
|
174
166
|
|
175
167
|
it "should not auto-post, or auto-update a local object" do
|
176
|
-
|
168
|
+
Person.auto_post?.should be false
|
177
169
|
|
178
|
-
|
170
|
+
Person.exist?(@name).should be false
|
179
171
|
|
180
|
-
|
181
|
-
p =
|
172
|
+
Person.auto_update true
|
173
|
+
p = Person.new(:name => @name, :age => 10)
|
182
174
|
p.local?.should be true
|
183
175
|
p.age = 12
|
184
176
|
p.local?.should be true
|
185
177
|
|
186
|
-
q =
|
178
|
+
q = Person.new(:name => 'q', :age => 20)
|
187
179
|
|
188
180
|
link_to_local = lambda {p.link(q,'link')}
|
189
181
|
link_to_local.should raise_error(JiakResourceException,/local/)
|
@@ -198,11 +190,11 @@ describe "JiakResource class auto-post" do
|
|
198
190
|
p.post
|
199
191
|
p.local?.should be false
|
200
192
|
p.age.should be 12
|
201
|
-
|
202
|
-
p.query(
|
193
|
+
Person.get(@name).age.should be 12
|
194
|
+
p.query([Person,'link'])[0].should eql q
|
203
195
|
|
204
196
|
p.age = 10
|
205
|
-
|
197
|
+
Person.get(@name).age.should be 10
|
206
198
|
|
207
199
|
p.delete
|
208
200
|
q.delete
|
@@ -211,21 +203,21 @@ describe "JiakResource class auto-post" do
|
|
211
203
|
|
212
204
|
describe "true" do
|
213
205
|
before do
|
214
|
-
|
206
|
+
Person.auto_post true
|
215
207
|
end
|
216
208
|
|
217
209
|
it "should auto-post a new instance" do
|
218
|
-
|
210
|
+
Person.auto_post?.should be true
|
219
211
|
|
220
|
-
|
221
|
-
p =
|
222
|
-
|
212
|
+
Person.exist?(@name).should be false
|
213
|
+
p = Person.new(:name => @name, :age => 10)
|
214
|
+
Person.get(@name).name.should eql @name
|
223
215
|
p.delete
|
224
216
|
end
|
225
217
|
|
226
218
|
it "should reject auto-post of a new instance with an existing key" do
|
227
|
-
p =
|
228
|
-
duplicate_key = lambda {
|
219
|
+
p = Person.new(:name => @name, :age => 10)
|
220
|
+
duplicate_key = lambda {Person.new(:name => p.name, :age => 0)}
|
229
221
|
duplicate_key.should raise_error(JiakResourceException,/exist/)
|
230
222
|
p.delete
|
231
223
|
end
|
@@ -233,11 +225,11 @@ describe "JiakResource class auto-post" do
|
|
233
225
|
end
|
234
226
|
|
235
227
|
describe "JiakResource class auto-update" do
|
236
|
-
class
|
228
|
+
class Dog # :nodoc:
|
237
229
|
include JiakResource
|
238
230
|
server SERVER_URI
|
239
231
|
group 'dogs'
|
240
|
-
|
232
|
+
attr_accessor :name, :age
|
241
233
|
keygen { name }
|
242
234
|
auto_manage
|
243
235
|
end
|
@@ -246,92 +238,92 @@ describe "JiakResource class auto-update" do
|
|
246
238
|
@pname = 'p auto-update'
|
247
239
|
@c1name = 'c1 auto-update'
|
248
240
|
@c2name = 'c2 auto-update'
|
249
|
-
@p =
|
250
|
-
@c1 =
|
251
|
-
@c2 =
|
241
|
+
@p = Dog.new(:name => @pname, :age => 10)
|
242
|
+
@c1 = Dog.new(:name => @cname, :age => 4)
|
243
|
+
@c2 = Dog.new(:name => @cname, :age => 4)
|
252
244
|
end
|
253
245
|
|
254
246
|
after do
|
255
247
|
@p.delete
|
256
248
|
@c1.delete
|
257
249
|
@c2.delete
|
258
|
-
|
250
|
+
Dog.auto_update true
|
259
251
|
end
|
260
252
|
|
261
253
|
it "should auto-update local changes" do
|
262
|
-
|
254
|
+
Dog.get(@pname).age.should eql 10
|
263
255
|
@p.age = 12
|
264
|
-
|
256
|
+
Dog.get(@pname).age.should eql 12
|
265
257
|
|
266
|
-
|
258
|
+
Dog.get(@pname).name.should eql @pname
|
267
259
|
@p.name = @pname.upcase
|
268
|
-
|
260
|
+
Dog.get(@pname).name.should eql @pname.upcase
|
269
261
|
|
270
|
-
@p.query(
|
262
|
+
@p.query([Dog,'pup']).size.should eql 0
|
271
263
|
@p.link(@c1,'pup')
|
272
|
-
@p.query(
|
264
|
+
@p.query([Dog,'pup']).size.should eql 1
|
273
265
|
|
274
|
-
[@c1,@c2].each {|c| c.query(
|
266
|
+
[@c1,@c2].each {|c| c.query([Dog,'sibling']).size.should eql 0}
|
275
267
|
@c1.bi_link(@c2,'sibling')
|
276
|
-
[@c1,@c2].each {|c| c.query(
|
268
|
+
[@c1,@c2].each {|c| c.query([Dog,'sibling']).size.should eql 1}
|
277
269
|
end
|
278
270
|
|
279
271
|
it "should allow instance level override of class level auto-update true" do
|
280
272
|
@p.auto_update?.should be nil
|
281
273
|
|
282
|
-
|
274
|
+
Dog.get(@pname).age.should eql 10
|
283
275
|
@p.auto_update = false
|
284
276
|
@p.auto_update?.should be false
|
285
277
|
@p.age = 12
|
286
|
-
|
278
|
+
Dog.get(@pname).age.should eql 10
|
287
279
|
@p.update
|
288
|
-
|
280
|
+
Dog.get(@pname).age.should eql 12
|
289
281
|
|
290
|
-
[@c1,@c2].each {|c| c.query(
|
282
|
+
[@c1,@c2].each {|c| c.query([Dog,'sibling']).size.should eql 0}
|
291
283
|
@c2.auto_update = false
|
292
284
|
@c1.bi_link(@c2,'sibling')
|
293
|
-
@c1.query(
|
294
|
-
@c2.query(
|
285
|
+
@c1.query([Dog,'sibling']).size.should eql 1
|
286
|
+
@c2.query([Dog,'sibling']).size.should eql 0
|
295
287
|
end
|
296
288
|
|
297
289
|
it "should allow instance level override of class level auto-update false" do
|
298
|
-
|
290
|
+
Dog.auto_update false
|
299
291
|
|
300
|
-
|
292
|
+
Dog.get(@pname).age.should eql 10
|
301
293
|
@p.auto_update = true
|
302
294
|
@p.auto_update?.should be true
|
303
295
|
@p.age = 12
|
304
|
-
|
296
|
+
Dog.get(@pname).age.should eql 12
|
305
297
|
|
306
|
-
[@c1,@c2].each {|c| c.query(
|
298
|
+
[@c1,@c2].each {|c| c.query([Dog,'sibling']).size.should eql 0}
|
307
299
|
@c2.auto_update = true
|
308
300
|
@c1.bi_link(@c2,'sibling')
|
309
|
-
@c1.query(
|
310
|
-
@c2.query(
|
301
|
+
@c1.query([Dog,'sibling']).size.should eql 0
|
302
|
+
@c2.query([Dog,'sibling']).size.should eql 1
|
311
303
|
end
|
312
304
|
|
313
305
|
it "should allow instance level deferring back to class level" do
|
314
|
-
|
306
|
+
Dog.get(@pname).age.should eql 10
|
315
307
|
@p.auto_update = false
|
316
308
|
@p.age = 12
|
317
|
-
|
309
|
+
Dog.get(@pname).age.should eql 10
|
318
310
|
@p.update
|
319
|
-
|
311
|
+
Dog.get(@pname).age.should eql 12
|
320
312
|
|
321
313
|
@p.auto_update = nil
|
322
314
|
@p.auto_update?.should be nil
|
323
315
|
@p.age = 10
|
324
|
-
|
316
|
+
Dog.get(@pname).age.should eql 10
|
325
317
|
end
|
326
318
|
|
327
319
|
end
|
328
320
|
|
329
321
|
describe "JiakResource simple" do
|
330
|
-
class
|
322
|
+
class Dog # :nodoc:
|
331
323
|
include JiakResource
|
332
324
|
server SERVER_URI
|
333
325
|
group 'dogs'
|
334
|
-
|
326
|
+
attr_accessor :name, :age
|
335
327
|
keygen { name }
|
336
328
|
auto_manage
|
337
329
|
end
|
@@ -340,9 +332,9 @@ describe "JiakResource simple" do
|
|
340
332
|
@pname = 'p'
|
341
333
|
@c1name = 'c1'
|
342
334
|
@c2name = 'c2'
|
343
|
-
@p =
|
344
|
-
@c1 =
|
345
|
-
@c2 =
|
335
|
+
@p = Dog.new(:name => @pname, :age => 10)
|
336
|
+
@c1 = Dog.new(:name => @c1name, :age => 4)
|
337
|
+
@c2 = Dog.new(:name => @c2name, :age => 4)
|
346
338
|
end
|
347
339
|
|
348
340
|
after do
|
@@ -352,50 +344,49 @@ describe "JiakResource simple" do
|
|
352
344
|
end
|
353
345
|
|
354
346
|
it "should do basic interaction and single-step relationships" do
|
355
|
-
|
356
|
-
|
347
|
+
Dog.exist?(@pname).should be true
|
348
|
+
Dog.get(@pname).should eql @p
|
357
349
|
|
358
350
|
@p.name.should eql @pname
|
359
351
|
@p.age.should eql 10
|
360
352
|
|
361
353
|
@p.age = 11
|
362
|
-
@p =
|
354
|
+
@p = Dog.get(@pname)
|
363
355
|
@p.age.should eql 11
|
364
356
|
|
365
357
|
[@c1,@c2].each {|c| @p.link(c,'pup')}
|
366
|
-
pups = @p.query(
|
358
|
+
pups = @p.query([Dog,'pup'])
|
367
359
|
pups.size.should eql 2
|
368
360
|
same_elements = pups.map {|c| c.name}.same_elements?([@c1.name,@c2.name])
|
369
361
|
same_elements.should be true
|
370
362
|
|
371
363
|
@c1.bi_link(@c2,'sibling')
|
372
|
-
[@c1,@c2].each {|c| c.query(
|
373
|
-
@c1.query(
|
374
|
-
@c2.query(
|
364
|
+
[@c1,@c2].each {|c| c.query([Dog,'sibling']).size.should eql 1}
|
365
|
+
@c1.query([Dog,'sibling'])[0].should eql @c2
|
366
|
+
@c2.query([Dog,'sibling'])[0].should eql @c1
|
375
367
|
|
376
368
|
@c1.remove_link(@c2,'sibling')
|
377
|
-
@c1.query(
|
378
|
-
@c2.query(
|
369
|
+
@c1.query([Dog,'sibling']).size.should eql 0
|
370
|
+
@c2.query([Dog,'sibling']).size.should eql 1
|
379
371
|
|
380
372
|
[@c1,@c2].each {|c| c.link(@p,'parent')}
|
381
373
|
|
382
|
-
@c1.query(
|
383
|
-
@c2.query(
|
384
|
-
@c2.query(
|
385
|
-
@c2.query(
|
374
|
+
@c1.query([Dog,QueryLink::ANY]).size.should eql 1
|
375
|
+
@c2.query([Dog,QueryLink::ANY]).size.should eql 2
|
376
|
+
@c2.query([Dog,'sibling']).size.should eql 1
|
377
|
+
@c2.query([Dog,'parent']).size.should eql 1
|
386
378
|
end
|
387
379
|
end
|
388
380
|
|
389
381
|
describe "JiakResource complex" do
|
390
|
-
class
|
382
|
+
class Parent # :nodoc:
|
391
383
|
include JiakResource
|
392
384
|
server SERVER_URI
|
393
|
-
|
385
|
+
attr_accessor :name
|
394
386
|
keygen { name }
|
395
387
|
end
|
396
388
|
|
397
|
-
|
398
|
-
Children.group 'children'
|
389
|
+
(Child = Parent.dup).group 'child'
|
399
390
|
|
400
391
|
it "should do multi-step relationships" do
|
401
392
|
# relationships
|
@@ -416,12 +407,12 @@ describe "JiakResource complex" do
|
|
416
407
|
|
417
408
|
# store data and relationships
|
418
409
|
parent_children.each do |pname,cnames|
|
419
|
-
p =
|
410
|
+
p = Parent.new(:name => pname).post
|
420
411
|
cnames.each do |cname|
|
421
412
|
begin
|
422
|
-
c =
|
413
|
+
c = Child.get(cname)
|
423
414
|
rescue
|
424
|
-
c =
|
415
|
+
c = Child.new(:name => cname)
|
425
416
|
end
|
426
417
|
c.link(p,'parent')
|
427
418
|
c.put
|
@@ -430,13 +421,13 @@ describe "JiakResource complex" do
|
|
430
421
|
p.update
|
431
422
|
end
|
432
423
|
|
433
|
-
parents = parent_children.keys.map {|p|
|
434
|
-
children = child_parents.keys.map {|c|
|
424
|
+
parents = parent_children.keys.map {|p| Parent.get(p)}
|
425
|
+
children = child_parents.keys.map {|c| Child.get(c)}
|
435
426
|
c0,c1,c2,c3,c4 = children
|
436
427
|
|
437
428
|
# siblings
|
438
429
|
c0s,c1s,c2s,c3s,c4s = children.map do |c|
|
439
|
-
c.query(
|
430
|
+
c.query([Parent,'parent',Child,'child']).delete_if{|s| s.eql?(c)}
|
440
431
|
end
|
441
432
|
c0s.size.should eql 2
|
442
433
|
c1s.size.should eql 2
|
@@ -450,25 +441,26 @@ describe "JiakResource complex" do
|
|
450
441
|
same_elements.should be true
|
451
442
|
|
452
443
|
# c3's step-sibling's other parent?
|
453
|
-
c3sp = c3.query(
|
454
|
-
c3.query(
|
444
|
+
c3sp = c3.query([Parent,'parent',Child,'child',Parent,'parent'])
|
445
|
+
c3.query([Parent,'parent']).each {|p| c3sp.delete_if{|sp| p.eql?(sp)}}
|
455
446
|
c3sp[0].name.should eql parents[1].name
|
456
447
|
|
457
448
|
# add sibling links
|
458
|
-
|
449
|
+
Child.auto_update true
|
459
450
|
children.each do |c|
|
460
|
-
siblings =
|
451
|
+
siblings =
|
452
|
+
c.query([Parent,'parent',Child,'child']).delete_if{|s| s.eql?(c)}
|
461
453
|
siblings.each {|s| c.link(s,'sibling')}
|
462
454
|
end
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
455
|
+
sibling_query = [Child,'sibling']
|
456
|
+
c0.query(sibling_query).size.should eql 2
|
457
|
+
c1.query(sibling_query).size.should eql 2
|
458
|
+
c2.query(sibling_query).size.should eql 3
|
459
|
+
c3.query(sibling_query).size.should eql 1
|
460
|
+
c4.query(sibling_query).size.should eql 0
|
461
|
+
|
462
|
+
parents.each {|p| p.delete}
|
470
463
|
children.each {|c| c.delete}
|
471
464
|
end
|
472
465
|
end
|
473
466
|
|
474
|
-
# 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.1.
|
4
|
+
version: 0.1.5
|
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-12-11 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -88,10 +88,13 @@ files:
|
|
88
88
|
- README.rdoc
|
89
89
|
- Rakefile
|
90
90
|
- VERSION
|
91
|
-
- examples/
|
91
|
+
- examples/auto_manage_data.rb
|
92
92
|
- examples/auto_update_links.rb
|
93
93
|
- examples/basic_client.rb
|
94
94
|
- examples/basic_resource.rb
|
95
|
+
- examples/basic_resource_pov.rb
|
96
|
+
- examples/buoy.rb
|
97
|
+
- examples/buoy_pov.rb
|
95
98
|
- examples/example_helper.rb
|
96
99
|
- examples/linked_resources.rb
|
97
100
|
- lib/riakrest.rb
|
@@ -105,6 +108,7 @@ files:
|
|
105
108
|
- lib/riakrest/core/jiak_schema.rb
|
106
109
|
- lib/riakrest/core/query_link.rb
|
107
110
|
- lib/riakrest/resource/jiak_resource.rb
|
111
|
+
- lib/riakrest/resource/jiak_resource_pov.rb
|
108
112
|
- spec/core/exceptions_spec.rb
|
109
113
|
- spec/core/jiak_bucket_spec.rb
|
110
114
|
- spec/core/jiak_client_spec.rb
|
@@ -155,9 +159,12 @@ test_files:
|
|
155
159
|
- spec/resource/jiak_resource_spec.rb
|
156
160
|
- spec/riakrest_spec.rb
|
157
161
|
- spec/spec_helper.rb
|
158
|
-
- examples/
|
162
|
+
- examples/auto_manage_data.rb
|
159
163
|
- examples/auto_update_links.rb
|
160
164
|
- examples/basic_client.rb
|
161
165
|
- examples/basic_resource.rb
|
166
|
+
- examples/basic_resource_pov.rb
|
167
|
+
- examples/buoy.rb
|
168
|
+
- examples/buoy_pov.rb
|
162
169
|
- examples/example_helper.rb
|
163
170
|
- examples/linked_resources.rb
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/example_helper.rb'
|
2
|
-
|
3
|
-
class People
|
4
|
-
include JiakResource
|
5
|
-
server SERVER_URI
|
6
|
-
jattr_accessor :name, :age
|
7
|
-
keygen { name }
|
8
|
-
auto_manage
|
9
|
-
end
|
10
|
-
|
11
|
-
remy = People.new(:name => 'remy', :age => 10)
|
12
|
-
puts People.get('remy').name # => "remy"
|
13
|
-
|
14
|
-
remy.name = "Remy"
|
15
|
-
puts People.get('remy').name # => "Remy"
|
16
|
-
remy.age = 12
|
17
|
-
puts People.get('remy').age # => 12
|
18
|
-
|
19
|
-
People.auto_update false
|
20
|
-
remy.auto_update = true
|
21
|
-
puts People.get('remy').age # => 12
|
22
|
-
remy.age = 10
|
23
|
-
puts People.get('remy').age # => 10
|
24
|
-
|
25
|
-
People.auto_update true
|
26
|
-
remy.auto_update = false
|
27
|
-
remy.age = 12
|
28
|
-
puts People.get('remy').age # => 10
|
29
|
-
remy.update
|
30
|
-
puts People.get('remy').age # => 12
|
31
|
-
|
32
|
-
remy.auto_update = nil
|
33
|
-
remy.age = 10
|
34
|
-
puts People.get('remy').age # => 10
|
35
|
-
|
36
|
-
remy.delete
|
37
|
-
|
38
|
-
|