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

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

The action.



1001
1002
1003
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1001

def action
  @action
end

#assertionObject

assertionId



1013
1014
1015
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1013

def assertion
  @assertion
end

#childObject

The child id for this note



1011
1012
1013
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1011

def child
  @child
end

#contributorObject

a reference to the contributor of the change.



1015
1016
1017
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1015

def contributor
  @contributor
end

#dispositionObject

the assertion assertion.



1019
1020
1021
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1019

def disposition
  @disposition
end

#idObject

The id of the note.



999
1000
1001
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 999

def id
  @id
end

#parentsObject

The parent id(s) for this note



1007
1008
1009
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1007

def parents
  @parents
end

#personObject

The persona id for this note



1005
1006
1007
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1005

def person
  @person
end

#requestedIdObject

The requestedId of the note.



997
998
999
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 997

def requestedId
  @requestedId
end

#spousesObject

The spouse id(s) for this note



1009
1010
1011
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1009

def spouses
  @spouses
end

#submitterObject

a reference to the submitter.



1017
1018
1019
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1017

def submitter
  @submitter
end

#tempIdObject

A temporary id for this note (e.g. for a note not persisted yet).



1003
1004
1005
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1003

def tempId
  @tempId
end

#textObject

The text of the note.



1021
1022
1023
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1021

def text
  @text
end

Class Method Details

.from_json(o) ⇒ Object

constructs a Note from a (parsed) JSON hash



1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1081

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

#build(options) ⇒ Object

Builds out the elements needed for the note.

Params

  • options - Options for the note including the following:

    • :personId - the person ID if attaching to a person assertion.

    • :spouseIds - an Array of spouse IDs if creating a note attached to a spouse relationship assertion.

    • :parentIds - an Array of parent IDs if creating a note attached to a parent relationship assertion. If creating a note for a child-parent or parent-child relationship, you will need only one parent ID in the array along with a :childId option.

    • :childId - a child ID.

    • :text - the text of the note (required).

    • :assertionId - the valueId of the assertion you are attaching this note to.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ruby-fs-stack/familytree/note.rb', line 16

def build(options)
  if spouseIds = options[:spouseIds]
    self.spouses = spouseIds.collect do |id|
      s = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
      s.id = id
      s
    end
  end
  if parentIds = options[:parentIds]
    self.parents = parentIds.collect do |id|
      p = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
      p.id = id
      p
    end
  end
  if personId = options[:personId]
    self.person = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
    self.person.id = personId
  end
  if childId = options[:childId]
    self.child = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
    self.child.id = childId
  end
  if assertionId = options[:assertionId]
    self.assertion = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.new
    self.assertion.id = assertionId
  end
  if text = options[:text]
    self.text = text
  end
end

#init_jaxb_json_hash(_o) ⇒ Object

initializes this Note with a json hash



1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1056

def init_jaxb_json_hash(_o)
  @requestedId = String.from_json(_o['requestedId']) unless _o['requestedId'].nil?
  @id = String.from_json(_o['id']) unless _o['id'].nil?
  @action = String.from_json(_o['action']) unless _o['action'].nil?
  @tempId = String.from_json(_o['tempId']) unless _o['tempId'].nil?
  @person = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.from_json(_o['person']) unless _o['person'].nil?
  if !_o['parents'].nil?
    @parents = Array.new
    _oa = _o['parents']
    _oa.each { | _item | @parents.push Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.from_json(_item) }
  end
  if !_o['spouses'].nil?
    @spouses = Array.new
    _oa = _o['spouses']
    _oa.each { | _item | @spouses.push Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.from_json(_item) }
  end
  @child = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.from_json(_o['child']) unless _o['child'].nil?
  @assertion = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.from_json(_o['assertion']) unless _o['assertion'].nil?
  @contributor = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.from_json(_o['contributor']) unless _o['contributor'].nil?
  @submitter = Org::Familysearch::Ws::Familytree::V2::Schema::EntityReference.from_json(_o['submitter']) unless _o['submitter'].nil?
  @disposition = String.from_json(_o['disposition']) unless _o['disposition'].nil?
  @text = String.from_json(_o['text']) unless _o['text'].nil?
end

#to_jaxb_json_hashObject

the json hash for this Note



1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1024

def to_jaxb_json_hash
  _h = {}
  _h['requestedId'] = requestedId.to_jaxb_json_hash unless requestedId.nil?
  _h['id'] = id.to_jaxb_json_hash unless id.nil?
  _h['action'] = action.to_jaxb_json_hash unless action.nil?
  _h['tempId'] = tempId.to_jaxb_json_hash unless tempId.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['parents'] = _ha
  end
  if !spouses.nil?
    _ha = Array.new
    spouses.each { | _item | _ha.push _item.to_jaxb_json_hash }
    _h['spouses'] = _ha
  end
  _h['child'] = child.to_jaxb_json_hash unless child.nil?
  _h['assertion'] = assertion.to_jaxb_json_hash unless assertion.nil?
  _h['contributor'] = contributor.to_jaxb_json_hash unless contributor.nil?
  _h['submitter'] = submitter.to_jaxb_json_hash unless submitter.nil?
  _h['disposition'] = disposition.to_jaxb_json_hash unless disposition.nil?
  _h['text'] = text.to_jaxb_json_hash unless text.nil?
  return _h
end

#to_jsonObject

the json (string form) for this Note



1051
1052
1053
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 1051

def to_json
  to_jaxb_json_hash.to_json
end