class SBF::Client::FullFund

Attributes

description[RW]
disabled[RW]
display_name[R]
id[RW]
kid_name[RW]
name[RW]
offline_donation_form[RW]
offline_donation_uuid[RW]

Public Instance Methods

to_hash() click to toggle source
Calls superclass method SBF::Client::BaseEntity#to_hash
# File lib/stbaldricks/entities/fund.rb, line 88
def to_hash
  hsh = super.to_hash
  return hsh if @totals_by_year.nil?

  hsh[:totals_by_year] = {}
  @totals_by_year.each do |year_total|
    hsh[:totals_by_year][year_total.year.to_s.to_sym] = year_total.to_hash
  end

  hsh
end
totals_by_year=(value) click to toggle source
# File lib/stbaldricks/entities/fund.rb, line 76
def totals_by_year=(value)
  if value.nil? || value.empty?
    @totals_by_year = []
    return
  end

  totals_by_year_will_change!
  @totals_by_year = value.map do |k, v|
    SBF::Client::Fund::YearlyTotals.new(v.merge(year: k.to_s.to_i))
  end
end