class DarujmeCz::Pledge
@see www.darujme.cz/doc/api/v1/index.html#endpoint-get-organization-organizationid-pledges-by-filter
Public Class Methods
endpoint()
click to toggle source
# File lib/darujme_cz/pledge.rb, line 7 def self.endpoint "pledges" end
new(attributes)
click to toggle source
@param [Hash] attributes
Calls superclass method
DarujmeCz::Base::new
# File lib/darujme_cz/pledge.rb, line 14 def initialize(attributes) @id = attributes["pledgeId"] super end
Public Instance Methods
amount()
click to toggle source
@return [Money]
# File lib/darujme_cz/pledge.rb, line 28 def amount @amount ||= ::Money.new(*@source["pledgedAmount"].values) end
donor()
click to toggle source
# File lib/darujme_cz/pledge.rb, line 37 def donor @donor ||= Donor.new @source["donor"] end
pledged_at()
click to toggle source
@return [Time]
# File lib/darujme_cz/pledge.rb, line 33 def pledged_at @source["pledgedAt"].to_time end
project()
click to toggle source
# File lib/darujme_cz/pledge.rb, line 47 def project @project ||= Project.find project_id end
recurrent?()
click to toggle source
# File lib/darujme_cz/pledge.rb, line 19 def recurrent? !!@source["isRecurrent"] end
transactions()
click to toggle source
# File lib/darujme_cz/pledge.rb, line 41 def transactions @transactions ||= Array(@source["transactions"]).collect do |transaction_source| Transaction.new(transaction_source) end end
want_donation_certificate?()
click to toggle source
# File lib/darujme_cz/pledge.rb, line 23 def want_donation_certificate? !!@source["wantDonationCertificate"] end