ruby-fs-stack 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -154,48 +154,6 @@ module Org::Familysearch::Ws::Familytree::V2::Schema
154
154
  relationships = self.send(g_command.to_sym)
155
155
  end
156
156
 
157
- # Overriding the Enunciate code because of a bug (parents, spouses, and children were not pluralized)
158
- # the json hash for this PersonRelationships
159
- def to_jaxb_json_hash
160
- _h = {}
161
- if !parents.nil?
162
- _ha = Array.new
163
- parents.each { | _item | _ha.push _item.to_jaxb_json_hash }
164
- _h['parents'] = _ha
165
- end
166
- if !spouses.nil?
167
- _ha = Array.new
168
- spouses.each { | _item | _ha.push _item.to_jaxb_json_hash }
169
- _h['spouses'] = _ha
170
- end
171
- if !children.nil?
172
- _ha = Array.new
173
- children.each { | _item | _ha.push _item.to_jaxb_json_hash }
174
- _h['children'] = _ha
175
- end
176
- return _h
177
- end
178
-
179
- # Overriding the Enunciate code because of a bug
180
- #initializes this PersonRelationships with a json hash
181
- def init_jaxb_json_hash(_o)
182
- if !_o['parents'].nil?
183
- @parents = Array.new
184
- _oa = _o['parents']
185
- _oa.each { | _item | @parents.push Org::Familysearch::Ws::Familytree::V2::Schema::Relationship.from_json(_item) }
186
- end
187
- if !_o['spouses'].nil?
188
- @spouses = Array.new
189
- _oa = _o['spouses']
190
- _oa.each { | _item | @spouses.push Org::Familysearch::Ws::Familytree::V2::Schema::Relationship.from_json(_item) }
191
- end
192
- if !_o['children'].nil?
193
- @children = Array.new
194
- _oa = _o['children']
195
- _oa.each { | _item | @children.push Org::Familysearch::Ws::Familytree::V2::Schema::Relationship.from_json(_item) }
196
- end
197
- end
198
-
199
157
  private
200
158
  def get_command(type)
201
159
  (type.to_s == 'child') ? 'children' : "#{type}s"
@@ -1,3 +1,4 @@
1
+ require 'uri'
1
2
  class FsUtils
2
3
 
3
4
  def self.querystring_from_hash(hash)
@@ -22,6 +23,6 @@ class FsUtils
22
23
  private
23
24
  def self.url_encode(string)
24
25
  # Taken from http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/156044
25
- string.gsub( /[^a-zA-Z0-9\-_\.!~*'()]/n ) {|x| sprintf('%%%02x', x[0]) }
26
+ URI.escape(string)
26
27
  end
27
28
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby-fs-stack}
8
- s.version = "0.5.2"
8
+ s.version = "0.5.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jimmy Zimmerman"]
12
- s.date = %q{2010-10-29}
12
+ s.date = %q{2010-12-31}
13
13
  s.description = %q{A library that enables you to read and update information with the new.familysearch.org API.}
14
14
  s.email = %q{jimmy.zimmerman@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -74,6 +74,7 @@ Gem::Specification.new do |s|
74
74
  "spec/ruby-fs-stack/familytree/json/person/relationship_read.js",
75
75
  "spec/ruby-fs-stack/familytree/json/person/relationship_update.js",
76
76
  "spec/ruby-fs-stack/familytree/json/person/spouse_read.js",
77
+ "spec/ruby-fs-stack/familytree/json/person/spouse_read_spouse.js",
77
78
  "spec/ruby-fs-stack/familytree/json/search.js",
78
79
  "spec/ruby-fs-stack/familytree/match_spec.rb",
79
80
  "spec/ruby-fs-stack/familytree/note_spec.rb",
@@ -86,6 +87,7 @@ Gem::Specification.new do |s|
86
87
  "spec/ruby-fs-stack/fs_utils_spec.rb",
87
88
  "spec/ruby-fs-stack/identity/communicator_spec.rb",
88
89
  "spec/ruby-fs-stack/identity/json/login.js",
90
+ "spec/ruby-fs-stack/json/fakeweb_expired_session.txt",
89
91
  "spec/ruby-fs-stack_spec.rb",
90
92
  "spec/spec_helper.rb"
91
93
  ]
@@ -470,7 +470,7 @@ describe FamilytreeV2::Communicator do
470
470
 
471
471
  # Create a payload to compare against
472
472
  ft = Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.from_json JSON.parse(@json)
473
- person = ft.persons.find{|p|p.id=='KWQS-BBQ'}
473
+ person = ft.persons.find{|p|p.requestedId=='KWQS-BBQ'}
474
474
  person.create_relationship :type => 'parent', :with => 'KWQS-BBR', :lineage => 'Biological'
475
475
  familytree = Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.new
476
476
  familytree.persons = [person]
@@ -487,7 +487,7 @@ describe FamilytreeV2::Communicator do
487
487
  @ft_v2_com.write_relationship 'KWQS-BBQ', :parent => 'KWQS-BBR', :lineage => 'Biological'
488
488
  end
489
489
 
490
- it "should create a new person with a relationship since it wasn't yet found" do
490
+ it "should not create a new person because it already exists" do
491
491
  @person.should_not_receive(:id=).with('KWQS-BBQ')
492
492
  @person.should_receive(:create_relationship).with(:type => 'parent', :with => 'KWQS-BBR', :lineage => 'Biological')
493
493
  @ft_v2_com.write_relationship 'KWQS-BBQ', :parent => 'KWQS-BBR', :lineage => 'Biological'
@@ -1 +1,54 @@
1
- {"users":null,"notes":null,"citations":null,"persons":[{"properties":null,"id":"KWQS-BBQ","version":null,"identifiers":null,"personId":null,"relationships":{"children":null,"spouses":null,"parents":[{"properties":null,"id":"KWQS-BBR","version":"1","personId":null,"assertions":null,"requestedId":"KWQQ-6DL","personas":null,"tempId":null}]},"assertions":null,"parents":null,"changes":null,"families":null,"requestedId":"KWQS-BBQ","personas":null,"tempId":null}],"contributors":null,"personas":null,"searches":null,"matches":null,"pedigrees":null,"properties":null,"status":null,"version":"2.0.20090729.4570","statusCode":200,"statusMessage":"OK","deprecated":null}
1
+ {
2
+ "persons": [{
3
+ "properties": null,
4
+ "identifiers": null,
5
+ "assertions": null,
6
+ "personas": null,
7
+ "relationships": {
8
+ "parent": [{
9
+ "properties": null,
10
+ "assertions": {
11
+ "characteristics": [{
12
+ "value": {
13
+ "type": "Lineage",
14
+ "date": null,
15
+ "place": null,
16
+ "detail": null,
17
+ "lineage": "Biological",
18
+ "id": null,
19
+ "title": null
20
+ },
21
+ "id": null,
22
+ "version": null,
23
+ "tempId": null,
24
+ "action": null,
25
+ "disposition": null,
26
+ "notes": null,
27
+ "citations": null,
28
+ "modified": null,
29
+ "selected": null,
30
+ "modifiable": null
31
+ }]
32
+ },
33
+ "id": "KWQS-BBR",
34
+ "version": "5",
35
+ "tempId": null,
36
+ "requestedId": "KWQS-BBR",
37
+ "personId": null
38
+ }]
39
+ },
40
+ "changes": null,
41
+ "id": "KWQS-BBQ",
42
+ "version": null,
43
+ "tempId": null,
44
+ "requestedId": "KWQS-BBQ",
45
+ "personId": null
46
+ }],
47
+ "searches": null,
48
+ "matches": null,
49
+ "status": null,
50
+ "version": "2.7.20101206.6263",
51
+ "statusCode": 200,
52
+ "statusMessage": "OK",
53
+ "deprecated": null
54
+ }
@@ -0,0 +1,509 @@
1
+ {
2
+ "persons": [{
3
+ "properties": null,
4
+ "identifiers": null,
5
+ "assertions": null,
6
+ "personas": null,
7
+ "relationships": {
8
+ "spouse": [{
9
+ "properties": null,
10
+ "assertions": {
11
+ "events": [{
12
+ "value": {
13
+ "type": "Marriage",
14
+ "date": {
15
+ "original": "18471104",
16
+ "normalized": "4 November 1847",
17
+ "gedcom": "4 November 1847",
18
+ "numeric": "1847-11-04",
19
+ "astro": {
20
+ "earliest": "2395970",
21
+ "latest": "2395970"
22
+ },
23
+ "selected": false
24
+ },
25
+ "description": null,
26
+ "place": {
27
+ "original": "Calne, Wiltshire, England",
28
+ "normalized": {
29
+ "value": "Calne, Wiltshire, England",
30
+ "id": "3489599",
31
+ "version": "3.5.0"
32
+ },
33
+ "selected": false
34
+ },
35
+ "id": null,
36
+ "title": null
37
+ },
38
+ "id": null,
39
+ "version": null,
40
+ "tempId": null,
41
+ "action": null,
42
+ "disposition": null,
43
+ "notes": null,
44
+ "citations": null,
45
+ "modified": null,
46
+ "selected": null,
47
+ "modifiable": null
48
+ },
49
+ {
50
+ "value": {
51
+ "type": "Marriage",
52
+ "date": {
53
+ "original": "04 Nov 1846",
54
+ "normalized": "4 November 1846",
55
+ "gedcom": "4 November 1847",
56
+ "numeric": "1847-11-04",
57
+ "astro": {
58
+ "earliest": "2395970",
59
+ "latest": "2395970"
60
+ },
61
+ "selected": false
62
+ },
63
+ "description": null,
64
+ "place": {
65
+ "original": "Calne, Wiltshire, England",
66
+ "normalized": {
67
+ "value": "Calne, Wiltshire, England",
68
+ "id": "3489599",
69
+ "version": "3.5.0"
70
+ },
71
+ "selected": false
72
+ },
73
+ "id": null,
74
+ "title": null
75
+ },
76
+ "id": null,
77
+ "version": null,
78
+ "tempId": null,
79
+ "action": null,
80
+ "disposition": null,
81
+ "notes": null,
82
+ "citations": null,
83
+ "modified": null,
84
+ "selected": null,
85
+ "modifiable": null
86
+ },
87
+ {
88
+ "value": {
89
+ "type": "Marriage",
90
+ "date": {
91
+ "original": "4 Nov 1847",
92
+ "normalized": "4 November 1847",
93
+ "gedcom": "4 November 1847",
94
+ "numeric": "1847-11-04",
95
+ "astro": {
96
+ "earliest": "2395970",
97
+ "latest": "2395970"
98
+ },
99
+ "selected": false
100
+ },
101
+ "description": null,
102
+ "place": {
103
+ "original": "Calne, Wiltshire, England",
104
+ "normalized": {
105
+ "value": "Calne, Wiltshire, England",
106
+ "id": "3489599",
107
+ "version": "3.5.0"
108
+ },
109
+ "selected": false
110
+ },
111
+ "id": null,
112
+ "title": null
113
+ },
114
+ "id": null,
115
+ "version": null,
116
+ "tempId": null,
117
+ "action": null,
118
+ "disposition": null,
119
+ "notes": null,
120
+ "citations": null,
121
+ "modified": null,
122
+ "selected": null,
123
+ "modifiable": null
124
+ },
125
+ {
126
+ "value": {
127
+ "type": "Marriage",
128
+ "date": {
129
+ "original": "4 NOV 1847",
130
+ "normalized": "4 November 1847",
131
+ "gedcom": "4 November 1847",
132
+ "numeric": "1847-11-04",
133
+ "astro": {
134
+ "earliest": "2395970",
135
+ "latest": "2395970"
136
+ },
137
+ "selected": false
138
+ },
139
+ "description": null,
140
+ "place": {
141
+ "original": "Calne,Wiltshire,England",
142
+ "normalized": {
143
+ "value": "Calne, Wiltshire, England",
144
+ "id": "3489599",
145
+ "version": "3.5.0"
146
+ },
147
+ "selected": false
148
+ },
149
+ "id": null,
150
+ "title": null
151
+ },
152
+ "id": null,
153
+ "version": null,
154
+ "tempId": null,
155
+ "action": null,
156
+ "disposition": null,
157
+ "notes": null,
158
+ "citations": null,
159
+ "modified": null,
160
+ "selected": null,
161
+ "modifiable": null
162
+ },
163
+ {
164
+ "value": {
165
+ "type": "Marriage",
166
+ "date": {
167
+ "original": "4 Nov 1847",
168
+ "normalized": "4 November 1847",
169
+ "gedcom": "4 November 1847",
170
+ "numeric": "1847-11-04",
171
+ "astro": {
172
+ "earliest": "2395970",
173
+ "latest": "2395970"
174
+ },
175
+ "selected": false
176
+ },
177
+ "description": null,
178
+ "place": {
179
+ "original": "Calne,Wiltshire,Eng",
180
+ "normalized": {
181
+ "value": "Calne, Wiltshire, England",
182
+ "id": "3489599",
183
+ "version": "3.5.0"
184
+ },
185
+ "selected": false
186
+ },
187
+ "id": null,
188
+ "title": null
189
+ },
190
+ "id": null,
191
+ "version": null,
192
+ "tempId": null,
193
+ "action": null,
194
+ "disposition": null,
195
+ "notes": null,
196
+ "citations": null,
197
+ "modified": null,
198
+ "selected": null,
199
+ "modifiable": null
200
+ },
201
+ {
202
+ "value": {
203
+ "type": "Marriage",
204
+ "date": {
205
+ "original": "4 Nov 1847",
206
+ "normalized": "4 November 1847",
207
+ "gedcom": "4 November 1847",
208
+ "numeric": "1847-11-04",
209
+ "astro": {
210
+ "earliest": "2395970",
211
+ "latest": "2395970"
212
+ },
213
+ "selected": false
214
+ },
215
+ "description": null,
216
+ "place": {
217
+ "original": "Calne, W., England",
218
+ "normalized": {
219
+ "value": "Calne, Wiltshire, England",
220
+ "id": "3489599",
221
+ "version": "3.5.0"
222
+ },
223
+ "selected": false
224
+ },
225
+ "id": null,
226
+ "title": null
227
+ },
228
+ "id": null,
229
+ "version": null,
230
+ "tempId": null,
231
+ "action": null,
232
+ "disposition": null,
233
+ "notes": null,
234
+ "citations": null,
235
+ "modified": null,
236
+ "selected": null,
237
+ "modifiable": null
238
+ },
239
+ {
240
+ "value": {
241
+ "type": "Marriage",
242
+ "date": {
243
+ "original": " 4 NOV 1847",
244
+ "normalized": "4 November 1847",
245
+ "gedcom": "4 November 1847",
246
+ "numeric": "1847-11-04",
247
+ "astro": {
248
+ "earliest": "2395970",
249
+ "latest": "2395970"
250
+ },
251
+ "selected": false
252
+ },
253
+ "description": null,
254
+ "place": {
255
+ "original": "Calne, Wiltshire, England",
256
+ "normalized": {
257
+ "value": "Calne, Wiltshire, England",
258
+ "id": "3489599",
259
+ "version": "3.5.0"
260
+ },
261
+ "selected": false
262
+ },
263
+ "id": null,
264
+ "title": null
265
+ },
266
+ "id": null,
267
+ "version": null,
268
+ "tempId": null,
269
+ "action": null,
270
+ "disposition": null,
271
+ "notes": null,
272
+ "citations": null,
273
+ "modified": null,
274
+ "selected": null,
275
+ "modifiable": null
276
+ },
277
+ {
278
+ "value": {
279
+ "type": "Marriage",
280
+ "date": {
281
+ "original": "4 Nov 1847",
282
+ "normalized": "4 November 1847",
283
+ "gedcom": "4 November 1847",
284
+ "numeric": "1847-11-04",
285
+ "astro": {
286
+ "earliest": "2395970",
287
+ "latest": "2395970"
288
+ },
289
+ "selected": false
290
+ },
291
+ "description": null,
292
+ "place": {
293
+ "original": "Calne,Wiltshire,England",
294
+ "normalized": {
295
+ "value": "Calne, Wiltshire, England",
296
+ "id": "3489599",
297
+ "version": "3.5.0"
298
+ },
299
+ "selected": false
300
+ },
301
+ "id": null,
302
+ "title": null
303
+ },
304
+ "id": null,
305
+ "version": null,
306
+ "tempId": null,
307
+ "action": null,
308
+ "disposition": null,
309
+ "notes": null,
310
+ "citations": null,
311
+ "modified": null,
312
+ "selected": null,
313
+ "modifiable": null
314
+ },
315
+ {
316
+ "value": {
317
+ "type": "Marriage",
318
+ "date": {
319
+ "original": "4 NOV 1847",
320
+ "normalized": "4 November 1847",
321
+ "gedcom": "4 November 1847",
322
+ "numeric": "1847-11-04",
323
+ "astro": {
324
+ "earliest": "2395970",
325
+ "latest": "2395970"
326
+ },
327
+ "selected": false
328
+ },
329
+ "description": null,
330
+ "place": {
331
+ "original": "Calne, Wiltshire, England",
332
+ "normalized": {
333
+ "value": "Calne, Wiltshire, England",
334
+ "id": "6258858",
335
+ "version": "4.4.0.5m"
336
+ },
337
+ "selected": false
338
+ },
339
+ "id": null,
340
+ "title": null
341
+ },
342
+ "id": null,
343
+ "version": null,
344
+ "tempId": null,
345
+ "action": null,
346
+ "disposition": null,
347
+ "notes": null,
348
+ "citations": null,
349
+ "modified": null,
350
+ "selected": null,
351
+ "modifiable": null
352
+ },
353
+ {
354
+ "value": {
355
+ "type": "Marriage",
356
+ "date": {
357
+ "original": "<1849>",
358
+ "normalized": "1849",
359
+ "gedcom": "1849",
360
+ "numeric": "1849",
361
+ "astro": {
362
+ "earliest": "2396394",
363
+ "latest": "2396758"
364
+ },
365
+ "selected": false
366
+ },
367
+ "description": null,
368
+ "place": {
369
+ "original": "Calne, Wilts, Eng",
370
+ "normalized": {
371
+ "value": "Calne, Wiltshire, England",
372
+ "id": "3489599",
373
+ "version": "3.5.0"
374
+ },
375
+ "selected": false
376
+ },
377
+ "id": null,
378
+ "title": null
379
+ },
380
+ "id": null,
381
+ "version": null,
382
+ "tempId": null,
383
+ "action": null,
384
+ "disposition": null,
385
+ "notes": null,
386
+ "citations": null,
387
+ "modified": null,
388
+ "selected": null,
389
+ "modifiable": null
390
+ },
391
+ {
392
+ "value": {
393
+ "type": "Marriage",
394
+ "date": {
395
+ "original": "21 FEB 1876",
396
+ "normalized": "21 February 1876",
397
+ "gedcom": "21 February 1876",
398
+ "numeric": "1876-02-21",
399
+ "astro": {
400
+ "earliest": "2406306",
401
+ "latest": "2406306"
402
+ },
403
+ "selected": false
404
+ },
405
+ "description": null,
406
+ "place": {
407
+ "original": "Salt Lake City,Salt Lake,Utah",
408
+ "normalized": {
409
+ "value": "Salt Lake City, Salt Lake, Utah, United States",
410
+ "id": "1347957",
411
+ "version": "3.5.0"
412
+ },
413
+ "selected": false
414
+ },
415
+ "id": null,
416
+ "title": null
417
+ },
418
+ "id": null,
419
+ "version": null,
420
+ "tempId": null,
421
+ "action": null,
422
+ "disposition": null,
423
+ "notes": null,
424
+ "citations": null,
425
+ "modified": null,
426
+ "selected": null,
427
+ "modifiable": null
428
+ },
429
+ {
430
+ "value": {
431
+ "type": "Marriage",
432
+ "date": null,
433
+ "description": null,
434
+ "place": {
435
+ "original": "England",
436
+ "normalized": {
437
+ "value": "England",
438
+ "id": "1986340",
439
+ "version": "3.5.0"
440
+ },
441
+ "selected": false
442
+ },
443
+ "id": null,
444
+ "title": null
445
+ },
446
+ "id": null,
447
+ "version": null,
448
+ "tempId": null,
449
+ "action": null,
450
+ "disposition": null,
451
+ "notes": null,
452
+ "citations": null,
453
+ "modified": null,
454
+ "selected": null,
455
+ "modifiable": null
456
+ },
457
+ {
458
+ "value": {
459
+ "type": "Divorce",
460
+ "date": {
461
+ "original": "1912",
462
+ "normalized": "1912",
463
+ "gedcom": "1912",
464
+ "numeric": "1912-01-01",
465
+ "astro": {
466
+ "earliest": "2406306",
467
+ "latest": "2406306"
468
+ },
469
+ "selected": false
470
+ },
471
+ "description": null,
472
+ "place": null,
473
+ "id": null,
474
+ "title": null
475
+ },
476
+ "id": null,
477
+ "version": null,
478
+ "tempId": null,
479
+ "action": null,
480
+ "disposition": null,
481
+ "notes": null,
482
+ "citations": null,
483
+ "modified": null,
484
+ "selected": null,
485
+ "modifiable": null
486
+ }]
487
+ },
488
+ "id": "KWNJ-DJM",
489
+ "version": "3",
490
+ "tempId": null,
491
+ "requestedId": "KWNJ-DJM",
492
+ "personId": null
493
+ }]
494
+ },
495
+ "changes": null,
496
+ "id": "KWNJ-DN1",
497
+ "version": null,
498
+ "tempId": null,
499
+ "requestedId": "KWNJ-DN1",
500
+ "personId": null
501
+ }],
502
+ "searches": null,
503
+ "matches": null,
504
+ "status": null,
505
+ "version": "2.7.20101206.6263",
506
+ "statusCode": 200,
507
+ "statusMessage": "OK",
508
+ "deprecated": null
509
+ }