Class: Kentaa::Api::Resources::ManualDonation

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

#action_idObject



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

def action_id
  data[:action_id]
end

#amountObject



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

def amount
  BigDecimal(data[:amount])
end

#anonymous?Boolean

Returns:

  • (Boolean)


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

def anonymous?
  data[:anonymous]
end

#company_idObject



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

def company_id
  data[:company_id]
end

#countable?Boolean

Returns:

  • (Boolean)


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

def countable?
  data[:countable]
end

#currencyObject



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

def currency
  data[:currency]
end

#donation_form_idObject



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

def donation_form_id
  data[:donation_form_id]
end

#emailObject



84
85
86
# File 'lib/kentaa/api/resources/manual_donation.rb', line 84

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/manual_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



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

def first_name
  data[:first_name]
end

#infixObject



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

def infix
  data[:infix]
end

#last_nameObject



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

def last_name
  data[:last_name]
end

#messageObject



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

def message
  data[:message]
end

#nameObject



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

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/manual_donation.rb', line 10

def object_key
  "Donation_#{id}"
end

#project_idObject



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

def project_id
  data[:project_id]
end

#segment_idObject



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

def segment_id
  data[:segment_id]
end

#siteObject



32
33
34
# File 'lib/kentaa/api/resources/manual_donation.rb', line 32

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

#site_idObject



36
37
38
# File 'lib/kentaa/api/resources/manual_donation.rb', line 36

def site_id
  data[:site_id]
end

#target_urlObject



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

def target_url
  data[:target_url]
end

#team_idObject



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

def team_id
  data[:team_id]
end