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, #options

Instance Method Summary collapse

Methods inherited from Resource

#created_at, #delete, #initialize, #load, #save, #updated_at

Methods inherited from Base

#initialize, #load, #loaded?

Constructor Details

This class inherits a constructor from Kentaa::Api::Resources::Resource

Instance Method Details

#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



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

def donations
  @donations ||= Kentaa::Api::Resources::Donations.new(config)
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



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

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

#manual_donationsObject



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

def manual_donations
  @manual_donations ||= Kentaa::Api::Resources::ManualDonations.new(config)
end

#nameObject



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

def name
  data[:name]
end

#object_keyObject



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

def object_key
  "Site_#{id}"
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

#target_amountObject



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

def target_amount
  data[:target_amount]
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