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

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

Overview

An event of a person.

Instance Attribute Summary collapse

Attributes inherited from Assertion

#action, #citations, #contributors, #disposition, #id, #modifiable, #modified, #notes, #personas, #selected, #tempId, #version

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Assertion

#to_json

Instance Attribute Details

#valueObject

The value for this assertion.



7172
7173
7174
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 7172

def value
  @value
end

Class Method Details

.from_json(o) ⇒ Object

constructs a EventAssertion from a (parsed) JSON hash



7188
7189
7190
7191
7192
7193
7194
7195
7196
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 7188

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

#add_value(options) ⇒ Object

Params

  • options - requires a :type option and accepts an (optional) :date and :place option

Example

person.add_birth :date => '12 Aug 1902', :place => 'United States'

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
# File 'lib/ruby-fs-stack/familytree/event.rb', line 22

def add_value(options)
  raise ArgumentError, "missing option[:type]" if options[:type].nil?
  self.value = EventValue.new
  self.value.type = options[:type]
  self.value.add_date(options[:date]) if options[:date]
  self.value.add_place(options[:place]) if options[:place]
end

#dateObject

To make porting code from v1 to v2 easier, date will reference value.date



39
40
41
# File 'lib/ruby-fs-stack/familytree/event.rb', line 39

def date
  value.date
end

#init_jaxb_json_hash(_o) ⇒ Object

initializes this EventAssertion with a json hash



7182
7183
7184
7185
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 7182

def init_jaxb_json_hash(_o)
  super _o
  @value = Org::Familysearch::Ws::Familytree::V2::Schema::EventValue.from_json(_o['value']) unless _o['value'].nil?
end

#placeObject

To make porting code from v1 to v2 easier, date will reference value.date



45
46
47
# File 'lib/ruby-fs-stack/familytree/event.rb', line 45

def place
  value.place
end

#select(type, value_id) ⇒ Object



30
31
32
33
34
35
# File 'lib/ruby-fs-stack/familytree/event.rb', line 30

def select(type,value_id)
  self.value = EventValue.new
  self.value.id = value_id
  self.value.type = type
  self.action = 'Select'
end

#to_jaxb_json_hashObject

the json hash for this EventAssertion



7175
7176
7177
7178
7179
# File 'lib/ruby-fs-stack/enunciate/familytree.rb', line 7175

def to_jaxb_json_hash
  _h = super
  _h['value'] = value.to_jaxb_json_hash unless value.nil?
  return _h
end