Sha256: 8e18edd5d1ea72269ae461989c978ad514eb6685da8c91186153f61155f130e0

Contents?: true

Size: 658 Bytes

Versions: 12

Compression:

Stored size: 658 Bytes

Contents

module SiebelDonations
  class Donor < Base

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

    attr_reader :id, :account_name, :contacts, :addresses, :type, :updated_at

    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

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

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

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
siebel_donations-1.0.15 lib/siebel_donations/donor.rb
siebel_donations-1.0.14 lib/siebel_donations/donor.rb
siebel_donations-1.0.13 lib/siebel_donations/donor.rb
siebel_donations-1.0.12 lib/siebel_donations/donor.rb
siebel_donations-1.0.11 lib/siebel_donations/donor.rb
siebel_donations-1.0.10 lib/siebel_donations/donor.rb
siebel_donations-1.0.9 lib/siebel_donations/donor.rb
siebel_donations-1.0.8 lib/siebel_donations/donor.rb
siebel_donations-1.0.7 lib/siebel_donations/donor.rb
siebel_donations-1.0.6 lib/siebel_donations/donor.rb
siebel_donations-1.0.5 lib/siebel_donations/donor.rb
siebel_donations-1.0.4 lib/siebel_donations/donor.rb