Class: Kentaa::Api::Resources::Donation

Inherits:
Resource show all
Defined in:
lib/kentaa/api/resources/donation.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

#account_bicObject



206
207
208
# File 'lib/kentaa/api/resources/donation.rb', line 206

def 
  data[:account_bic]
end

#account_ibanObject



202
203
204
# File 'lib/kentaa/api/resources/donation.rb', line 202

def 
  data[:account_iban]
end

#account_nameObject



210
211
212
# File 'lib/kentaa/api/resources/donation.rb', line 210

def 
  data[:account_name]
end

#action_idObject



64
65
66
# File 'lib/kentaa/api/resources/donation.rb', line 64

def action_id
  data[:action_id]
end

#addressObject



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

#amountObject



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

Returns:

  • (Boolean)


92
93
94
# File 'lib/kentaa/api/resources/donation.rb', line 92

def anonymous?
  data[:anonymous]
end

#birthdayObject



240
241
242
# File 'lib/kentaa/api/resources/donation.rb', line 240

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

#companyObject



88
89
90
# File 'lib/kentaa/api/resources/donation.rb', line 88

def company
  data[:company]
end

#company_idObject



56
57
58
# File 'lib/kentaa/api/resources/donation.rb', line 56

def company_id
  data[:company_id]
end

#company_registration_fee?Boolean

Returns:

  • (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_amountObject



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


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

#consentsObject



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

#contact_details_typeObject



96
97
98
# File 'lib/kentaa/api/resources/donation.rb', line 96

def contact_details_type
  data[:contact_details_type]
end

#countable?Boolean

Returns:

  • (Boolean)


170
171
172
# File 'lib/kentaa/api/resources/donation.rb', line 170

def countable?
  data[:countable]
end

#currencyObject



124
125
126
# File 'lib/kentaa/api/resources/donation.rb', line 124

def currency
  data[:currency]
end

#device_typeObject



112
113
114
# File 'lib/kentaa/api/resources/donation.rb', line 112

def device_type
  data[:device_type]
end

#donation_amountObject



134
135
136
# File 'lib/kentaa/api/resources/donation.rb', line 134

def donation_amount
  BigDecimal(data[:donation_amount])
end

#donation_form_idObject



44
45
46
# File 'lib/kentaa/api/resources/donation.rb', line 44

def donation_form_id
  data[:donation_form_id]
end

#emailObject



100
101
102
# File 'lib/kentaa/api/resources/donation.rb', line 100

def email
  data[:email]
end

#entityObject



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_nameObject



72
73
74
# File 'lib/kentaa/api/resources/donation.rb', line 72

def first_name
  data[:first_name]
end

#frequency_typeObject



120
121
122
# File 'lib/kentaa/api/resources/donation.rb', line 120

def frequency_type
  data[:frequency_type]
end

#genderObject



244
245
246
# File 'lib/kentaa/api/resources/donation.rb', line 244

def gender
  data[:gender]
end

#infixObject



76
77
78
# File 'lib/kentaa/api/resources/donation.rb', line 76

def infix
  data[:infix]
end

#invoicenumberObject



174
175
176
# File 'lib/kentaa/api/resources/donation.rb', line 174

def invoicenumber
  data[:invoicenumber]
end

#last_nameObject



80
81
82
# File 'lib/kentaa/api/resources/donation.rb', line 80

def last_name
  data[:last_name]
end

#localeObject



116
117
118
# File 'lib/kentaa/api/resources/donation.rb', line 116

def locale
  data[:locale]
end

#messageObject



104
105
106
# File 'lib/kentaa/api/resources/donation.rb', line 104

def message
  data[:message]
end

#nameObject



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

Returns:

  • (Boolean)


108
109
110
# File 'lib/kentaa/api/resources/donation.rb', line 108

def newsletter?
  data[:newsletter]
end

#object_keyObject



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

def object_key
  "Donation_#{id}"
end

#payment_descriptionObject



198
199
200
# File 'lib/kentaa/api/resources/donation.rb', line 198

def payment_description
  data[:payment_description]
end

#payment_idObject



194
195
196
# File 'lib/kentaa/api/resources/donation.rb', line 194

def payment_id
  data[:payment_id]
end

#payment_methodObject



178
179
180
# File 'lib/kentaa/api/resources/donation.rb', line 178

def payment_method
  data[:payment_method]
end

#payment_statusObject



182
183
184
# File 'lib/kentaa/api/resources/donation.rb', line 182

def payment_status
  data[:payment_status]
end

#payment_status_atObject



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

#phoneObject



248
249
250
# File 'lib/kentaa/api/resources/donation.rb', line 248

def phone
  data[:phone]
end

#project_idObject



52
53
54
# File 'lib/kentaa/api/resources/donation.rb', line 52

def project_id
  data[:project_id]
end

#questionsObject



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_amountObject



166
167
168
# File 'lib/kentaa/api/resources/donation.rb', line 166

def receivable_amount
  BigDecimal(data[:receivable_amount])
end

#recurring_donorObject



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_idObject



68
69
70
# File 'lib/kentaa/api/resources/donation.rb', line 68

def recurring_donor_id
  data[:recurring_donor_id]
end

#registration_fee?Boolean

Returns:

  • (Boolean)


154
155
156
# File 'lib/kentaa/api/resources/donation.rb', line 154

def registration_fee?
  data[:registration_fee]
end

#registration_fee_amountObject



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

#rewardObject



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_idObject



48
49
50
# File 'lib/kentaa/api/resources/donation.rb', line 48

def segment_id
  data[:segment_id]
end

#siteObject



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_idObject



40
41
42
# File 'lib/kentaa/api/resources/donation.rb', line 40

def site_id
  data[:site_id]
end

#start_donation?Boolean

Returns:

  • (Boolean)


150
151
152
# File 'lib/kentaa/api/resources/donation.rb', line 150

def start_donation?
  data[:start_donation]
end

#target_urlObject



214
215
216
# File 'lib/kentaa/api/resources/donation.rb', line 214

def target_url
  data[:target_url]
end

#team_idObject



60
61
62
# File 'lib/kentaa/api/resources/donation.rb', line 60

def team_id
  data[:team_id]
end

#total_amountObject



162
163
164
# File 'lib/kentaa/api/resources/donation.rb', line 162

def total_amount
  BigDecimal(data[:total_amount])
end

#transaction_costsObject



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_idObject



190
191
192
# File 'lib/kentaa/api/resources/donation.rb', line 190

def transaction_id
  data[:transaction_id]
end