stbaldricks 1.5.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/lib/stbaldricks.rb +2 -0
- data/lib/stbaldricks/api.rb +7 -0
- data/lib/stbaldricks/api_connector.rb +47 -0
- data/lib/stbaldricks/client.rb +7 -0
- data/lib/stbaldricks/configuration.rb +47 -0
- data/lib/stbaldricks/default_logger.rb +24 -0
- data/lib/stbaldricks/endpoints/communicate.rb +67 -0
- data/lib/stbaldricks/endpoints/config.rb +18 -0
- data/lib/stbaldricks/endpoints/contact.rb +12 -0
- data/lib/stbaldricks/endpoints/event.rb +39 -0
- data/lib/stbaldricks/endpoints/event_application.rb +32 -0
- data/lib/stbaldricks/endpoints/fund.rb +24 -0
- data/lib/stbaldricks/endpoints/kid.rb +24 -0
- data/lib/stbaldricks/endpoints/kid_honor.rb +17 -0
- data/lib/stbaldricks/endpoints/lib/entity.rb +247 -0
- data/lib/stbaldricks/endpoints/message.rb +27 -0
- data/lib/stbaldricks/endpoints/newsletter_recipient.rb +41 -0
- data/lib/stbaldricks/endpoints/participant.rb +66 -0
- data/lib/stbaldricks/endpoints/photo.rb +51 -0
- data/lib/stbaldricks/endpoints/recurring_gift.rb +18 -0
- data/lib/stbaldricks/endpoints/search.rb +63 -0
- data/lib/stbaldricks/endpoints/shave_schedule.rb +28 -0
- data/lib/stbaldricks/endpoints/user.rb +106 -0
- data/lib/stbaldricks/entities/batch.rb +29 -0
- data/lib/stbaldricks/entities/campaign.rb +37 -0
- data/lib/stbaldricks/entities/communicate.rb +20 -0
- data/lib/stbaldricks/entities/config.rb +41 -0
- data/lib/stbaldricks/entities/contact.rb +40 -0
- data/lib/stbaldricks/entities/contact_group.rb +29 -0
- data/lib/stbaldricks/entities/document_library.rb +19 -0
- data/lib/stbaldricks/entities/document_library_category.rb +14 -0
- data/lib/stbaldricks/entities/donation.rb +372 -0
- data/lib/stbaldricks/entities/donation/donor_type.rb +13 -0
- data/lib/stbaldricks/entities/donation/how_created.rb +22 -0
- data/lib/stbaldricks/entities/donation/payment_type.rb +17 -0
- data/lib/stbaldricks/entities/donation/promo_code.rb +22 -0
- data/lib/stbaldricks/entities/donation/recipient_type.rb +17 -0
- data/lib/stbaldricks/entities/donation/special_donation_type.rb +78 -0
- data/lib/stbaldricks/entities/donation/status.rb +12 -0
- data/lib/stbaldricks/entities/donation/submitter_type.rb +13 -0
- data/lib/stbaldricks/entities/donor.rb +15 -0
- data/lib/stbaldricks/entities/event.rb +173 -0
- data/lib/stbaldricks/entities/event/fund_relationship_type.rb +15 -0
- data/lib/stbaldricks/entities/event/how_created.rb +14 -0
- data/lib/stbaldricks/entities/event/promo_code.rb +11 -0
- data/lib/stbaldricks/entities/event/status.rb +13 -0
- data/lib/stbaldricks/entities/event/sub_type.rb +16 -0
- data/lib/stbaldricks/entities/event/type.rb +12 -0
- data/lib/stbaldricks/entities/event_application.rb +135 -0
- data/lib/stbaldricks/entities/event_application/model_type.rb +15 -0
- data/lib/stbaldricks/entities/event_application/status.rb +23 -0
- data/lib/stbaldricks/entities/event_donation_summary.rb +18 -0
- data/lib/stbaldricks/entities/event_participant_summary.rb +17 -0
- data/lib/stbaldricks/entities/event_supporter.rb +24 -0
- data/lib/stbaldricks/entities/fund.rb +98 -0
- data/lib/stbaldricks/entities/fundraiser.rb +124 -0
- data/lib/stbaldricks/entities/international_partner.rb +58 -0
- data/lib/stbaldricks/entities/kid.rb +190 -0
- data/lib/stbaldricks/entities/kid_honor.rb +123 -0
- data/lib/stbaldricks/entities/lib/address.rb +25 -0
- data/lib/stbaldricks/entities/lib/base.rb +505 -0
- data/lib/stbaldricks/entities/lib/cacheable.rb +43 -0
- data/lib/stbaldricks/entities/lib/default_cacheable.rb +17 -0
- data/lib/stbaldricks/entities/lib/email_address.rb +15 -0
- data/lib/stbaldricks/entities/lib/error.rb +38 -0
- data/lib/stbaldricks/entities/lib/fundraising_page.rb +20 -0
- data/lib/stbaldricks/entities/lib/geo_location.rb +9 -0
- data/lib/stbaldricks/entities/lib/location.rb +27 -0
- data/lib/stbaldricks/entities/lib/name.rb +17 -0
- data/lib/stbaldricks/entities/lib/not_implemented_object.rb +32 -0
- data/lib/stbaldricks/entities/lib/opt_out_settings.rb +21 -0
- data/lib/stbaldricks/entities/lib/payment.rb +86 -0
- data/lib/stbaldricks/entities/lib/permissions.rb +33 -0
- data/lib/stbaldricks/entities/lib/phone.rb +29 -0
- data/lib/stbaldricks/entities/lib/third_party_media.rb +20 -0
- data/lib/stbaldricks/entities/lib/top_level.rb +99 -0
- data/lib/stbaldricks/entities/lib/venue.rb +18 -0
- data/lib/stbaldricks/entities/memorial.rb +61 -0
- data/lib/stbaldricks/entities/message.rb +65 -0
- data/lib/stbaldricks/entities/newsletter_recipient.rb +17 -0
- data/lib/stbaldricks/entities/organization.rb +90 -0
- data/lib/stbaldricks/entities/page.rb +49 -0
- data/lib/stbaldricks/entities/participant.rb +216 -0
- data/lib/stbaldricks/entities/person.rb +403 -0
- data/lib/stbaldricks/entities/photo.rb +260 -0
- data/lib/stbaldricks/entities/recurring_gift.rb +215 -0
- data/lib/stbaldricks/entities/response.rb +37 -0
- data/lib/stbaldricks/entities/search.rb +223 -0
- data/lib/stbaldricks/entities/section.rb +15 -0
- data/lib/stbaldricks/entities/shave_schedule.rb +69 -0
- data/lib/stbaldricks/entities/summary.rb +32 -0
- data/lib/stbaldricks/entities/team.rb +95 -0
- data/lib/stbaldricks/entities/user.rb +76 -0
- data/lib/stbaldricks/enums/country.rb +223 -0
- data/lib/stbaldricks/enums/feature.rb +29 -0
- data/lib/stbaldricks/enums/league_status.rb +16 -0
- data/lib/stbaldricks/enums/model_type.rb +39 -0
- data/lib/stbaldricks/enums/permission.rb +223 -0
- data/lib/stbaldricks/enums/permission_model_type.rb +21 -0
- data/lib/stbaldricks/enums/province.rb +39 -0
- data/lib/stbaldricks/enums/state.rb +137 -0
- data/lib/stbaldricks/enums/top_level_category_type.rb +25 -0
- data/lib/stbaldricks/errors.rb +18 -0
- data/lib/stbaldricks/log.rb +16 -0
- data/lib/stbaldricks/patches/array.rb +6 -0
- data/lib/stbaldricks/patches/boolean.rb +25 -0
- data/lib/stbaldricks/patches/class.rb +13 -0
- data/lib/stbaldricks/patches/float.rb +9 -0
- data/lib/stbaldricks/patches/hash.rb +16 -0
- data/lib/stbaldricks/patches/integer.rb +9 -0
- data/lib/stbaldricks/patches/nil.rb +25 -0
- data/lib/stbaldricks/patches/string.rb +54 -0
- data/lib/stbaldricks/request.rb +146 -0
- data/lib/stbaldricks/version.rb +5 -0
- metadata +215 -0
@@ -0,0 +1,403 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/address'
|
2
|
+
require 'stbaldricks/entities/lib/base'
|
3
|
+
require 'stbaldricks/entities/lib/top_level'
|
4
|
+
require 'stbaldricks/entities/lib/email_address'
|
5
|
+
require 'stbaldricks/entities/lib/name'
|
6
|
+
require 'stbaldricks/entities/lib/phone'
|
7
|
+
require 'stbaldricks/enums/league_status'
|
8
|
+
require 'stbaldricks/entities/lib/cacheable'
|
9
|
+
require 'stbaldricks/entities/lib/opt_out_settings'
|
10
|
+
|
11
|
+
module SBF
|
12
|
+
module Client
|
13
|
+
class Person < SBF::Client::TopLevelEntity
|
14
|
+
include Entities::Cacheable
|
15
|
+
disallow_instantiation
|
16
|
+
|
17
|
+
actions DEFAULT_CRUD_ACTIONS
|
18
|
+
blacklist_action :delete
|
19
|
+
|
20
|
+
cache_id -> { [id, type] }
|
21
|
+
cache_id_from_hash ->(h) { [h[:id], h[:type]] }
|
22
|
+
|
23
|
+
module Status
|
24
|
+
PENDING = 'pending' #1
|
25
|
+
ACTIVE = 'active' #2
|
26
|
+
DECEASED = 'deceased' #7 (may be deprecated: working on this with SBF)
|
27
|
+
end
|
28
|
+
|
29
|
+
module Type
|
30
|
+
INDIVIDUAL = 'individual'
|
31
|
+
BUSINESS = 'business'
|
32
|
+
FOUNDATION = 'foundation'
|
33
|
+
|
34
|
+
IDS = {
|
35
|
+
INDIVIDUAL => 1,
|
36
|
+
BUSINESS => 2,
|
37
|
+
FOUNDATION => 3
|
38
|
+
}
|
39
|
+
IDS.freeze
|
40
|
+
|
41
|
+
def self.to_s(type_id)
|
42
|
+
IDS.key(type_id)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.value_of(type)
|
46
|
+
IDS[type]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Gender
|
51
|
+
NOT_SELECTED = 'not_selected'
|
52
|
+
CHOSE_NOT_TO_SPECIFY = 'chose_not_to_specify'
|
53
|
+
MALE = 'male'
|
54
|
+
FEMALE = 'female'
|
55
|
+
end
|
56
|
+
|
57
|
+
module HowCreated
|
58
|
+
WEBSITE = 'website'
|
59
|
+
ADMIN_IMPORT = 'admin_import'
|
60
|
+
ADMIN_CONTROL_PANEL = 'admin_control_panel'
|
61
|
+
SUBMIT_CASH = 'submit_cash'
|
62
|
+
MOBILE = 'mobile'
|
63
|
+
PARTICIPANT_REGISTRATION = 'participant_registration'
|
64
|
+
FUNDRAISER_REGISTRATION = 'fundraiser_registration'
|
65
|
+
FAST_REGISTRATION = 'fast_registration'
|
66
|
+
FAST_DONATION = 'fast_donation'
|
67
|
+
RECURRING_GIFTS = 'recurring'
|
68
|
+
GIVE_ONCE = 'give_once'
|
69
|
+
DONATE = 'donate'
|
70
|
+
end
|
71
|
+
|
72
|
+
class Addresses < SBF::Client::BaseEntity
|
73
|
+
entity_attr_accessor :primary, 'SBF::Client::Address'
|
74
|
+
entity_attr_accessor :secondary, 'SBF::Client::Address'
|
75
|
+
end
|
76
|
+
|
77
|
+
class PhoneNumbers < SBF::Client::BaseEntity
|
78
|
+
entity_attr_accessor :primary, 'SBF::Client::Phone'
|
79
|
+
entity_attr_accessor :secondary, 'SBF::Client::Phone'
|
80
|
+
end
|
81
|
+
|
82
|
+
class EmailAddresses < SBF::Client::BaseEntity
|
83
|
+
entity_attr_accessor :primary, 'SBF::Client::EmailAddress'
|
84
|
+
entity_attr_accessor :secondary, 'SBF::Client::EmailAddress'
|
85
|
+
end
|
86
|
+
|
87
|
+
class Policies < SBF::Client::BaseEntity
|
88
|
+
BACKGROUND_CHECK_YEARS_VALID = 3
|
89
|
+
attr_accessor :is_photo_policy_accepted
|
90
|
+
attr_accessor :background_check_date, :background_check_url
|
91
|
+
|
92
|
+
def background_check_valid_at_date?(check_date)
|
93
|
+
check_date = DateTime.parse(check_date) if check_date.is_a?(String)
|
94
|
+
check_date = DateTime.parse(check_date.to_s) if check_date.is_a?(Date)
|
95
|
+
check_date = DateTime.parse(check_date.strftime('%d/%m/%Y %H:%M:%S')) if check_date.is_a?(Time)
|
96
|
+
background_check_date && check_date.is_a?(DateTime) && background_check_date > check_date.prev_year(SBF::Client::Person::Policies::BACKGROUND_CHECK_YEARS_VALID)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
class HowAffected < SBF::Client::BaseEntity
|
101
|
+
attr_accessor :cancer_type, :family_relationship, :cancer_status
|
102
|
+
attr_reader :is_child_survivor, :is_child_family, :is_child_friend, :is_adult_survivor, :is_adult_friend_or_family, :is_none
|
103
|
+
|
104
|
+
module CancerType
|
105
|
+
ACUTE_LYMPHOBLASTIC_LEUKEMIA = 'Acute lymphoblastic leukemia (ALL)'
|
106
|
+
ACUTE_MYELOID_LEUKEMIA = 'Acute myeloid leukemia (AML)'
|
107
|
+
BRAIN_OR_SPINAL_CORD_TUMOR = 'Brain or spinal cord tumor'
|
108
|
+
CLEAR_CELL_SARCOMA_OF_THE_KIDNEY = 'Clear cell sarcoma of the kidney'
|
109
|
+
EWING_SARCOMA = 'Ewing sarcoma'
|
110
|
+
GERM_CELL_TUMOR = 'Germ cell tumor'
|
111
|
+
HEPATOBLASTOMA = 'Hepatoblastoma'
|
112
|
+
HODGKIN_LYMPHOMA = 'Hodgkin lymphoma'
|
113
|
+
LYMPHOMA = 'Lymphoma'
|
114
|
+
NEUROBLASTOMA = 'Neuroblastoma'
|
115
|
+
NON_HODGKIN_LYMPHOMA = 'Non-Hodgkin lymphoma'
|
116
|
+
OSTEOSARCOMA = 'Osteosarcoma'
|
117
|
+
RETINOBLASTOMA = 'Retinoblastoma'
|
118
|
+
RHABDOMYOSARCOMA = 'Rhabdomyosarcoma'
|
119
|
+
WILMS_OR_OTHER_KIDNEY_TUMOR = 'Wilms or other kidney tumor'
|
120
|
+
ADULT_WITH_A_TYPE_OF_CHILDHOOD_CANCER = 'Adult with a type of childhood cancer'
|
121
|
+
OTHER_CHILDHOOD_CANCER = 'Other childhood cancer'
|
122
|
+
@list = {
|
123
|
+
ACUTE_LYMPHOBLASTIC_LEUKEMIA => 'acute_lymphoblastic_leukemia',
|
124
|
+
ACUTE_MYELOID_LEUKEMIA => 'acute_myeloid_leukemia',
|
125
|
+
BRAIN_OR_SPINAL_CORD_TUMOR => 'brain_or_spinal_cord_tumor',
|
126
|
+
CLEAR_CELL_SARCOMA_OF_THE_KIDNEY => 'kidney_sarcoma',
|
127
|
+
EWING_SARCOMA => 'ewing_sarcoma',
|
128
|
+
GERM_CELL_TUMOR => 'germ_cell_tumor',
|
129
|
+
HEPATOBLASTOMA => 'hepatoblastoma',
|
130
|
+
HODGKIN_LYMPHOMA => 'hodgkin_lymphoma',
|
131
|
+
LYMPHOMA => 'lymphoma',
|
132
|
+
NEUROBLASTOMA => 'neuroblastoma',
|
133
|
+
NON_HODGKIN_LYMPHOMA => 'non_hodgkin_lymphoma',
|
134
|
+
OSTEOSARCOMA => 'osteosarcoma',
|
135
|
+
RETINOBLASTOMA => 'retinoblastoma',
|
136
|
+
RHABDOMYOSARCOMA => 'rhabdomyosarcoma',
|
137
|
+
WILMS_OR_OTHER_KIDNEY_TUMOR => 'wilms_or_other_kidney_tumor',
|
138
|
+
ADULT_WITH_A_TYPE_OF_CHILDHOOD_CANCER => 'adult_with_childhood_cancer',
|
139
|
+
OTHER_CHILDHOOD_CANCER => 'other_childhood_cancer'
|
140
|
+
}.freeze
|
141
|
+
|
142
|
+
class << self
|
143
|
+
attr_reader :list
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
module FamilyRelationship
|
148
|
+
NONE = 'None'
|
149
|
+
MOTHER = 'Mother'
|
150
|
+
FATHER = 'Father'
|
151
|
+
SISTER = 'Sister'
|
152
|
+
BROTHER = 'Brother'
|
153
|
+
AUNT = 'Aunt'
|
154
|
+
UNCLE = 'Uncle'
|
155
|
+
GRANDMOTHER = 'Grandmother'
|
156
|
+
GRANDFATHER = 'Grandfather'
|
157
|
+
STEP_MOTHER = 'Step-Mother'
|
158
|
+
STEP_FATHER = 'Step-Father'
|
159
|
+
LEGAL_GUARDIAN = 'Legal-Guardian'
|
160
|
+
@list = {
|
161
|
+
NONE => 'none',
|
162
|
+
MOTHER => 'mother',
|
163
|
+
FATHER => 'father',
|
164
|
+
SISTER => 'sister',
|
165
|
+
BROTHER => 'brother',
|
166
|
+
AUNT => 'aunt',
|
167
|
+
UNCLE => 'uncle',
|
168
|
+
GRANDMOTHER => 'grandmother',
|
169
|
+
GRANDFATHER => 'grandfather',
|
170
|
+
STEP_MOTHER => 'step_mother',
|
171
|
+
STEP_FATHER => 'step_father',
|
172
|
+
LEGAL_GUARDIAN => 'legal_guardian'
|
173
|
+
}.freeze
|
174
|
+
|
175
|
+
class << self
|
176
|
+
attr_reader :list
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
module CancerStatus
|
181
|
+
CANCER_FREE = 'Cancer free'
|
182
|
+
IN_REMISSION = 'In remission'
|
183
|
+
IN_TREATMENT = 'In treatment'
|
184
|
+
IN_MAINTENANCE = 'In maintenance'
|
185
|
+
LOST_TO_CANCER = 'Lost to cancer'
|
186
|
+
@list = {
|
187
|
+
CANCER_FREE => 'cancer_free',
|
188
|
+
IN_REMISSION => 'in_remission',
|
189
|
+
IN_TREATMENT => 'in_treatment',
|
190
|
+
IN_MAINTENANCE => 'in_maintenance',
|
191
|
+
LOST_TO_CANCER => 'lost_to_cancer'
|
192
|
+
}.freeze
|
193
|
+
|
194
|
+
class << self
|
195
|
+
attr_reader :list
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
class Occupation < SBF::Client::BaseEntity
|
201
|
+
module Type
|
202
|
+
STUDENT = 'Student'
|
203
|
+
EDUCATOR = 'Educator'
|
204
|
+
PHYSICIAN = 'Physician'
|
205
|
+
NURSE = 'Nurse'
|
206
|
+
RESEARCHER = 'Researcher'
|
207
|
+
SOCIAL_WORKER = 'Social Worker'
|
208
|
+
OTHER_CARE_GIVER = 'Other Caregiver'
|
209
|
+
CHILDHOOD_HEALTH_ADVOCATE = 'Childhood Health Advocate'
|
210
|
+
FIREFIGHTER = 'Firefighter'
|
211
|
+
POLICE_OFFICER = 'Police Officer'
|
212
|
+
MILITARY = 'Military'
|
213
|
+
INSURANCE_INDUSTRIES = 'Insurance Industries'
|
214
|
+
BANKING_FINANCE = 'Banking & Finance'
|
215
|
+
SECURITIES_TRADING = 'Securities & Trading'
|
216
|
+
BARBER_COSMETOLOGIST = 'Barber or Cosmetologist'
|
217
|
+
OTHER = 'Other'
|
218
|
+
|
219
|
+
@list = {
|
220
|
+
STUDENT => 'student',
|
221
|
+
EDUCATOR => 'educator',
|
222
|
+
PHYSICIAN => 'physician',
|
223
|
+
NURSE => 'nurse',
|
224
|
+
RESEARCHER => 'researcher',
|
225
|
+
SOCIAL_WORKER => 'social_worker',
|
226
|
+
OTHER_CARE_GIVER => 'other_care_giver',
|
227
|
+
CHILDHOOD_HEALTH_ADVOCATE => 'childhood_health_advocate',
|
228
|
+
FIREFIGHTER => 'firefighter',
|
229
|
+
POLICE_OFFICER => 'police_officer',
|
230
|
+
MILITARY => 'military',
|
231
|
+
INSURANCE_INDUSTRIES => 'insurance_industries',
|
232
|
+
BANKING_FINANCE => 'banking_finance',
|
233
|
+
SECURITIES_TRADING => 'securities_trading',
|
234
|
+
BARBER_COSMETOLOGIST => 'barber_cosmetologist',
|
235
|
+
OTHER => 'other'
|
236
|
+
}.freeze
|
237
|
+
|
238
|
+
class << self
|
239
|
+
attr_reader :list
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
module EducatorType
|
244
|
+
PRESCHOOL = 'Preschool'
|
245
|
+
ELEMENTARY_SCHOOL = 'Elementary School'
|
246
|
+
MIDDLE_SCHOOL = 'Middle School'
|
247
|
+
HIGH_SCHOOL = 'High School'
|
248
|
+
COLLEGE = 'College'
|
249
|
+
|
250
|
+
@list = {
|
251
|
+
PRESCHOOL => 'preschool',
|
252
|
+
ELEMENTARY_SCHOOL => 'elementary_school',
|
253
|
+
MIDDLE_SCHOOL => 'middle_school',
|
254
|
+
HIGH_SCHOOL => 'high_school',
|
255
|
+
COLLEGE => 'college'
|
256
|
+
}.freeze
|
257
|
+
|
258
|
+
class << self
|
259
|
+
attr_reader :list
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
module StudentType
|
264
|
+
ELEMENTARY_SCHOOL = 'Elementary School'
|
265
|
+
MIDDLE_SCHOOL = 'Middle School'
|
266
|
+
HIGH_SCHOOL = 'High School'
|
267
|
+
COLLEGE = 'College'
|
268
|
+
@list = {
|
269
|
+
ELEMENTARY_SCHOOL => 'elementary_school',
|
270
|
+
MIDDLE_SCHOOL => 'middle_school',
|
271
|
+
HIGH_SCHOOL => 'high_school',
|
272
|
+
COLLEGE => 'college'
|
273
|
+
}.freeze
|
274
|
+
|
275
|
+
class << self
|
276
|
+
attr_reader :list
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
module MilitaryBranchType
|
281
|
+
ARMY = 'Army'
|
282
|
+
NAVY = 'Navy'
|
283
|
+
AIR_FORCE = 'Air Force'
|
284
|
+
MARINES = 'Marines'
|
285
|
+
COAST_GUARD = 'Coast Guard'
|
286
|
+
NATIONAL_GUARD = 'National Guard'
|
287
|
+
|
288
|
+
@list = {
|
289
|
+
ARMY => 'army',
|
290
|
+
NAVY => 'navy',
|
291
|
+
AIR_FORCE => 'air_force',
|
292
|
+
MARINES => 'marines',
|
293
|
+
COAST_GUARD => 'coast_guard',
|
294
|
+
NATIONAL_GUARD => 'national_guard'
|
295
|
+
}.freeze
|
296
|
+
|
297
|
+
class << self
|
298
|
+
attr_reader :list
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
module MilitaryStatusType
|
303
|
+
ACTIVE_DUTY = 'Active Duty'
|
304
|
+
RESERVES = 'Reserves'
|
305
|
+
RETIRED = 'Retired'
|
306
|
+
|
307
|
+
@list = {
|
308
|
+
ACTIVE_DUTY => 'active_duty',
|
309
|
+
RESERVES => 'reserves',
|
310
|
+
RETIRED => 'retired'
|
311
|
+
}.freeze
|
312
|
+
|
313
|
+
class << self
|
314
|
+
attr_reader :list
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
class EducationDetails < SBF::Client::BaseEntity
|
319
|
+
attr_accessor :level, :school_name, :is_fraternity_sorority, :fraternity_sorority_name
|
320
|
+
end
|
321
|
+
|
322
|
+
class MilitaryDetails < SBF::Client::BaseEntity
|
323
|
+
attr_accessor :branch, :status, :unit
|
324
|
+
end
|
325
|
+
|
326
|
+
class FinanceDetails < SBF::Client::BaseEntity
|
327
|
+
attr_accessor :industry, :business_name, :job_title
|
328
|
+
end
|
329
|
+
|
330
|
+
attr_accessor :type
|
331
|
+
attr_reader :is_student, :is_educator, :is_military, :is_finance, :is_other
|
332
|
+
|
333
|
+
# TODO: Need to rework this. The details hash needs to contain enough information to be
|
334
|
+
# able to determine what type it should be. As it is currently written, it cannot instanitate itself
|
335
|
+
# without the information contained in the SBF::Client::Person::Occupation instance.
|
336
|
+
attr_accessor :details
|
337
|
+
def details=(value)
|
338
|
+
if educator? || student?
|
339
|
+
@details = SBF::Client::Person::Occupation::EducationDetails.new(value)
|
340
|
+
elsif military?
|
341
|
+
@details = SBF::Client::Person::Occupation::MilitaryDetails.new(value)
|
342
|
+
elsif finance? || other?
|
343
|
+
@details = SBF::Client::Person::Occupation::FinanceDetails.new(value)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
def league_status_title
|
349
|
+
case league_status
|
350
|
+
when SBF::Client::LeagueStatus::SQUIRE
|
351
|
+
'Squire of Hope'
|
352
|
+
when SBF::Client::LeagueStatus::KNIGHT
|
353
|
+
'Knight of the Bald Table'
|
354
|
+
when SBF::Client::LeagueStatus::KNIGHT_COMMANDER
|
355
|
+
'Knight Commander'
|
356
|
+
when SBF::Client::LeagueStatus::CRUSADER
|
357
|
+
'Crusader for a Cure'
|
358
|
+
when SBF::Client::LeagueStatus::NOT_APPLICABLE
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
class PartialPerson < SBF::Client::Person
|
364
|
+
attr_accessor :id, :type
|
365
|
+
end
|
366
|
+
|
367
|
+
class FullPerson < SBF::Client::Person
|
368
|
+
attr_accessor :id
|
369
|
+
attr_accessor :type
|
370
|
+
attr_accessor :status
|
371
|
+
attr_accessor :gender
|
372
|
+
attr_accessor :is_minor
|
373
|
+
attr_accessor :birthday
|
374
|
+
attr_reader :display_name, :first_and_last_name
|
375
|
+
attr_accessor :display_name_override
|
376
|
+
attr_accessor :years_as_participant, :years_as_organizer
|
377
|
+
attr_reader :league_status
|
378
|
+
attr_reader :name
|
379
|
+
entity_attr_accessor :name_pieces, 'SBF::Client::NamePieces'
|
380
|
+
entity_attr_accessor :addresses, 'SBF::Client::Person::Addresses'
|
381
|
+
entity_attr_accessor :phone_numbers, 'SBF::Client::Person::PhoneNumbers'
|
382
|
+
entity_attr_accessor :email_addresses, 'SBF::Client::Person::EmailAddresses'
|
383
|
+
entity_attr_accessor :occupation, 'SBF::Client::Person::Occupation', nil, true
|
384
|
+
entity_attr_accessor :policies, 'SBF::Client::Person::Policies'
|
385
|
+
entity_attr_accessor :how_affected, 'SBF::Client::Person::HowAffected', nil, true
|
386
|
+
entity_attr_accessor :opt_out_settings, 'SBF::Client::OptOutSettings', nil, true
|
387
|
+
attr_reader :created_at, :modified_at
|
388
|
+
attr_accessor :modified_by
|
389
|
+
attr_accessor :how_created
|
390
|
+
|
391
|
+
def active?
|
392
|
+
status == SBF::Client::Person::Status::ACTIVE
|
393
|
+
end
|
394
|
+
|
395
|
+
# Dynamically build convenience methods for checking the person's league status (i.e. 'squire?', 'knight?', etc.)
|
396
|
+
SBF::Client::LeagueStatus.to_a.delete_if { |x| x == SBF::Client::LeagueStatus::NOT_APPLICABLE }.each do |league_status|
|
397
|
+
define_method "#{league_status}?".to_sym do
|
398
|
+
self.league_status == league_status
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
@@ -0,0 +1,260 @@
|
|
1
|
+
require 'stbaldricks/endpoints/photo'
|
2
|
+
require 'stbaldricks/entities/campaign'
|
3
|
+
require 'stbaldricks/entities/event'
|
4
|
+
require 'stbaldricks/entities/event_supporter'
|
5
|
+
require 'stbaldricks/entities/fund'
|
6
|
+
require 'stbaldricks/entities/fundraiser'
|
7
|
+
require 'stbaldricks/entities/kid'
|
8
|
+
require 'stbaldricks/entities/memorial'
|
9
|
+
require 'stbaldricks/entities/participant'
|
10
|
+
require 'stbaldricks/entities/team'
|
11
|
+
require 'stbaldricks/entities/lib/top_level'
|
12
|
+
|
13
|
+
module SBF
|
14
|
+
module Client
|
15
|
+
class Photo < SBF::Client::TopLevelEntity
|
16
|
+
endpoint SBF::Client::PhotoEndpoint
|
17
|
+
actions DEFAULT_CRUD_ACTIONS
|
18
|
+
|
19
|
+
attr_accessor :id
|
20
|
+
attr_accessor :caption
|
21
|
+
attr_accessor :sort_order
|
22
|
+
attr_accessor :category
|
23
|
+
attr_accessor :file
|
24
|
+
attr_accessor :filename
|
25
|
+
multitype_attr_accessor(
|
26
|
+
:model,
|
27
|
+
[
|
28
|
+
[
|
29
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::PARTICIPANT },
|
30
|
+
'SBF::Client::Photo::FullParticipant',
|
31
|
+
'SBF::Client::Photo::PartialParticipant'
|
32
|
+
],
|
33
|
+
[
|
34
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::FUNDRAISER },
|
35
|
+
'SBF::Client::Photo::FullFundraiser',
|
36
|
+
'SBF::Client::Photo::PartialFundraiser'
|
37
|
+
],
|
38
|
+
[
|
39
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::FUND },
|
40
|
+
'SBF::Client::Photo::FullFund',
|
41
|
+
'SBF::Client::Photo::PartialFund'
|
42
|
+
],
|
43
|
+
[
|
44
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::CAMPAIGN },
|
45
|
+
'SBF::Client::Photo::FullCampaign',
|
46
|
+
'SBF::Client::Photo::PartialCampaign'
|
47
|
+
],
|
48
|
+
[
|
49
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::TEAM },
|
50
|
+
'SBF::Client::Photo::FullTeam',
|
51
|
+
'SBF::Client::Photo::PartialTeam'
|
52
|
+
],
|
53
|
+
[
|
54
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::EVENT },
|
55
|
+
'SBF::Client::Photo::FullEvent',
|
56
|
+
'SBF::Client::Photo::PartialEvent'
|
57
|
+
],
|
58
|
+
[
|
59
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::KID },
|
60
|
+
'SBF::Client::Photo::FullKid',
|
61
|
+
'SBF::Client::Photo::PartialKid'
|
62
|
+
],
|
63
|
+
[
|
64
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::EVENT_SUPPORTER },
|
65
|
+
'SBF::Client::Photo::FullEventSupporter',
|
66
|
+
'SBF::Client::Photo::PartialEventSupporter'
|
67
|
+
],
|
68
|
+
[
|
69
|
+
->(v) { v[:model_type] == SBF::Client::Photo::ModelType::MEMORIAL },
|
70
|
+
'SBF::Client::Photo::FullMemorial',
|
71
|
+
'SBF::Client::Photo::PartialMemorial'
|
72
|
+
]
|
73
|
+
],
|
74
|
+
optional: false
|
75
|
+
)
|
76
|
+
attr_accessor :base_photo_url
|
77
|
+
attr_reader :original_file_id
|
78
|
+
attr_reader :original_filename
|
79
|
+
|
80
|
+
def to_json(*a)
|
81
|
+
to_hash.reject { |k, _v| [:file, :filename].include? k }.to_json(*a)
|
82
|
+
end
|
83
|
+
|
84
|
+
module Category
|
85
|
+
SHAVEE_AFTER = 'shavee_after'
|
86
|
+
SHAVEE_BEFORE = 'shavee_before'
|
87
|
+
KID = 'kid'
|
88
|
+
PARTICIPANT = 'participant'
|
89
|
+
TEAM_LOGO = 'team_logo'
|
90
|
+
VENUE_LOGO = 'venue_logo'
|
91
|
+
USER_AVATAR = 'user_avatar'
|
92
|
+
GALLERY = 'gallery'
|
93
|
+
DEFAULT_PHOTO = 'default_photo'
|
94
|
+
CAMPAIGN_LOGO = 'campaign_logo'
|
95
|
+
FUND_LOGO = 'fund_logo'
|
96
|
+
FUNDRAISER_LOGO = 'fundraiser_logo'
|
97
|
+
EVENT_SUPPORTER_LOGO = 'event_supporter_logo'
|
98
|
+
MEMORIAL = 'memorial'
|
99
|
+
COVER_ORIGINAL = 'cover_original'
|
100
|
+
COVER_DEFAULT = 'cover_default'
|
101
|
+
end
|
102
|
+
|
103
|
+
module ModelType
|
104
|
+
EVENT = 'event'
|
105
|
+
TEAM = 'team'
|
106
|
+
PARTICIPANT = 'participant'
|
107
|
+
FUNDRAISER = 'fundraiser'
|
108
|
+
KID = 'kid'
|
109
|
+
FUND = 'fund'
|
110
|
+
CAMPAIGN = 'campaign'
|
111
|
+
EVENT_SUPPORTER = 'event_supporter'
|
112
|
+
MEMORIAL = 'memorial'
|
113
|
+
end
|
114
|
+
|
115
|
+
class FullParticipant < SBF::Client::FullParticipant
|
116
|
+
attr_reader :model_type
|
117
|
+
|
118
|
+
def model_type
|
119
|
+
SBF::Client::Photo::ModelType::PARTICIPANT
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
class PartialParticipant < SBF::Client::PartialParticipant
|
124
|
+
attr_reader :model_type
|
125
|
+
|
126
|
+
def model_type
|
127
|
+
SBF::Client::Photo::ModelType::PARTICIPANT
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
class FullFundraiser < SBF::Client::FullFundraiser
|
132
|
+
attr_reader :model_type
|
133
|
+
|
134
|
+
def model_type
|
135
|
+
SBF::Client::Photo::ModelType::FUNDRAISER
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class PartialFundraiser < SBF::Client::PartialFundraiser
|
140
|
+
attr_reader :model_type
|
141
|
+
|
142
|
+
def model_type
|
143
|
+
SBF::Client::Photo::ModelType::FUNDRAISER
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
class FullTeam < SBF::Client::FullTeam
|
148
|
+
attr_reader :model_type
|
149
|
+
|
150
|
+
def model_type
|
151
|
+
SBF::Client::Photo::ModelType::TEAM
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
class PartialTeam < SBF::Client::PartialTeam
|
156
|
+
attr_reader :model_type
|
157
|
+
|
158
|
+
def model_type
|
159
|
+
SBF::Client::Photo::ModelType::TEAM
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
class FullEvent < SBF::Client::FullEvent
|
164
|
+
attr_reader :model_type
|
165
|
+
|
166
|
+
def model_type
|
167
|
+
SBF::Client::Photo::ModelType::EVENT
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
class PartialEvent < SBF::Client::PartialEvent
|
172
|
+
attr_reader :model_type
|
173
|
+
|
174
|
+
def model_type
|
175
|
+
SBF::Client::Photo::ModelType::EVENT
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
class FullKid < SBF::Client::FullKid
|
180
|
+
attr_reader :model_type
|
181
|
+
|
182
|
+
def model_type
|
183
|
+
SBF::Client::Photo::ModelType::KID
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
class PartialKid < SBF::Client::PartialKid
|
188
|
+
attr_reader :model_type
|
189
|
+
|
190
|
+
def model_type
|
191
|
+
SBF::Client::Photo::ModelType::KID
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
class FullFund < SBF::Client::FullFund
|
196
|
+
attr_reader :model_type
|
197
|
+
|
198
|
+
def model_type
|
199
|
+
SBF::Client::Photo::ModelType::FUND
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
class PartialFund < SBF::Client::PartialFund
|
204
|
+
attr_reader :model_type
|
205
|
+
|
206
|
+
def model_type
|
207
|
+
SBF::Client::Photo::ModelType::FUND
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
class FullCampaign < SBF::Client::FullCampaign
|
212
|
+
attr_reader :model_type
|
213
|
+
|
214
|
+
def model_type
|
215
|
+
SBF::Client::Photo::ModelType::CAMPAIGN
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
class PartialCampaign < SBF::Client::PartialCampaign
|
220
|
+
attr_reader :model_type
|
221
|
+
|
222
|
+
def model_type
|
223
|
+
SBF::Client::Photo::ModelType::CAMPAIGN
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
class FullEventSupporter < SBF::Client::FullEventSupporter
|
228
|
+
attr_reader :model_type
|
229
|
+
|
230
|
+
def model_type
|
231
|
+
SBF::Client::Photo::ModelType::EVENT_SUPPORTER
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class PartialEventSupporter < SBF::Client::PartialEventSupporter
|
236
|
+
attr_reader :model_type
|
237
|
+
|
238
|
+
def model_type
|
239
|
+
SBF::Client::Photo::ModelType::EVENT_SUPPORTER
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
class FullMemorial < SBF::Client::FullMemorial
|
244
|
+
attr_reader :model_type
|
245
|
+
|
246
|
+
def model_type
|
247
|
+
SBF::Client::Photo::ModelType::MEMORIAL
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
class PartialMemorial < SBF::Client::PartialMemorial
|
252
|
+
attr_reader :model_type
|
253
|
+
|
254
|
+
def model_type
|
255
|
+
SBF::Client::Photo::ModelType::MEMORIAL
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|