Class: SiebelDonations::Donor
- Defined in:
- lib/siebel_donations/donor.rb
Instance Attribute Summary collapse
-
#account_name ⇒ Object
readonly
Returns the value of attribute account_name.
-
#addresses ⇒ Object
readonly
Returns the value of attribute addresses.
-
#contacts ⇒ Object
readonly
Returns the value of attribute contacts.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json = {}) ⇒ Donor
constructor
A new instance of Donor.
- #primary_address ⇒ Object
- #primary_contact ⇒ Object
Methods inherited from Base
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_name ⇒ Object (readonly)
Returns the value of attribute account_name.
6 7 8 |
# File 'lib/siebel_donations/donor.rb', line 6 def account_name @account_name end |
#addresses ⇒ Object (readonly)
Returns the value of attribute addresses.
6 7 8 |
# File 'lib/siebel_donations/donor.rb', line 6 def addresses @addresses end |
#contacts ⇒ Object (readonly)
Returns the value of attribute contacts.
6 7 8 |
# File 'lib/siebel_donations/donor.rb', line 6 def contacts @contacts end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/siebel_donations/donor.rb', line 6 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/siebel_donations/donor.rb', line 6 def type @type end |
#updated_at ⇒ Object (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
.path ⇒ Object
4 |
# File 'lib/siebel_donations/donor.rb', line 4 def self.path() '/donors'; end |
Instance Method Details
#primary_address ⇒ Object
19 20 21 |
# File 'lib/siebel_donations/donor.rb', line 19 def primary_address @addresses.detect(&:primary) || @addresses.first end |
#primary_contact ⇒ Object
15 16 17 |
# File 'lib/siebel_donations/donor.rb', line 15 def primary_contact @contacts.detect(&:primary) || @contacts.first end |