Class: Kentaa::Api::Resources::Site

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

#activitiesObject



130
131
132
# File 'lib/kentaa/api/resources/site.rb', line 130

def activities
  @activities ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Activity, endpoint_path: '/activities')
end

#background_image_urlObject



102
103
104
# File 'lib/kentaa/api/resources/site.rb', line 102

def background_image_url
  data[:background_image_url]
end

#bannersObject



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/kentaa/api/resources/site.rb', line 70

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

#default_currencyObject



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

def default_currency
  data[:default_currency]
end

#descriptionObject



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

def description
  data[:description]
end


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

def donate_url
  data[:donate_url]
end

#donationsObject



114
115
116
# File 'lib/kentaa/api/resources/site.rb', line 114

def donations
  @donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Donation, endpoint_path: '/donations')
end

#end_dateObject



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

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

#external_referenceObject



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

def external_reference
  data[:external_reference]
end

#hostObject



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

def host
  data[:host]
end

#logosObject



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/kentaa/api/resources/site.rb', line 84

def logos
  @logos ||= begin
    logos = []

    if data[:logos]
      data[:logos].map do ||
        logos << Kentaa::Api::Resources::Logo.new()
      end
    end

    logos
  end
end

#manual_donationsObject



118
119
120
# File 'lib/kentaa/api/resources/site.rb', line 118

def manual_donations
  @manual_donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::ManualDonation, endpoint_path: '/manual-donations')
end

#nameObject



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

def name
  data[:name]
end

#newsletter_subscriptionsObject



122
123
124
# File 'lib/kentaa/api/resources/site.rb', line 122

def newsletter_subscriptions
  @newsletter_subscriptions ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::NewsletterSubscription, endpoint_path: '/newsletter-subscriptions')
end

#object_keyObject



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

def object_key
  "Site_#{id}"
end

#ordersObject



126
127
128
# File 'lib/kentaa/api/resources/site.rb', line 126

def orders
  @orders ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Order, endpoint_path: '/orders')
end

#owner_emailObject



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

def owner_email
  data[:owner_email]
end

#owner_nameObject



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

def owner_name
  data[:owner_name]
end

#sign_up_flow_background_image_urlObject



106
107
108
# File 'lib/kentaa/api/resources/site.rb', line 106

def 
  data[:sign_up_flow_background_image_url]
end

#target_amountObject



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

def target_amount
  data[:target_amount]
end

#themeObject



110
111
112
# File 'lib/kentaa/api/resources/site.rb', line 110

def theme
  @theme ||= Kentaa::Api::Resources::Theme.new(data[:theme])
end

#titleObject



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

def title
  data[:title]
end

#total_amountObject



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

def total_amount
  BigDecimal(data[:total_amount])
end

#total_donationsObject



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

def total_donations
  data[:total_donations]
end

#urlObject



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

def url
  data[:url]
end

#video_urlObject



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

def video_url
  data[:video_url]
end