Class: Kentaa::Api::Resources::Project
Instance Attribute Summary
Attributes inherited from Resource
#id
Attributes inherited from Base
#config, #options
Instance Method Summary
collapse
Methods inherited from Resource
#created_at, #initialize, #updated_at
Methods inherited from Base
#initialize, #load, #loaded?
Instance Method Details
#closed? ⇒ Boolean
66
67
68
|
# File 'lib/kentaa/api/resources/project.rb', line 66
def closed?
data[:closed]
end
|
#consent ⇒ Object
132
133
134
|
# File 'lib/kentaa/api/resources/project.rb', line 132
def consent
@consent ||= Kentaa::Api::Resources::Consent.new(config, data: data[:consent]) if data[:consent]
end
|
#countable? ⇒ Boolean
62
63
64
|
# File 'lib/kentaa/api/resources/project.rb', line 62
def countable?
data[:countable]
end
|
#description ⇒ Object
38
39
40
|
# File 'lib/kentaa/api/resources/project.rb', line 38
def description
data[:description]
end
|
#donate_url ⇒ Object
82
83
84
|
# File 'lib/kentaa/api/resources/project.rb', line 82
def donate_url
data[:donate_url]
end
|
#end_date ⇒ Object
74
75
76
|
# File 'lib/kentaa/api/resources/project.rb', line 74
def end_date
Time.parse(data[:end_date]) if data[:end_date]
end
|
#ended? ⇒ Boolean
70
71
72
|
# File 'lib/kentaa/api/resources/project.rb', line 70
def ended?
data[:ended]
end
|
#external_reference ⇒ Object
136
137
138
|
# File 'lib/kentaa/api/resources/project.rb', line 136
def external_reference
data[:external_reference]
end
|
#location ⇒ Object
86
87
88
|
# File 'lib/kentaa/api/resources/project.rb', line 86
def location
@location ||= Kentaa::Api::Resources::Location.new(config, data: data[:location])
end
|
#object_key ⇒ Object
10
11
12
|
# File 'lib/kentaa/api/resources/project.rb', line 10
def object_key
"Project_#{id}"
end
|
#photos ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/kentaa/api/resources/project.rb', line 90
def photos
@photos ||= begin
photos = []
if data[:photos]
data[:photos].each do |photo|
photos << Kentaa::Api::Resources::Photo.new(config, data: photo)
end
end
photos
end
end
|
#questions ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/kentaa/api/resources/project.rb', line 118
def questions
@questions ||= begin
questions = []
if data[:questions]
data[:questions].each do |question|
questions << Kentaa::Api::Resources::Question.new(config, data: question)
end
end
questions
end
end
|
#segment_id ⇒ Object
30
31
32
|
# File 'lib/kentaa/api/resources/project.rb', line 30
def segment_id
data[:segment_id]
end
|
#site_id ⇒ Object
26
27
28
|
# File 'lib/kentaa/api/resources/project.rb', line 26
def site_id
data[:site_id]
end
|
#slug ⇒ Object
22
23
24
|
# File 'lib/kentaa/api/resources/project.rb', line 22
def slug
data[:slug]
end
|
#target_amount ⇒ Object
42
43
44
|
# File 'lib/kentaa/api/resources/project.rb', line 42
def target_amount
data[:target_amount]
end
|
#target_amount_achieved? ⇒ Boolean
54
55
56
|
# File 'lib/kentaa/api/resources/project.rb', line 54
def target_amount_achieved?
data[:target_amount_achieved]
end
|
#title ⇒ Object
34
35
36
|
# File 'lib/kentaa/api/resources/project.rb', line 34
def title
data[:title]
end
|
#total_amount ⇒ Object
46
47
48
|
# File 'lib/kentaa/api/resources/project.rb', line 46
def total_amount
BigDecimal(data[:total_amount])
end
|
#total_donations ⇒ Object
50
51
52
|
# File 'lib/kentaa/api/resources/project.rb', line 50
def total_donations
data[:total_donations]
end
|
#url ⇒ Object
78
79
80
|
# File 'lib/kentaa/api/resources/project.rb', line 78
def url
data[:url]
end
|
#videos ⇒ Object
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/kentaa/api/resources/project.rb', line 104
def videos
@videos ||= begin
videos = []
if data[:videos]
data[:videos].each do |video|
videos << Kentaa::Api::Resources::Video.new(config, data: video)
end
end
videos
end
end
|
#visible? ⇒ Boolean
58
59
60
|
# File 'lib/kentaa/api/resources/project.rb', line 58
def visible?
data[:visible]
end
|