Class: Kentaa::Api::Resources::Action
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?
Instance Method Details
#activity ⇒ Object
122
123
124
|
# File 'lib/kentaa/api/resources/action.rb', line 122
def activity
@activity ||= Kentaa::Api::Resources::Activity.new(data[:activity])
end
|
#avatar_url ⇒ Object
66
67
68
|
# File 'lib/kentaa/api/resources/action.rb', line 66
def avatar_url
data[:avatar_url]
end
|
#closed? ⇒ Boolean
110
111
112
|
# File 'lib/kentaa/api/resources/action.rb', line 110
def closed?
data[:closed]
end
|
#consent ⇒ Object
188
189
190
|
# File 'lib/kentaa/api/resources/action.rb', line 188
def consent
@consent ||= Kentaa::Api::Resources::Consent.new(data[:consent]) if data[:consent]
end
|
#countable? ⇒ Boolean
106
107
108
|
# File 'lib/kentaa/api/resources/action.rb', line 106
def countable?
data[:countable]
end
|
#description ⇒ Object
82
83
84
|
# File 'lib/kentaa/api/resources/action.rb', line 82
def description
data[:description]
end
|
#donate_url ⇒ Object
134
135
136
|
# File 'lib/kentaa/api/resources/action.rb', line 134
def donate_url
data[:donate_url]
end
|
#donations ⇒ Object
196
197
198
|
# File 'lib/kentaa/api/resources/action.rb', line 196
def donations
@donations ||= Kentaa::Api::Resources::Donations.new(config, action_id: id)
end
|
#end_date ⇒ Object
118
119
120
|
# File 'lib/kentaa/api/resources/action.rb', line 118
def end_date
Time.parse(data[:end_date]) if data[:end_date]
end
|
#ended? ⇒ Boolean
114
115
116
|
# File 'lib/kentaa/api/resources/action.rb', line 114
def ended?
data[:ended]
end
|
#external_reference ⇒ Object
192
193
194
|
# File 'lib/kentaa/api/resources/action.rb', line 192
def external_reference
data[:external_reference]
end
|
#first_name ⇒ Object
54
55
56
|
# File 'lib/kentaa/api/resources/action.rb', line 54
def first_name
data[:first_name]
end
|
#fundraiser_page? ⇒ Boolean
74
75
76
|
# File 'lib/kentaa/api/resources/action.rb', line 74
def fundraiser_page?
data[:fundraiser_page]
end
|
#infix ⇒ Object
58
59
60
|
# File 'lib/kentaa/api/resources/action.rb', line 58
def infix
data[:infix]
end
|
#last_name ⇒ Object
62
63
64
|
# File 'lib/kentaa/api/resources/action.rb', line 62
def last_name
data[:last_name]
end
|
#location ⇒ Object
142
143
144
|
# File 'lib/kentaa/api/resources/action.rb', line 142
def location
@location ||= Kentaa::Api::Resources::Location.new(data[:location])
end
|
#manual_donations ⇒ Object
#name ⇒ Object
70
71
72
|
# File 'lib/kentaa/api/resources/action.rb', line 70
def name
[first_name, infix, last_name].reject { |s| s.to_s.empty? }.join(" ")
end
|
#object_key ⇒ Object
10
11
12
|
# File 'lib/kentaa/api/resources/action.rb', line 10
def object_key
"Action_#{id}"
end
|
#owner ⇒ Object
46
47
48
|
# File 'lib/kentaa/api/resources/action.rb', line 46
def owner
@owner ||= Kentaa::Api::Resources::User.new(config, data: data[:owner])
end
|
#photos ⇒ Object
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/kentaa/api/resources/action.rb', line 146
def photos
@photos ||= begin
photos = []
if data[:photos]
data[:photos].each do |photo|
photos << Kentaa::Api::Resources::Photo.new(photo)
end
end
photos
end
end
|
#previous_participations ⇒ Object
126
127
128
|
# File 'lib/kentaa/api/resources/action.rb', line 126
def previous_participations
data[:previous_participations]
end
|
#project_id ⇒ Object
38
39
40
|
# File 'lib/kentaa/api/resources/action.rb', line 38
def project_id
data[:project_id]
end
|
#questions ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# File 'lib/kentaa/api/resources/action.rb', line 174
def questions
@questions ||= begin
questions = []
if data[:questions]
data[:questions].each do |question|
questions << Kentaa::Api::Resources::Question.new(question)
end
end
questions
end
end
|
#registration_fee ⇒ Object
138
139
140
|
# File 'lib/kentaa/api/resources/action.rb', line 138
def registration_fee
@registration_fee ||= Kentaa::Api::Resources::RegistrationFee.new(data[:registration_fee])
end
|
#segment_id ⇒ Object
34
35
36
|
# File 'lib/kentaa/api/resources/action.rb', line 34
def segment_id
data[:segment_id]
end
|
#site_id ⇒ Object
30
31
32
|
# File 'lib/kentaa/api/resources/action.rb', line 30
def site_id
data[:site_id]
end
|
#slug ⇒ Object
26
27
28
|
# File 'lib/kentaa/api/resources/action.rb', line 26
def slug
data[:slug]
end
|
#target_amount ⇒ Object
86
87
88
|
# File 'lib/kentaa/api/resources/action.rb', line 86
def target_amount
data[:target_amount]
end
|
#target_amount_achieved? ⇒ Boolean
98
99
100
|
# File 'lib/kentaa/api/resources/action.rb', line 98
def target_amount_achieved?
data[:target_amount_achieved]
end
|
#team_captain? ⇒ Boolean
50
51
52
|
# File 'lib/kentaa/api/resources/action.rb', line 50
def team_captain?
data[:team_captain]
end
|
#team_id ⇒ Object
42
43
44
|
# File 'lib/kentaa/api/resources/action.rb', line 42
def team_id
data[:team_id]
end
|
#title ⇒ Object
78
79
80
|
# File 'lib/kentaa/api/resources/action.rb', line 78
def title
data[:title]
end
|
#total_amount ⇒ Object
90
91
92
|
# File 'lib/kentaa/api/resources/action.rb', line 90
def total_amount
BigDecimal(data[:total_amount])
end
|
#total_donations ⇒ Object
94
95
96
|
# File 'lib/kentaa/api/resources/action.rb', line 94
def total_donations
data[:total_donations]
end
|
#url ⇒ Object
130
131
132
|
# File 'lib/kentaa/api/resources/action.rb', line 130
def url
data[:url]
end
|
#videos ⇒ Object
160
161
162
163
164
165
166
167
168
169
170
171
172
|
# File 'lib/kentaa/api/resources/action.rb', line 160
def videos
@videos ||= begin
videos = []
if data[:videos]
data[:videos].each do |video|
videos << Kentaa::Api::Resources::Video.new(video)
end
end
videos
end
end
|
#visible? ⇒ Boolean
102
103
104
|
# File 'lib/kentaa/api/resources/action.rb', line 102
def visible?
data[:visible]
end
|