Class: Kentaa::Api::Resources::RecurringDonor

Inherits:
Resource
  • Object
show all
Defined in:
lib/kentaa/api/resources/recurring_donor.rb

Instance Attribute Summary

Attributes inherited from Resource

#id

Attributes inherited from Base

#config, #endpoint_path, #options, #resource_class

Instance Method Summary collapse

Methods inherited from Resource

#create, #created_at, #delete, #initialize, #load, #save, #updated_at

Methods inherited from Base

attribute_key, #initialize, #load, #loaded?

Constructor Details

This class inherits a constructor from Kentaa::Api::Resources::Resource

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 78

def active?
  data[:active]
end

#amountObject



86
87
88
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 86

def amount
  BigDecimal(data[:amount])
end

#anonymous?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 54

def anonymous?
  data[:anonymous]
end

#companyObject



50
51
52
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 50

def company
  data[:company]
end

#currencyObject



82
83
84
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 82

def currency
  data[:currency]
end

#donation_form_idObject



30
31
32
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 30

def donation_form_id
  data[:donation_form_id]
end

#donationsObject



98
99
100
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 98

def donations
  @donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Donation, endpoint_path: "/recurring-donors/#{id}/donations")
end

#emailObject



58
59
60
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 58

def email
  data[:email]
end

#end_dateObject



74
75
76
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 74

def end_date
  Date.parse(data[:end_date]) if data[:end_date]
end

#entityObject



14
15
16
17
18
19
20
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 14

def entity
  if donation_form_id
    Kentaa::Api::Resources::DonationForm.new(config, id: donation_form_id, options: options)
  else
    Kentaa::Api::Resources::Site.new(config, id: site_id, options: options)
  end
end

#first_nameObject



34
35
36
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 34

def first_name
  data[:first_name]
end

#frequency_typeObject



66
67
68
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 66

def frequency_type
  data[:frequency_type]
end

#infixObject



38
39
40
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 38

def infix
  data[:infix]
end

#last_nameObject



42
43
44
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 42

def last_name
  data[:last_name]
end

#localeObject



62
63
64
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 62

def locale
  data[:locale]
end

#nameObject



46
47
48
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 46

def name
  [first_name, infix, last_name].reject { |s| s.to_s.empty? }.join(' ')
end

#object_keyObject



10
11
12
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 10

def object_key
  "RecurringDonor_#{id}"
end

#siteObject



22
23
24
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 22

def site
  Kentaa::Api::Resources::Site.new(config, id: site_id, options: options)
end

#site_idObject



26
27
28
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 26

def site_id
  data[:site_id]
end

#start_dateObject



70
71
72
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 70

def start_date
  Date.parse(data[:start_date])
end

#total_amountObject



94
95
96
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 94

def total_amount
  BigDecimal(data[:total_amount])
end

#transaction_costsObject



90
91
92
# File 'lib/kentaa/api/resources/recurring_donor.rb', line 90

def transaction_costs
  BigDecimal(data[:transaction_costs]) if data[:transaction_costs]
end