Class: Kentaa::Api::Resources::DonationForm

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

#bannersObject



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/kentaa/api/resources/donation_form.rb', line 66

def banners
  @banners ||= begin
    banners = []

    if data[:banners]
      data[:banners].each do |banner|
        banners << Kentaa::Api::Resources::Banner.new(banner)
      end
    end

    banners
  end
end

#descriptionObject



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

def description
  data[:description]
end

#donationsObject



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

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

#external_referenceObject



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

def external_reference
  data[:external_reference]
end

#manual_donationsObject



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

def manual_donations
  @manual_donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::ManualDonation, endpoint_path: "/donation-forms/#{id}/manual-donations")
end

#newsletter_subscriptionsObject



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

def newsletter_subscriptions
  @newsletter_subscriptions ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::NewsletterSubscription, endpoint_path: "/donation-forms/#{id}/newsletter-subscriptions")
end

#object_keyObject



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

def object_key
  "DonationForm_#{id}"
end

#ownerObject



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

def owner
  @owner ||= Kentaa::Api::Resources::User.new(config, data: data[:owner], options: options)
end

#parentObject



14
15
16
# File 'lib/kentaa/api/resources/donation_form.rb', line 14

def parent
  site
end

#published?Boolean

Returns:

  • (Boolean)


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

def published?
  data[:published]
end

#recurring_donorsObject



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

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

#siteObject



18
19
20
# File 'lib/kentaa/api/resources/donation_form.rb', line 18

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

#site_idObject



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

def site_id
  data[:site_id]
end

#slugObject



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

def slug
  data[:slug]
end

#titleObject



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

def title
  data[:title]
end

#total_amountObject



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

def total_amount
  BigDecimal(data[:total_amount])
end

#total_donationsObject



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

def total_donations
  data[:total_donations]
end

#urlObject



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

def url
  data[:url]
end

#visible?Boolean

Returns:

  • (Boolean)


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

def visible?
  data[:visible]
end