ruby-fs-stack 0.4.0 → 0.4.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/README.rdoc +16 -1
- data/VERSION +1 -1
- data/lib/ruby-fs-stack/familytree.rb +91 -4
- data/ruby-fs-stack.gemspec +6 -2
- data/spec/familytree_v2/familytree_communicator_spec.rb +89 -0
- data/spec/familytree_v2/json/note_create_response.js +1 -0
- data/spec/familytree_v2/json/person/relationship_read.js +1 -1
- data/spec/familytree_v2/json/person/spouse_read.js +1 -0
- data/spec/familytree_v2/note_spec.rb +55 -0
- data/spec/familytree_v2/person_spec.rb +39 -0
- metadata +6 -2
data/README.rdoc
CHANGED
@@ -110,7 +110,22 @@ or for the pure Ruby implementation
|
|
110
110
|
# you must set both the mother and the father summary unless you want a single parent as the summary parents.
|
111
111
|
person.select_mother_summary "KWQS-MOM"
|
112
112
|
person.select_father_summary "KWQS-DAD"
|
113
|
-
communicator.save_person person
|
113
|
+
communicator.familytree_v2.save_person person
|
114
|
+
|
115
|
+
=== Adding notes to an assertion
|
116
|
+
|
117
|
+
# assuming you know the assertion value ID that you want to create a note on
|
118
|
+
note = communicator.familytree_v2.write_note :personId => 'KWQS-BBQ', :assertionId => '60000021', :text => "This is my note text."
|
119
|
+
note.id #=> 'ZnMtZnQucC5LVzNCLU5NRzpwLjE0MDAwMDAwNDIyOjQwMDAwM29nMlpWOTgxOVpCWWs4RjAwMA=='
|
120
|
+
|
121
|
+
# As soon as this bug is fixed, https://issues.devnet.familysearch.org/issues/show/149, it you can write
|
122
|
+
# notes on relationship assertions
|
123
|
+
marriage_note = communicator.familytree_v2.write_note :spouseIds => ['KWQS-BBQ','KWQS-BBR'], :assertionId => '700000001', :text => "This is my note."
|
124
|
+
|
125
|
+
lineage_note = communicator.familytree_v2.write_note :parentIds => ['KWQS-BBQ'], :childId => 'KWQS-BBZ', :assertionId => '700000001', :text => "This is my note."
|
126
|
+
|
127
|
+
# To add a "Person Note" as seen in the new FamilySearch web application, attach the note to an exists assertion
|
128
|
+
# You find these by doing a person read with the :exists => 'all' option.
|
114
129
|
|
115
130
|
== RDoc
|
116
131
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
@@ -192,16 +192,42 @@ module FamilytreeV2
|
|
192
192
|
r_type = get_relationship_type(options)
|
193
193
|
with_id = options[r_type.to_sym]
|
194
194
|
url = "#{Base}person/#{base_id}/#{r_type}/#{with_id}"
|
195
|
+
options.reject!{|k,v| k.to_s == 'spouse'}
|
195
196
|
url += add_querystring(options)
|
196
197
|
res = @fs_communicator.get(url)
|
197
198
|
familytree = Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.from_json JSON.parse(res.body)
|
198
|
-
person = familytree.persons.find{|p|p.
|
199
|
+
person = familytree.persons.find{|p|p.requestedId == base_id}
|
199
200
|
return person
|
200
201
|
rescue RubyFsStack::NotFound
|
201
202
|
return nil
|
202
203
|
end
|
203
204
|
end
|
204
205
|
|
206
|
+
# Writes a note attached to the value ID of the specific person or relationship.
|
207
|
+
#
|
208
|
+
# ====Params
|
209
|
+
# * <tt>options</tt> - Options for the note including the following:
|
210
|
+
# * <tt>:personId</tt> - the person ID if attaching to a person assertion.
|
211
|
+
# * <tt>:spouseIds</tt> - an Array of spouse IDs if creating a note attached to a spouse
|
212
|
+
# relationship assertion.
|
213
|
+
# * <tt>:parentIds</tt> - an Array of parent IDs if creating a note attached to a parent
|
214
|
+
# relationship assertion. If creating a note for a child-parent or parent-child
|
215
|
+
# relationship, you will need only one parent ID in the array along with a :childId option.
|
216
|
+
# * <tt>:childId</tt> - a child ID.
|
217
|
+
# * <tt>:text</tt> - the text of the note (required).
|
218
|
+
# * <tt>:assertionId</tt> - the valueId of the assertion you are attaching this note to.
|
219
|
+
#
|
220
|
+
def write_note(options)
|
221
|
+
url = "#{Base}note"
|
222
|
+
note = Org::Familysearch::Ws::Familytree::V2::Schema::Note.new
|
223
|
+
note.build(options)
|
224
|
+
familytree = Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.new
|
225
|
+
familytree.notes = [note]
|
226
|
+
res = @fs_communicator.post(url,familytree.to_json)
|
227
|
+
familytree = Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.from_json JSON.parse(res.body)
|
228
|
+
return familytree.notes.first
|
229
|
+
end
|
230
|
+
|
205
231
|
# Combines person into a new person
|
206
232
|
#
|
207
233
|
# ====Params
|
@@ -227,7 +253,7 @@ module FamilytreeV2
|
|
227
253
|
end
|
228
254
|
|
229
255
|
def add_querystring(options)
|
230
|
-
params = options.reject{|k,v| ['parent','child','
|
256
|
+
params = options.reject{|k,v| ['parent','child','lineage','event'].include? k.to_s }
|
231
257
|
(params.empty?) ? '' : "?" + FsUtils.querystring_from_hash(params)
|
232
258
|
end
|
233
259
|
end
|
@@ -773,6 +799,11 @@ module Org::Familysearch::Ws::Familytree::V2::Schema
|
|
773
799
|
death
|
774
800
|
end
|
775
801
|
|
802
|
+
# This should only be called on a person containing relationships
|
803
|
+
def marriages(for_person)
|
804
|
+
select_spouse_events('Marriage',for_person)
|
805
|
+
end
|
806
|
+
|
776
807
|
# Add an event with type of Birth
|
777
808
|
#
|
778
809
|
# ====Params
|
@@ -855,7 +886,7 @@ module Org::Familysearch::Ws::Familytree::V2::Schema
|
|
855
886
|
add_parents!
|
856
887
|
couple = parents[0] || ParentsReference.new
|
857
888
|
couple.select_parent(person_id,'Female')
|
858
|
-
parents
|
889
|
+
parents[0] = couple
|
859
890
|
end
|
860
891
|
|
861
892
|
# Select the father for the summary view. This should be called on a Person record that
|
@@ -878,7 +909,7 @@ module Org::Familysearch::Ws::Familytree::V2::Schema
|
|
878
909
|
add_parents!
|
879
910
|
couple = parents[0] || ParentsReference.new
|
880
911
|
couple.select_parent(person_id,'Male')
|
881
|
-
parents
|
912
|
+
parents[0] = couple
|
882
913
|
end
|
883
914
|
|
884
915
|
# Select the spouse for the summary view. This should be called on a Person record that
|
@@ -1053,6 +1084,15 @@ module Org::Familysearch::Ws::Familytree::V2::Schema
|
|
1053
1084
|
end
|
1054
1085
|
end
|
1055
1086
|
|
1087
|
+
def select_spouse_events(type,for_person)
|
1088
|
+
spouse = relationships.spouses.find{|s|s.requestedId=for_person}
|
1089
|
+
if spouse.assertions && spouse.assertions.events
|
1090
|
+
spouse.assertions.events.select{|e| e.value.type == type}
|
1091
|
+
else
|
1092
|
+
[]
|
1093
|
+
end
|
1094
|
+
end
|
1095
|
+
|
1056
1096
|
def select_ordinances(type)
|
1057
1097
|
if assertions && assertions.ordinances
|
1058
1098
|
assertions.ordinances.select{|e| e.value.type == type}
|
@@ -1100,4 +1140,51 @@ module Org::Familysearch::Ws::Familytree::V2::Schema
|
|
1100
1140
|
parents.find{|p|p.gender == 'Female'}
|
1101
1141
|
end
|
1102
1142
|
end
|
1143
|
+
|
1144
|
+
class Note
|
1145
|
+
|
1146
|
+
#Builds out the elements needed for the note.
|
1147
|
+
# ====Params
|
1148
|
+
# * <tt>options</tt> - Options for the note including the following:
|
1149
|
+
# * <tt>:personId</tt> - the person ID if attaching to a person assertion.
|
1150
|
+
# * <tt>:spouseIds</tt> - an Array of spouse IDs if creating a note attached to a spouse
|
1151
|
+
# relationship assertion.
|
1152
|
+
# * <tt>:parentIds</tt> - an Array of parent IDs if creating a note attached to a parent
|
1153
|
+
# relationship assertion. If creating a note for a child-parent or parent-child
|
1154
|
+
# relationship, you will need only one parent ID in the array along with a :childId option.
|
1155
|
+
# * <tt>:childId</tt> - a child ID.
|
1156
|
+
# * <tt>:text</tt> - the text of the note (required).
|
1157
|
+
# * <tt>:assertionId</tt> - the valueId of the assertion you are attaching this note to.
|
1158
|
+
def build(options)
|
1159
|
+
if spouseIds = options[:spouseIds]
|
1160
|
+
self.spouses = spouseIds.collect do |id|
|
1161
|
+
s = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
|
1162
|
+
s.id = id
|
1163
|
+
s
|
1164
|
+
end
|
1165
|
+
end
|
1166
|
+
if parentIds = options[:parentIds]
|
1167
|
+
self.parents = parentIds.collect do |id|
|
1168
|
+
p = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
|
1169
|
+
p.id = id
|
1170
|
+
p
|
1171
|
+
end
|
1172
|
+
end
|
1173
|
+
if personId = options[:personId]
|
1174
|
+
self.person = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
|
1175
|
+
self.person.id = personId
|
1176
|
+
end
|
1177
|
+
if childId = options[:childId]
|
1178
|
+
self.child = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
|
1179
|
+
self.child.id = childId
|
1180
|
+
end
|
1181
|
+
if assertionId = options[:assertionId]
|
1182
|
+
self.assertion = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
|
1183
|
+
self.assertion.id = assertionId
|
1184
|
+
end
|
1185
|
+
if text = options[:text]
|
1186
|
+
self.text = text
|
1187
|
+
end
|
1188
|
+
end
|
1189
|
+
end
|
1103
1190
|
end
|
data/ruby-fs-stack.gemspec
CHANGED
@@ -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.4.
|
8
|
+
s.version = "0.4.2"
|
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-01-
|
12
|
+
s.date = %q{2010-01-18}
|
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 = [
|
@@ -43,6 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
"spec/familytree_v2/json/combine_request.js",
|
44
44
|
"spec/familytree_v2/json/combine_response.js",
|
45
45
|
"spec/familytree_v2/json/match_KW3B-NNM.js",
|
46
|
+
"spec/familytree_v2/json/note_create_response.js",
|
46
47
|
"spec/familytree_v2/json/person/KJ86-3VD_all.js",
|
47
48
|
"spec/familytree_v2/json/person/KJ86-3VD_version.js",
|
48
49
|
"spec/familytree_v2/json/person/multiple_version_read.js",
|
@@ -50,8 +51,10 @@ Gem::Specification.new do |s|
|
|
50
51
|
"spec/familytree_v2/json/person/relationship_not_found.js",
|
51
52
|
"spec/familytree_v2/json/person/relationship_read.js",
|
52
53
|
"spec/familytree_v2/json/person/relationship_update.js",
|
54
|
+
"spec/familytree_v2/json/person/spouse_read.js",
|
53
55
|
"spec/familytree_v2/json/search.js",
|
54
56
|
"spec/familytree_v2/match_results_spec.rb",
|
57
|
+
"spec/familytree_v2/note_spec.rb",
|
55
58
|
"spec/familytree_v2/person_spec.rb",
|
56
59
|
"spec/familytree_v2/search_results_spec.rb",
|
57
60
|
"spec/fixtures/fakeweb_response.txt",
|
@@ -71,6 +74,7 @@ Gem::Specification.new do |s|
|
|
71
74
|
"spec/communicator_spec.rb",
|
72
75
|
"spec/familytree_v2/familytree_communicator_spec.rb",
|
73
76
|
"spec/familytree_v2/match_results_spec.rb",
|
77
|
+
"spec/familytree_v2/note_spec.rb",
|
74
78
|
"spec/familytree_v2/person_spec.rb",
|
75
79
|
"spec/familytree_v2/search_results_spec.rb",
|
76
80
|
"spec/fs_utils_spec.rb",
|
@@ -368,6 +368,95 @@ describe FamilytreeV2::Communicator do
|
|
368
368
|
end
|
369
369
|
end
|
370
370
|
|
371
|
+
describe "writing new notes" do
|
372
|
+
before(:each) do
|
373
|
+
@fs_com_mock = mock("FsCommunicator")
|
374
|
+
@res = mock("HTTP::Response")
|
375
|
+
@ft_v2_com = FamilytreeV2::Communicator.new @fs_com_mock
|
376
|
+
|
377
|
+
@response_json = read_file("../note_create_response.js")
|
378
|
+
@res.stub!(:body).and_return(@response_json)
|
379
|
+
|
380
|
+
@fs_com_mock.stub!(:post).and_return(@res)
|
381
|
+
|
382
|
+
@note = Org::Familysearch::Ws::Familytree::V2::Schema::Note.new
|
383
|
+
end
|
384
|
+
|
385
|
+
describe "write_note for person assertions" do
|
386
|
+
before(:each) do
|
387
|
+
@options = {:personId => 'KWQS-BBQ',:assertionId => '10002', :text => 'MYNOTE.'}
|
388
|
+
end
|
389
|
+
|
390
|
+
it "should take a person ID, assertion ID, and text" do
|
391
|
+
@ft_v2_com.write_note(@options)
|
392
|
+
end
|
393
|
+
|
394
|
+
it "should create a new Note" do
|
395
|
+
note = Org::Familysearch::Ws::Familytree::V2::Schema::Note.new
|
396
|
+
Org::Familysearch::Ws::Familytree::V2::Schema::Note.should_receive(:new).at_least(:once).and_return(note)
|
397
|
+
@ft_v2_com.write_note(@options)
|
398
|
+
end
|
399
|
+
|
400
|
+
it "should build the note with the passed options" do
|
401
|
+
Org::Familysearch::Ws::Familytree::V2::Schema::Note.stub!(:new).and_return(@note)
|
402
|
+
@note.should_receive(:build).with(@options)
|
403
|
+
@ft_v2_com.write_note(@options)
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should POST the note to /familytree/v2/note" do
|
407
|
+
@note.build @options
|
408
|
+
familytree = Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.new
|
409
|
+
familytree.notes = [@note]
|
410
|
+
@fs_com_mock.should_receive(:post).with('/familytree/v2/note',familytree.to_json).and_return(@res)
|
411
|
+
@ft_v2_com.write_note(@options)
|
412
|
+
end
|
413
|
+
|
414
|
+
it "should return the created note (containing the ID)" do
|
415
|
+
result = @ft_v2_com.write_note(@options)
|
416
|
+
result.id.should == 'ZnMtZnQucC5LVzNCLU5NRzpwLjE0MDAwMDAwNDIyOjQwMDAwM29nMlpWOTgxOVpCWWs4RjAwMA=='
|
417
|
+
end
|
418
|
+
|
419
|
+
end
|
420
|
+
|
421
|
+
describe "write_note for relationships" do
|
422
|
+
|
423
|
+
before(:each) do
|
424
|
+
@options = {:spouseIds => ['KWQS-BBQ','KWQS-BBR'],:assertionId => '10002', :text => 'MYNOTE.'}
|
425
|
+
end
|
426
|
+
|
427
|
+
it "should take hash of options including the assertion ID, and text" do
|
428
|
+
@ft_v2_com.write_note(@options)
|
429
|
+
end
|
430
|
+
|
431
|
+
it "should create a new Note" do
|
432
|
+
note = Org::Familysearch::Ws::Familytree::V2::Schema::Note.new
|
433
|
+
Org::Familysearch::Ws::Familytree::V2::Schema::Note.should_receive(:new).at_least(:once).and_return(note)
|
434
|
+
@ft_v2_com.write_note(@options)
|
435
|
+
end
|
436
|
+
|
437
|
+
it "should build the note with the passed options" do
|
438
|
+
Org::Familysearch::Ws::Familytree::V2::Schema::Note.stub!(:new).and_return(@note)
|
439
|
+
@note.should_receive(:build).with(@options)
|
440
|
+
@ft_v2_com.write_note(@options)
|
441
|
+
end
|
442
|
+
|
443
|
+
it "should POST the note to /familytree/v2/note" do
|
444
|
+
@note.build @options.clone
|
445
|
+
familytree = Org::Familysearch::Ws::Familytree::V2::Schema::FamilyTree.new
|
446
|
+
familytree.notes = [@note]
|
447
|
+
@fs_com_mock.should_receive(:post).with('/familytree/v2/note',familytree.to_json).and_return(@res)
|
448
|
+
@ft_v2_com.write_note(@options)
|
449
|
+
end
|
450
|
+
|
451
|
+
it "should return the created note (containing the ID)" do
|
452
|
+
result = @ft_v2_com.write_note(@options)
|
453
|
+
result.id.should == 'ZnMtZnQucC5LVzNCLU5NRzpwLjE0MDAwMDAwNDIyOjQwMDAwM29nMlpWOTgxOVpCWWs4RjAwMA=='
|
454
|
+
end
|
455
|
+
|
456
|
+
end
|
457
|
+
|
458
|
+
end
|
459
|
+
|
371
460
|
describe "combining persons" do
|
372
461
|
def new_person(id,version)
|
373
462
|
p = FamilyTreeV2::Person.new
|
@@ -0,0 +1 @@
|
|
1
|
+
{"notes":[{"id":"ZnMtZnQucC5LVzNCLU5NRzpwLjE0MDAwMDAwNDIyOjQwMDAwM29nMlpWOTgxOVpCWWs4RjAwMA=="}],"version":"2.0.20091221.5312","statusCode":200,"statusMessage":"OK"}
|
@@ -1 +1 @@
|
|
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":"
|
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}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"persons":[{"id":"KW3B-VVT","relationships":{"spouses":[{"id":"KW3B-VVY","version":"5","assertions":{"events":[{"value":{"type":"Marriage","date":{"selected":false,"normalized":"1853","original":" 1853","astro":{"earliest":"2397855","latest":"2398219"}},"place":{"selected":false,"normalized":{"value":"Alabama, United States","id":"33","version":"3.5.0"},"original":"Alabama, United States"}}},{"value":{"type":"Marriage","date":{"selected":false,"normalized":"Aug 1853","original":"Aug 1853","astro":{"earliest":"2397855","latest":"2398219"}},"place":{"selected":false,"normalized":{"value":"Alabama, United States","id":"33","version":"3.5.0"},"original":"Alabama, United States"}}}]},"requestedId":"KW3B-VVY"}],"spouse":[{"id":"KW3B-VVY","version":"5","assertions":{"events":[{"value":{"type":"Marriage","date":{"selected":false,"normalized":"1853","original":" 1853","astro":{"earliest":"2397855","latest":"2398219"}},"place":{"selected":false,"normalized":{"value":"Alabama, United States","id":"33","version":"3.5.0"},"original":"Alabama, United States"}}}]},"requestedId":"KW3B-VVY"}]},"requestedId":"KW3B-VVT"}],"version":"2.0.20091221.5312","statusCode":200,"statusMessage":"OK"}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require 'ruby-fs-stack/familytree'
|
3
|
+
|
4
|
+
describe Org::Familysearch::Ws::Familytree::V2::Schema::Note do
|
5
|
+
|
6
|
+
describe "build" do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@note = Org::Familysearch::Ws::Familytree::V2::Schema::Note.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should receive a hash of options" do
|
13
|
+
@note.build :personId => 'KWQS-BBQ', :assertionId => '10002', :text => "This is my note."
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should build out the note according to the options" do
|
17
|
+
@note.build :personId => 'KWQS-BBQ', :assertionId => '10002', :text => "This is my note."
|
18
|
+
@note.person.id.should == 'KWQS-BBQ'
|
19
|
+
@note.assertion.id.should == '10002'
|
20
|
+
@note.text.should == "This is my note."
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "building a spouses note" do
|
24
|
+
|
25
|
+
before(:each) do
|
26
|
+
@options = {:spouseIds => ['KWQS-BBQ','KWQS-BBR'],:assertionId => '10002', :text => 'MYNOTE.'}
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should build the note with spouse references, assertion ID and text" do
|
30
|
+
@note.build @options
|
31
|
+
@note.spouses.size.should == 2
|
32
|
+
@note.spouses[0].id.should == 'KWQS-BBQ'
|
33
|
+
@note.spouses[1].id.should == 'KWQS-BBR'
|
34
|
+
@note.assertion.id.should == '10002'
|
35
|
+
@note.text = 'MYNOTE.'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "building a parent-child note" do
|
40
|
+
before(:each) do
|
41
|
+
@options = {:parentIds => ['KWQS-BBQ'], :childId => 'KWQS-BBZ', :assertionId => '10002', :text => 'MYNOTE.'}
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should build the note with spouse references, assertion ID and text" do
|
45
|
+
@note.build @options
|
46
|
+
@note.parents.size.should == 1
|
47
|
+
@note.parents[0].id.should == 'KWQS-BBQ'
|
48
|
+
@note.child.id.should == 'KWQS-BBZ'
|
49
|
+
@note.assertion.id.should == '10002'
|
50
|
+
@note.text = 'MYNOTE.'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -272,6 +272,44 @@ describe Org::Familysearch::Ws::Familytree::V2::Schema::Person do
|
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
275
|
+
describe "marriages" do
|
276
|
+
before(:each) do
|
277
|
+
@person = parse_person('spouse_read.js')
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should accept a spouse id." do
|
281
|
+
@person.marriages('KW3B-VVY')
|
282
|
+
end
|
283
|
+
|
284
|
+
it "should return an array of marriage elements" do
|
285
|
+
marriages = @person.marriages('KW3B-VVY')
|
286
|
+
marriages.should be_instance_of(Array)
|
287
|
+
end
|
288
|
+
|
289
|
+
it "should return all marriages" do
|
290
|
+
marriages = @person.marriages('KW3B-VVY')
|
291
|
+
marriages[0].date.normalized.should == '1853'
|
292
|
+
marriages[1].date.normalized.should == 'Aug 1853'
|
293
|
+
end
|
294
|
+
|
295
|
+
describe "checking for cases where there are no assertsions, events, or marriages" do
|
296
|
+
before(:each) do
|
297
|
+
@spouse = @person.relationships.spouses.find{|s|s.requestedId=='KW3B-VVY'}
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should return [] if no assertions" do
|
301
|
+
@spouse.assertions = nil
|
302
|
+
@person.marriages('KW3B-VVY').should == []
|
303
|
+
end
|
304
|
+
|
305
|
+
it "should return [] if no events" do
|
306
|
+
@spouse.assertions.events = nil
|
307
|
+
@person.marriages('KW3B-VVY').should == []
|
308
|
+
end
|
309
|
+
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
275
313
|
describe "selecting summaries" do
|
276
314
|
before(:each) do
|
277
315
|
@person = parse_person('KJ86-3VD_version.js')
|
@@ -364,6 +402,7 @@ describe Org::Familysearch::Ws::Familytree::V2::Schema::Person do
|
|
364
402
|
@person.parents[0].parents[0].gender.should == 'Female'
|
365
403
|
@person.parents[0].parents[1].gender.should == 'Male'
|
366
404
|
@person.parents[0].action.should == 'Select'
|
405
|
+
@person.parents.size.should == 1
|
367
406
|
end
|
368
407
|
|
369
408
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-fs-stack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Zimmerman
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- spec/familytree_v2/json/combine_request.js
|
69
69
|
- spec/familytree_v2/json/combine_response.js
|
70
70
|
- spec/familytree_v2/json/match_KW3B-NNM.js
|
71
|
+
- spec/familytree_v2/json/note_create_response.js
|
71
72
|
- spec/familytree_v2/json/person/KJ86-3VD_all.js
|
72
73
|
- spec/familytree_v2/json/person/KJ86-3VD_version.js
|
73
74
|
- spec/familytree_v2/json/person/multiple_version_read.js
|
@@ -75,8 +76,10 @@ files:
|
|
75
76
|
- spec/familytree_v2/json/person/relationship_not_found.js
|
76
77
|
- spec/familytree_v2/json/person/relationship_read.js
|
77
78
|
- spec/familytree_v2/json/person/relationship_update.js
|
79
|
+
- spec/familytree_v2/json/person/spouse_read.js
|
78
80
|
- spec/familytree_v2/json/search.js
|
79
81
|
- spec/familytree_v2/match_results_spec.rb
|
82
|
+
- spec/familytree_v2/note_spec.rb
|
80
83
|
- spec/familytree_v2/person_spec.rb
|
81
84
|
- spec/familytree_v2/search_results_spec.rb
|
82
85
|
- spec/fixtures/fakeweb_response.txt
|
@@ -117,6 +120,7 @@ test_files:
|
|
117
120
|
- spec/communicator_spec.rb
|
118
121
|
- spec/familytree_v2/familytree_communicator_spec.rb
|
119
122
|
- spec/familytree_v2/match_results_spec.rb
|
123
|
+
- spec/familytree_v2/note_spec.rb
|
120
124
|
- spec/familytree_v2/person_spec.rb
|
121
125
|
- spec/familytree_v2/search_results_spec.rb
|
122
126
|
- spec/fs_utils_spec.rb
|