Class: SiebelDonations::Donor

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

find, get

Constructor Details

#initialize(json = {}) ⇒ Donor

Returns a new instance of Donor.



8
9
10
11
12
13
# File 'lib/siebel_donations/donor.rb', line 8

def initialize(json = {})
  super

  @contacts = json['contacts'] ? json['contacts'].collect { |contact_json| SiebelDonations::Contact.new(contact_json) } : []
  @addresses = json['addresses'] ? json['addresses'].collect { |address_json| SiebelDonations::Address.new(address_json) } : []
end

Instance Attribute Details

#account_nameObject (readonly)

Returns the value of attribute account_name.



6
7
8
# File 'lib/siebel_donations/donor.rb', line 6

def 
  @account_name
end

#addressesObject (readonly)

Returns the value of attribute addresses.



6
7
8
# File 'lib/siebel_donations/donor.rb', line 6

def addresses
  @addresses
end

#contactsObject (readonly)

Returns the value of attribute contacts.



6
7
8
# File 'lib/siebel_donations/donor.rb', line 6

def contacts
  @contacts
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/siebel_donations/donor.rb', line 6

def id
  @id
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/siebel_donations/donor.rb', line 6

def type
  @type
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



6
7
8
# File 'lib/siebel_donations/donor.rb', line 6

def updated_at
  @updated_at
end

Class Method Details

.pathObject



4
# File 'lib/siebel_donations/donor.rb', line 4

def self.path() '/donors'; end

Instance Method Details

#primary_addressObject



19
20
21
# File 'lib/siebel_donations/donor.rb', line 19

def primary_address
  @addresses.detect(&:primary) || @addresses.first
end

#primary_contactObject



15
16
17
# File 'lib/siebel_donations/donor.rb', line 15

def primary_contact
  @contacts.detect(&:primary) || @contacts.first
end