Class: Org::Familysearch::Ws::Familytree::V2::Schema::FamilyReference
- Defined in:
- lib/ruby-fs-stack/enunciate/familytree.rb,
lib/ruby-fs-stack/familytree/relationship.rb
Overview
A FamilyTree family.
Instance Attribute Summary collapse
-
#action ⇒ Object
The action.
-
#children ⇒ Object
A collection of children for this family.
-
#marriage ⇒ Object
the primary affirming marriage-like event for the couple, if exists.
-
#parents ⇒ Object
A collection of parents for this family.
Class Method Summary collapse
-
.from_json(o) ⇒ Object
constructs a FamilyReference from a (parsed) JSON hash.
Instance Method Summary collapse
-
#init_jaxb_json_hash(_o) ⇒ Object
initializes this FamilyReference with a json hash.
- #select_spouse(spouse_id) ⇒ Object
-
#to_jaxb_json_hash ⇒ Object
the json hash for this FamilyReference.
-
#to_json ⇒ Object
the json (string form) for this FamilyReference.
Instance Attribute Details
#action ⇒ Object
The action.
551 552 553 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 551 def action @action end |
#children ⇒ Object
A collection of children for this family.
557 558 559 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 557 def children @children end |
#marriage ⇒ Object
the primary affirming marriage-like event for the couple, if exists.
555 556 557 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 555 def marriage @marriage end |
#parents ⇒ Object
A collection of parents for this family.
553 554 555 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 553 def parents @parents end |
Class Method Details
.from_json(o) ⇒ Object
constructs a FamilyReference from a (parsed) JSON hash
599 600 601 602 603 604 605 606 607 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 599 def self.from_json(o) if o.nil? return nil else inst = new inst.init_jaxb_json_hash o return inst end end |
Instance Method Details
#init_jaxb_json_hash(_o) ⇒ Object
initializes this FamilyReference with a json hash
583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 583 def init_jaxb_json_hash(_o) @action = String.from_json(_o['action']) unless _o['action'].nil? if !_o['parent'].nil? @parents = Array.new _oa = _o['parent'] _oa.each { | _item | @parents.push Org::Familysearch::Ws::Familytree::V2::Schema::PersonReference.from_json(_item) } end @marriage = Org::Familysearch::Ws::Familytree::V2::Schema::EventAssertion.from_json(_o['marriage']) unless _o['marriage'].nil? if !_o['child'].nil? @children = Array.new _oa = _o['child'] _oa.each { | _item | @children.push Org::Familysearch::Ws::Familytree::V2::Schema::PersonReference.from_json(_item) } end end |
#select_spouse(spouse_id) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/ruby-fs-stack/familytree/relationship.rb', line 85 def select_spouse(spouse_id) add_parents! self.action = 'Select' parent = PersonReference.new parent.id = spouse_id self.parents << parent end |
#to_jaxb_json_hash ⇒ Object
the json hash for this FamilyReference
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 560 def to_jaxb_json_hash _h = {} _h['action'] = action.to_jaxb_json_hash unless action.nil? if !parents.nil? _ha = Array.new parents.each { | _item | _ha.push _item.to_jaxb_json_hash } _h['parent'] = _ha end _h['marriage'] = marriage.to_jaxb_json_hash unless marriage.nil? if !children.nil? _ha = Array.new children.each { | _item | _ha.push _item.to_jaxb_json_hash } _h['child'] = _ha end return _h end |
#to_json ⇒ Object
the json (string form) for this FamilyReference
578 579 580 |
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 578 def to_json to_jaxb_json_hash.to_json end |