Class: SiebelDonations::Contact

Inherits:
Base
  • Object
show all
Defined in:
lib/siebel_donations/contact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

find, get

Constructor Details

#initialize(json = {}) ⇒ Contact

Returns a new instance of Contact.



7
8
9
10
11
12
# File 'lib/siebel_donations/contact.rb', line 7

def initialize(json = {})
  super

  @phone_numbers = json['phoneNumbers'] ? json['phoneNumbers'].collect { |phone_json| SiebelDonations::PhoneNumber.new(phone_json) } : []
  @email_addresses = json['emailAddresses'] ? json['emailAddresses'].collect { |email_json| SiebelDonations::EmailAddress.new(email_json) } : []
end

Instance Attribute Details

#email_addressesObject (readonly)

Returns the value of attribute email_addresses.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def email_addresses
  @email_addresses
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def first_name
  @first_name
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def id
  @id
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def last_name
  @last_name
end

#middle_nameObject (readonly)

Returns the value of attribute middle_name.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def middle_name
  @middle_name
end

#phone_numbersObject (readonly)

Returns the value of attribute phone_numbers.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def phone_numbers
  @phone_numbers
end

#preferred_nameObject (readonly)

Returns the value of attribute preferred_name.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def preferred_name
  @preferred_name
end

#primaryObject (readonly)

Returns the value of attribute primary.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def primary
  @primary
end

#sexObject (readonly)

Returns the value of attribute sex.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def sex
  @sex
end

#suffixObject (readonly)

Returns the value of attribute suffix.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def suffix
  @suffix
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def title
  @title
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



4
5
6
# File 'lib/siebel_donations/contact.rb', line 4

def updated_at
  @updated_at
end

Instance Method Details

#primary_email_addressObject



14
15
16
# File 'lib/siebel_donations/contact.rb', line 14

def primary_email_address
  @email_addresses.detect(&:primary) || @email_addresses.first
end

#primary_phone_numberObject



18
19
20
# File 'lib/siebel_donations/contact.rb', line 18

def primary_phone_number
  @phone_numbers.detect(&:primary) || @phone_numbers.first
end