Class: Kentaa::Api::Resources::Donation
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?
Instance Method Details
#account_bic ⇒ Object
206
207
208
|
# File 'lib/kentaa/api/resources/donation.rb', line 206
def account_bic
data[:account_bic]
end
|
#account_iban ⇒ Object
202
203
204
|
# File 'lib/kentaa/api/resources/donation.rb', line 202
def account_iban
data[:account_iban]
end
|
#account_name ⇒ Object
210
211
212
|
# File 'lib/kentaa/api/resources/donation.rb', line 210
def account_name
data[:account_name]
end
|
#action_id ⇒ Object
64
65
66
|
# File 'lib/kentaa/api/resources/donation.rb', line 64
def action_id
data[:action_id]
end
|
#address ⇒ Object
236
237
238
|
# File 'lib/kentaa/api/resources/donation.rb', line 236
def address
@address ||= Kentaa::Api::Resources::Address.new(data[:address]) if data[:address]
end
|
#amount ⇒ Object
128
129
130
131
132
|
# File 'lib/kentaa/api/resources/donation.rb', line 128
def amount
Kentaa::Api::Deprecation.warn('#amount is deprecated. Please use #donation_amount instead.', caller)
BigDecimal(data[:amount])
end
|
#anonymous? ⇒ Boolean
92
93
94
|
# File 'lib/kentaa/api/resources/donation.rb', line 92
def anonymous?
data[:anonymous]
end
|
#birthday ⇒ Object
240
241
242
|
# File 'lib/kentaa/api/resources/donation.rb', line 240
def birthday
Date.parse(data[:birthday]) if data[:birthday]
end
|
#company ⇒ Object
88
89
90
|
# File 'lib/kentaa/api/resources/donation.rb', line 88
def company
data[:company]
end
|
#company_id ⇒ Object
56
57
58
|
# File 'lib/kentaa/api/resources/donation.rb', line 56
def company_id
data[:company_id]
end
|
#company_registration_fee? ⇒ Boolean
138
139
140
|
# File 'lib/kentaa/api/resources/donation.rb', line 138
def company_registration_fee?
data[:company_registration_fee]
end
|
#company_registration_fee_amount ⇒ Object
142
143
144
|
# File 'lib/kentaa/api/resources/donation.rb', line 142
def company_registration_fee_amount
BigDecimal(data[:company_registration_fee_amount]) if data[:company_registration_fee_amount]
end
|
#consent ⇒ Object
252
253
254
255
256
|
# File 'lib/kentaa/api/resources/donation.rb', line 252
def consent
Kentaa::Api::Deprecation.warn('#consent is deprecated. Please use #consents instead.', caller)
@consent ||= Kentaa::Api::Resources::Consent.new(data[:consent]) if data[:consent]
end
|
#consents ⇒ Object
258
259
260
261
262
263
264
265
266
267
268
269
270
|
# File 'lib/kentaa/api/resources/donation.rb', line 258
def consents
@consents ||= begin
consents = []
if data[:consents]
data[:consents].each do |consent|
consents << Kentaa::Api::Resources::Consent.new(consent)
end
end
consents
end
end
|
96
97
98
|
# File 'lib/kentaa/api/resources/donation.rb', line 96
def contact_details_type
data[:contact_details_type]
end
|
#countable? ⇒ Boolean
170
171
172
|
# File 'lib/kentaa/api/resources/donation.rb', line 170
def countable?
data[:countable]
end
|
#currency ⇒ Object
124
125
126
|
# File 'lib/kentaa/api/resources/donation.rb', line 124
def currency
data[:currency]
end
|
#device_type ⇒ Object
112
113
114
|
# File 'lib/kentaa/api/resources/donation.rb', line 112
def device_type
data[:device_type]
end
|
#donation_amount ⇒ Object
134
135
136
|
# File 'lib/kentaa/api/resources/donation.rb', line 134
def donation_amount
BigDecimal(data[:donation_amount])
end
|
44
45
46
|
# File 'lib/kentaa/api/resources/donation.rb', line 44
def donation_form_id
data[:donation_form_id]
end
|
#email ⇒ Object
100
101
102
|
# File 'lib/kentaa/api/resources/donation.rb', line 100
def email
data[:email]
end
|
#entity ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/kentaa/api/resources/donation.rb', line 14
def entity
if action_id
Kentaa::Api::Resources::Action.new(config, id: action_id, options: options)
elsif team_id
Kentaa::Api::Resources::Team.new(config, id: team_id, options: options)
elsif company_id
Kentaa::Api::Resources::Company.new(config, id: company_id, options: options)
elsif project_id
Kentaa::Api::Resources::Project.new(config, id: project_id, options: options)
elsif segment_id
Kentaa::Api::Resources::Segment.new(config, id: segment_id, options: options)
elsif 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_name ⇒ Object
72
73
74
|
# File 'lib/kentaa/api/resources/donation.rb', line 72
def first_name
data[:first_name]
end
|
#frequency_type ⇒ Object
120
121
122
|
# File 'lib/kentaa/api/resources/donation.rb', line 120
def frequency_type
data[:frequency_type]
end
|
#gender ⇒ Object
244
245
246
|
# File 'lib/kentaa/api/resources/donation.rb', line 244
def gender
data[:gender]
end
|
#infix ⇒ Object
76
77
78
|
# File 'lib/kentaa/api/resources/donation.rb', line 76
def infix
data[:infix]
end
|
#invoicenumber ⇒ Object
174
175
176
|
# File 'lib/kentaa/api/resources/donation.rb', line 174
def invoicenumber
data[:invoicenumber]
end
|
#last_name ⇒ Object
80
81
82
|
# File 'lib/kentaa/api/resources/donation.rb', line 80
def last_name
data[:last_name]
end
|
#locale ⇒ Object
116
117
118
|
# File 'lib/kentaa/api/resources/donation.rb', line 116
def locale
data[:locale]
end
|
#message ⇒ Object
104
105
106
|
# File 'lib/kentaa/api/resources/donation.rb', line 104
def message
data[:message]
end
|
#name ⇒ Object
84
85
86
|
# File 'lib/kentaa/api/resources/donation.rb', line 84
def name
[first_name, infix, last_name].reject { |s| s.to_s.empty? }.join(' ')
end
|
#newsletter? ⇒ Boolean
108
109
110
|
# File 'lib/kentaa/api/resources/donation.rb', line 108
def newsletter?
data[:newsletter]
end
|
#object_key ⇒ Object
10
11
12
|
# File 'lib/kentaa/api/resources/donation.rb', line 10
def object_key
"Donation_#{id}"
end
|
#payment_description ⇒ Object
198
199
200
|
# File 'lib/kentaa/api/resources/donation.rb', line 198
def payment_description
data[:payment_description]
end
|
#payment_id ⇒ Object
194
195
196
|
# File 'lib/kentaa/api/resources/donation.rb', line 194
def payment_id
data[:payment_id]
end
|
#payment_method ⇒ Object
178
179
180
|
# File 'lib/kentaa/api/resources/donation.rb', line 178
def payment_method
data[:payment_method]
end
|
#payment_status ⇒ Object
182
183
184
|
# File 'lib/kentaa/api/resources/donation.rb', line 182
def payment_status
data[:payment_status]
end
|
#payment_status_at ⇒ Object
186
187
188
|
# File 'lib/kentaa/api/resources/donation.rb', line 186
def payment_status_at
Time.parse(data[:payment_status_at]) if data[:payment_status_at]
end
|
#phone ⇒ Object
248
249
250
|
# File 'lib/kentaa/api/resources/donation.rb', line 248
def phone
data[:phone]
end
|
#project_id ⇒ Object
52
53
54
|
# File 'lib/kentaa/api/resources/donation.rb', line 52
def project_id
data[:project_id]
end
|
#questions ⇒ Object
218
219
220
221
222
223
224
225
226
227
228
229
230
|
# File 'lib/kentaa/api/resources/donation.rb', line 218
def questions
@questions ||= begin
questions = []
if data[:questions]
data[:questions].each do |question|
questions << Kentaa::Api::Resources::Question.new(question)
end
end
questions
end
end
|
#receivable_amount ⇒ Object
166
167
168
|
# File 'lib/kentaa/api/resources/donation.rb', line 166
def receivable_amount
BigDecimal(data[:receivable_amount])
end
|
#recurring_donor ⇒ Object
32
33
34
|
# File 'lib/kentaa/api/resources/donation.rb', line 32
def recurring_donor
Kentaa::Api::Resources::RecurringDonor.new(config, id: recurring_donor_id, options: options) if recurring_donor_id
end
|
#recurring_donor_id ⇒ Object
68
69
70
|
# File 'lib/kentaa/api/resources/donation.rb', line 68
def recurring_donor_id
data[:recurring_donor_id]
end
|
#registration_fee? ⇒ Boolean
154
155
156
|
# File 'lib/kentaa/api/resources/donation.rb', line 154
def registration_fee?
data[:registration_fee]
end
|
#registration_fee_amount ⇒ Object
158
159
160
|
# File 'lib/kentaa/api/resources/donation.rb', line 158
def registration_fee_amount
BigDecimal(data[:registration_fee_amount]) if data[:registration_fee_amount]
end
|
#reward ⇒ Object
232
233
234
|
# File 'lib/kentaa/api/resources/donation.rb', line 232
def reward
@reward ||= Kentaa::Api::Resources::Reward.new(data[:reward]) if data[:reward]
end
|
#segment_id ⇒ Object
48
49
50
|
# File 'lib/kentaa/api/resources/donation.rb', line 48
def segment_id
data[:segment_id]
end
|
#site ⇒ Object
36
37
38
|
# File 'lib/kentaa/api/resources/donation.rb', line 36
def site
Kentaa::Api::Resources::Site.new(config, id: site_id, options: options)
end
|
#site_id ⇒ Object
40
41
42
|
# File 'lib/kentaa/api/resources/donation.rb', line 40
def site_id
data[:site_id]
end
|
#start_donation? ⇒ Boolean
150
151
152
|
# File 'lib/kentaa/api/resources/donation.rb', line 150
def start_donation?
data[:start_donation]
end
|
#target_url ⇒ Object
214
215
216
|
# File 'lib/kentaa/api/resources/donation.rb', line 214
def target_url
data[:target_url]
end
|
#team_id ⇒ Object
60
61
62
|
# File 'lib/kentaa/api/resources/donation.rb', line 60
def team_id
data[:team_id]
end
|
#total_amount ⇒ Object
162
163
164
|
# File 'lib/kentaa/api/resources/donation.rb', line 162
def total_amount
BigDecimal(data[:total_amount])
end
|
#transaction_costs ⇒ Object
146
147
148
|
# File 'lib/kentaa/api/resources/donation.rb', line 146
def transaction_costs
BigDecimal(data[:transaction_costs]) if data[:transaction_costs]
end
|
#transaction_id ⇒ Object
190
191
192
|
# File 'lib/kentaa/api/resources/donation.rb', line 190
def transaction_id
data[:transaction_id]
end
|