jimmyz-fs-familytree-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +4 -0
- data/lib/fs_familytree_v1.rb +193 -0
- data/spec/fixtures/person/KJ86-3VD.xml +1879 -0
- data/spec/fixtures/search.xml +2 -0
- data/spec/fs_familytree_v1_spec.rb +90 -0
- data/spec/spec_helper.rb +11 -0
- metadata +80 -0
data/VERSION.yml
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'jimmyz-happymapper'
|
3
|
+
require 'happymapper'
|
4
|
+
|
5
|
+
module FsFamilytreeV1
|
6
|
+
|
7
|
+
class AlternateIds
|
8
|
+
include HappyMapper
|
9
|
+
|
10
|
+
tag :alternateIds
|
11
|
+
has_many :id, String
|
12
|
+
end
|
13
|
+
|
14
|
+
class PersonInformation
|
15
|
+
include HappyMapper
|
16
|
+
|
17
|
+
tag :information
|
18
|
+
element :gender, String
|
19
|
+
element :living, Boolean
|
20
|
+
has_one :alternateIds, AlternateIds
|
21
|
+
end
|
22
|
+
|
23
|
+
class NamePiece
|
24
|
+
include HappyMapper
|
25
|
+
|
26
|
+
tag :piece
|
27
|
+
attribute :type, String
|
28
|
+
element :value, String
|
29
|
+
end
|
30
|
+
|
31
|
+
class Pieces
|
32
|
+
include HappyMapper
|
33
|
+
|
34
|
+
has_many :piece, NamePiece
|
35
|
+
end
|
36
|
+
|
37
|
+
class NameForm
|
38
|
+
include HappyMapper
|
39
|
+
|
40
|
+
tag :form
|
41
|
+
element :fullText, String
|
42
|
+
has_one :pieces, Pieces
|
43
|
+
attribute :script, String # ('Spanish' | 'Portuguese' | 'Chinese' | 'Kana' | 'Hangul' | 'Cyrillic')
|
44
|
+
end
|
45
|
+
|
46
|
+
class Forms
|
47
|
+
include HappyMapper
|
48
|
+
|
49
|
+
has_many :form, NameForm
|
50
|
+
end
|
51
|
+
|
52
|
+
class Assertion
|
53
|
+
def self.init(options = {})
|
54
|
+
include HappyMapper
|
55
|
+
|
56
|
+
attribute :id, String
|
57
|
+
attribute :version, String
|
58
|
+
attribute :submitter, String
|
59
|
+
attribute :modified, DateTime
|
60
|
+
attribute :modifiable, Boolean
|
61
|
+
attribute :disputing, Boolean
|
62
|
+
attribute :contributor, String
|
63
|
+
attribute :tempId, String
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class Name < Assertion
|
68
|
+
init
|
69
|
+
|
70
|
+
attribute :type, String
|
71
|
+
has_one :forms, Forms
|
72
|
+
end
|
73
|
+
|
74
|
+
class Gender < Assertion
|
75
|
+
init
|
76
|
+
|
77
|
+
element :value, String # ( Male | Female )
|
78
|
+
end
|
79
|
+
|
80
|
+
class DateAstro
|
81
|
+
include HappyMapper
|
82
|
+
|
83
|
+
tag :astro
|
84
|
+
element :earliest, Integer
|
85
|
+
element :latest, Integer
|
86
|
+
end
|
87
|
+
|
88
|
+
class Date
|
89
|
+
include HappyMapper
|
90
|
+
|
91
|
+
element :original, String
|
92
|
+
element :normalized, String
|
93
|
+
element :astro, DateAstro
|
94
|
+
end
|
95
|
+
|
96
|
+
class Place
|
97
|
+
include HappyMapper
|
98
|
+
|
99
|
+
element :original, String
|
100
|
+
element :normalized, String, :attributes => {:placeId => String}
|
101
|
+
end
|
102
|
+
|
103
|
+
class PersonReference
|
104
|
+
def self.init
|
105
|
+
include HappyMapper
|
106
|
+
|
107
|
+
attribute :role, String
|
108
|
+
attribute :ref, String
|
109
|
+
attribute :tempId, String
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
class Spouse < PersonReference
|
114
|
+
init
|
115
|
+
end
|
116
|
+
|
117
|
+
class Child < PersonReference
|
118
|
+
init
|
119
|
+
end
|
120
|
+
|
121
|
+
class Parent < PersonReference
|
122
|
+
init
|
123
|
+
end
|
124
|
+
|
125
|
+
class Event < Assertion
|
126
|
+
init
|
127
|
+
|
128
|
+
attribute :type, String
|
129
|
+
attribute :title, String # not tested
|
130
|
+
element :date, Date
|
131
|
+
element :place, Place
|
132
|
+
element :spouse, Spouse
|
133
|
+
end
|
134
|
+
|
135
|
+
class Fact < Assertion
|
136
|
+
init
|
137
|
+
|
138
|
+
attribute :type, String
|
139
|
+
attribute :scope, String
|
140
|
+
attribute :title, String
|
141
|
+
element :detail, String
|
142
|
+
has_one :child, Child
|
143
|
+
has_one :parent, Parent
|
144
|
+
has_one :spouse, Spouse # not tested
|
145
|
+
element :place, Place # not tested
|
146
|
+
element :spouse, Spouse # not tested
|
147
|
+
end
|
148
|
+
|
149
|
+
class Relationship < Assertion
|
150
|
+
init
|
151
|
+
|
152
|
+
attribute :scope, String
|
153
|
+
has_one :child, Child
|
154
|
+
has_one :parent, Parent
|
155
|
+
has_one :spouse, Spouse
|
156
|
+
end
|
157
|
+
|
158
|
+
class Assertions
|
159
|
+
include HappyMapper
|
160
|
+
|
161
|
+
has_many :name, Name
|
162
|
+
has_many :gender, Gender
|
163
|
+
has_many :event, Event
|
164
|
+
has_many :fact, Fact
|
165
|
+
has_many :relationship, Relationship
|
166
|
+
end
|
167
|
+
|
168
|
+
class Person
|
169
|
+
include HappyMapper
|
170
|
+
|
171
|
+
attribute :id, String
|
172
|
+
attribute :requestedId, String
|
173
|
+
attribute :version, String
|
174
|
+
attribute :modified, DateTime
|
175
|
+
has_one :information, PersonInformation
|
176
|
+
has_one :assertions, Assertions
|
177
|
+
end
|
178
|
+
|
179
|
+
class Persons
|
180
|
+
include HappyMapper
|
181
|
+
|
182
|
+
has_many :person, Person
|
183
|
+
end
|
184
|
+
|
185
|
+
class Familytree
|
186
|
+
include HappyMapper
|
187
|
+
|
188
|
+
attribute :version, String
|
189
|
+
attribute :statusMessage, String
|
190
|
+
attribute :statusCode, Integer
|
191
|
+
has_one :persons, Persons
|
192
|
+
end
|
193
|
+
end
|