Class: VcsClient::Person

Inherits:
Basement show all
Defined in:
lib/objects/person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Basement

#initialize

Constructor Details

This class inherits a constructor from VcsClient::Basement

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



7
8
9
# File 'lib/objects/person.rb', line 7

def actions
  @actions
end

#addressObject

Returns the value of attribute address.



7
8
9
# File 'lib/objects/person.rb', line 7

def address
  @address
end

#cong_distObject

Returns the value of attribute cong_dist.



7
8
9
# File 'lib/objects/person.rb', line 7

def cong_dist
  @cong_dist
end

#date_of_birthObject

Returns the value of attribute date_of_birth.



7
8
9
# File 'lib/objects/person.rb', line 7

def date_of_birth
  @date_of_birth
end

#first_nameObject

Returns the value of attribute first_name.



7
8
9
# File 'lib/objects/person.rb', line 7

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



7
8
9
# File 'lib/objects/person.rb', line 7

def last_name
  @last_name
end

#middle_nameObject

Returns the value of attribute middle_name.



7
8
9
# File 'lib/objects/person.rb', line 7

def middle_name
  @middle_name
end

#partyObject

Returns the value of attribute party.



7
8
9
# File 'lib/objects/person.rb', line 7

def party
  @party
end

#phoneObject

Returns the value of attribute phone.



7
8
9
# File 'lib/objects/person.rb', line 7

def phone
  @phone
end

#precinctObject

Returns the value of attribute precinct.



7
8
9
# File 'lib/objects/person.rb', line 7

def precinct
  @precinct
end

#referencesObject

Returns the value of attribute references.



7
8
9
# File 'lib/objects/person.rb', line 7

def references
  @references
end

#sexObject

Returns the value of attribute sex.



7
8
9
# File 'lib/objects/person.rb', line 7

def sex
  @sex
end

#univObject

Returns the value of attribute univ.



7
8
9
# File 'lib/objects/person.rb', line 7

def univ
  @univ
end

Instance Method Details

#ageObject



31
32
33
34
35
36
37
38
# File 'lib/objects/person.rb', line 31

def age
  if date_of_birth
    date = Date.today
    day_diff = date.day - date_of_birth.day
    month_diff = date.month - date_of_birth.month - (day_diff < 0 ? 1 : 0)
    date.year - date_of_birth.year - (month_diff < 0 ? 1 : 0)
  end
end

#nameObject



40
41
42
43
44
45
# File 'lib/objects/person.rb', line 40

def name
  if @name.nil?
    @name = [self.first_name, self.middle_name, self.last_name].compact.join(' ')
  end
  @name
end

#tokenObject



17
18
19
20
21
# File 'lib/objects/person.rb', line 17

def token
  if self.actions && self.actions.key?("checkin")
    self.actions["checkin"].url.split('/').last
  end
end