Class: Org::Familysearch::Ws::Familytree::V2::Schema::SearchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-fs-stack/enunciate/familytree.rb,
lib/ruby-fs-stack/familytree/search.rb

Direct Known Subclasses

MatchResult

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#childrenObject

The children of the primary person for this search hit.



1849
1850
1851
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1849

def children
  @children
end

#idObject Also known as: ref

The id of the primary person.



1839
1840
1841
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1839

def id
  @id
end

#parentsObject

The parents of the primary person for this search hit.



1845
1846
1847
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1845

def parents
  @parents
end

#personObject

The primary person in this search hit.



1843
1844
1845
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1843

def person
  @person
end

#scoreObject

The search score for this person.



1841
1842
1843
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1841

def score
  @score
end

#spousesObject

The spouses of the primary person for this search hit.



1847
1848
1849
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1847

def spouses
  @spouses
end

Class Method Details

.from_json(o) ⇒ Object

constructs a SearchResult from a (parsed) JSON hash



1903
1904
1905
1906
1907
1908
1909
1910
1911
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1903

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

#fatherObject



19
20
21
# File 'lib/ruby-fs-stack/familytree/search.rb', line 19

def father
  parents.find{|p|p.gender == 'Male'}
end

#init_jaxb_json_hash(_o) ⇒ Object

initializes this SearchResult with a json hash



1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1881

def init_jaxb_json_hash(_o)
  @id = String.from_json(_o['id']) unless _o['id'].nil?
  @score = Float.from_json(_o['score']) unless _o['score'].nil?
  @person = Org::Familysearch::Ws::Familytree::V2::Schema::SearchPerson.from_json(_o['person']) unless _o['person'].nil?
  if !_o['parent'].nil?
    @parents = Array.new
    _oa = _o['parent']
    _oa.each { | _item | @parents.push Org::Familysearch::Ws::Familytree::V2::Schema::SearchPerson.from_json(_item) }
  end
  if !_o['spouse'].nil?
    @spouses = Array.new
    _oa = _o['spouse']
    _oa.each { | _item | @spouses.push Org::Familysearch::Ws::Familytree::V2::Schema::SearchPerson.from_json(_item) }
  end
  if !_o['child'].nil?
    @children = Array.new
    _oa = _o['child']
    _oa.each { | _item | @children.push Org::Familysearch::Ws::Familytree::V2::Schema::SearchPerson.from_json(_item) }
  end
end

#motherObject



23
24
25
# File 'lib/ruby-fs-stack/familytree/search.rb', line 23

def mother
  parents.find{|p|p.gender == 'Female'}
end

#to_jaxb_json_hashObject

the json hash for this SearchResult



1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1852

def to_jaxb_json_hash
  _h = {}
  _h['id'] = id.to_jaxb_json_hash unless id.nil?
  _h['score'] = score.to_jaxb_json_hash unless score.nil?
  _h['person'] = person.to_jaxb_json_hash unless person.nil?
  if !parents.nil?
    _ha = Array.new
    parents.each { | _item | _ha.push _item.to_jaxb_json_hash }
    _h['parent'] = _ha
  end
  if !spouses.nil?
    _ha = Array.new
    spouses.each { | _item | _ha.push _item.to_jaxb_json_hash }
    _h['spouse'] = _ha
  end
  if !children.nil?
    _ha = Array.new
    children.each { | _item | _ha.push _item.to_jaxb_json_hash }
    _h['child'] = _ha
  end
  return _h
end

#to_jsonObject

the json (string form) for this SearchResult



1876
1877
1878
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1876

def to_json
  to_jaxb_json_hash.to_json
end