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,16 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
|
3
|
+
module SBF
|
4
|
+
module Client
|
5
|
+
class Event < SBF::Client::TopLevelEntity
|
6
|
+
module SubType
|
7
|
+
NONE = 'none'
|
8
|
+
VIRTUAL = 'virtual'
|
9
|
+
CAMPUS = 'campus'
|
10
|
+
COMMUNITY = 'community'
|
11
|
+
CORPORATE = 'corporate'
|
12
|
+
SCHOOL = 'school'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require 'stbaldricks/endpoints/event_application'
|
2
|
+
require 'stbaldricks/entities/fund'
|
3
|
+
require 'stbaldricks/entities/campaign'
|
4
|
+
require 'stbaldricks/entities/event'
|
5
|
+
require 'stbaldricks/entities/team'
|
6
|
+
require 'stbaldricks/entities/participant'
|
7
|
+
require 'stbaldricks/entities/fundraiser'
|
8
|
+
require 'stbaldricks/entities/lib/address'
|
9
|
+
require 'stbaldricks/entities/lib/base'
|
10
|
+
require 'stbaldricks/entities/lib/top_level'
|
11
|
+
require 'stbaldricks/entities/lib/name'
|
12
|
+
|
13
|
+
module SBF
|
14
|
+
module Client
|
15
|
+
class EventApplication < SBF::Client::TopLevelEntity
|
16
|
+
endpoint SBF::Client::EventApplicationEndpoint
|
17
|
+
actions DEFAULT_CRUD_ACTIONS
|
18
|
+
blacklist_action :delete
|
19
|
+
|
20
|
+
class FullParticipant < SBF::Client::FullParticipant
|
21
|
+
attr_reader :model_type
|
22
|
+
|
23
|
+
def model_type
|
24
|
+
SBF::Client::EventApplication::ModelType::PARTICIPANT
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class PartialParticipant < SBF::Client::PartialParticipant
|
29
|
+
attr_reader :model_type
|
30
|
+
attr_accessor :year
|
31
|
+
|
32
|
+
def model_type
|
33
|
+
SBF::Client::EventApplication::ModelType::PARTICIPANT
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class FullFundraiser < SBF::Client::FullFundraiser
|
38
|
+
attr_reader :model_type
|
39
|
+
|
40
|
+
def model_type
|
41
|
+
SBF::Client::EventApplication::ModelType::FUNDRAISER
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class PartialFundraiser < SBF::Client::PartialFundraiser
|
46
|
+
attr_reader :model_type
|
47
|
+
attr_accessor :year
|
48
|
+
|
49
|
+
def model_type
|
50
|
+
SBF::Client::EventApplication::ModelType::FUNDRAISER
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class FullTeam < SBF::Client::FullTeam
|
55
|
+
attr_reader :model_type
|
56
|
+
|
57
|
+
def model_type
|
58
|
+
SBF::Client::EventApplication::ModelType::TEAM
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class PartialTeam < SBF::Client::PartialTeam
|
63
|
+
attr_reader :model_type
|
64
|
+
attr_accessor :year
|
65
|
+
|
66
|
+
def model_type
|
67
|
+
SBF::Client::EventApplication::ModelType::TEAM
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class FullEvent < SBF::Client::FullEvent
|
72
|
+
attr_reader :model_type
|
73
|
+
|
74
|
+
def model_type
|
75
|
+
SBF::Client::EventApplication::ModelType::EVENT
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class PartialEvent < SBF::Client::PartialEvent
|
80
|
+
attr_reader :model_type
|
81
|
+
|
82
|
+
def model_type
|
83
|
+
SBF::Client::EventApplication::ModelType::EVENT
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
class Requestor < SBF::Client::BaseEntity
|
88
|
+
attr_accessor :name
|
89
|
+
entity_attr_accessor :name_pieces, 'SBF::Client::NamePieces'
|
90
|
+
entity_attr_accessor :email_address, 'SBF::Client::EmailAddress'
|
91
|
+
entity_attr_accessor :phone, 'SBF::Client::Phone'
|
92
|
+
entity_attr_accessor :address, 'SBF::Client::Address'
|
93
|
+
end
|
94
|
+
|
95
|
+
attr_accessor :id
|
96
|
+
attr_accessor :requested_event_title
|
97
|
+
attr_accessor :status
|
98
|
+
attr_accessor :is_archived
|
99
|
+
attr_accessor :no_conversion_reason
|
100
|
+
attr_accessor :promotional_code
|
101
|
+
attr_accessor :created_at, :modified_at
|
102
|
+
entity_attr_accessor :requestor, 'SBF::Client::EventApplication::Requestor'
|
103
|
+
entity_attr_accessor :qualifier, 'SBF::Client::FullPerson', 'SBF::Client::PartialPerson', true
|
104
|
+
entity_attr_accessor :fund, 'SBF::Client::FullFund', 'SBF::Client::PartialFund', true
|
105
|
+
entity_attr_accessor :campaign, 'SBF::Client::FullCampaign', 'SBF::Client::PartialCampaign', true
|
106
|
+
|
107
|
+
multitype_attr_accessor(
|
108
|
+
:model,
|
109
|
+
[
|
110
|
+
[
|
111
|
+
->(v) { v[:model_type] == SBF::Client::EventApplication::ModelType::PARTICIPANT },
|
112
|
+
'SBF::Client::EventApplication::FullParticipant',
|
113
|
+
'SBF::Client::EventApplication::PartialParticipant'
|
114
|
+
],
|
115
|
+
[
|
116
|
+
->(v) { v[:model_type] == SBF::Client::EventApplication::ModelType::FUNDRAISER },
|
117
|
+
'SBF::Client::EventApplication::FullFundraiser',
|
118
|
+
'SBF::Client::EventApplication::PartialFundraiser'
|
119
|
+
],
|
120
|
+
[
|
121
|
+
->(v) { v[:model_type] == SBF::Client::EventApplication::ModelType::TEAM },
|
122
|
+
'SBF::Client::EventApplication::FullTeam',
|
123
|
+
'SBF::Client::EventApplication::PartialTeam'
|
124
|
+
],
|
125
|
+
[
|
126
|
+
->(v) { v[:model_type] == SBF::Client::EventApplication::ModelType::EVENT },
|
127
|
+
'SBF::Client::EventApplication::FullEvent',
|
128
|
+
'SBF::Client::EventApplication::PartialEvent'
|
129
|
+
]
|
130
|
+
],
|
131
|
+
optional: true
|
132
|
+
)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
|
3
|
+
module SBF
|
4
|
+
module Client
|
5
|
+
class EventApplication < SBF::Client::TopLevelEntity
|
6
|
+
module ModelType
|
7
|
+
EVENT = 'event'
|
8
|
+
TEAM = 'team'
|
9
|
+
PARTICIPANT = 'participant'
|
10
|
+
FUNDRAISER = 'fundraiser'
|
11
|
+
MEMORIAL = 'memorial'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
|
3
|
+
module SBF
|
4
|
+
module Client
|
5
|
+
class EventApplication < SBF::Client::TopLevelEntity
|
6
|
+
module Status
|
7
|
+
NEW = 'new'
|
8
|
+
REACHED_OUT = 'reached_out'
|
9
|
+
CREATED_EVENT = 'created_event'
|
10
|
+
CREATED_PARTICIPANT = 'created_participant'
|
11
|
+
CREATED_TEAM = 'created_team'
|
12
|
+
CREATED_FUNDRAISER = 'created_fundraiser'
|
13
|
+
NO_CONVERSION = 'no_conversion'
|
14
|
+
CONNECTED = 'connected'
|
15
|
+
DUPLICATE = 'duplicate'
|
16
|
+
CREATED_DONOR = 'created_donor'
|
17
|
+
NEXT_YEAR = 'next_year'
|
18
|
+
FINALIZING = 'finalizing'
|
19
|
+
CREATED_MEMORIAL = 'created_memorial'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
|
3
|
+
module SBF
|
4
|
+
module Client
|
5
|
+
class EventDonationSummary < SBF::Client::TopLevelEntity
|
6
|
+
actions DEFAULT_CRUD_ACTIONS
|
7
|
+
blacklist_action :get
|
8
|
+
blacklist_action :create
|
9
|
+
blacklist_action :update
|
10
|
+
blacklist_action :delete
|
11
|
+
|
12
|
+
attr_accessor :amount_raised
|
13
|
+
attr_accessor :donations
|
14
|
+
attr_accessor :direct_amount_raised
|
15
|
+
attr_accessor :direct_donations
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
|
3
|
+
module SBF
|
4
|
+
module Client
|
5
|
+
class EventParticipantSummary < SBF::Client::TopLevelEntity
|
6
|
+
actions DEFAULT_CRUD_ACTIONS
|
7
|
+
blacklist_action :get
|
8
|
+
blacklist_action :create
|
9
|
+
blacklist_action :update
|
10
|
+
blacklist_action :delete
|
11
|
+
|
12
|
+
attr_accessor :shavees
|
13
|
+
attr_accessor :non_shavees
|
14
|
+
attr_accessor :participants
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
require 'stbaldricks/entities/event'
|
3
|
+
require 'htmlentities'
|
4
|
+
|
5
|
+
module SBF
|
6
|
+
module Client
|
7
|
+
class EventSupporter < SBF::Client::TopLevelEntity
|
8
|
+
actions DEFAULT_CRUD_ACTIONS
|
9
|
+
|
10
|
+
disallow_instantiation
|
11
|
+
attr_accessor :id, :sort_order
|
12
|
+
end
|
13
|
+
|
14
|
+
class PartialEventSupporter < EventSupporter
|
15
|
+
end
|
16
|
+
|
17
|
+
class FullEventSupporter < EventSupporter
|
18
|
+
attr_accessor :photo_url
|
19
|
+
attr_accessor :name, :url
|
20
|
+
entity_attr_accessor :event, 'SBF::Client::FullEvent', 'SBF::Client::PartialEvent', true
|
21
|
+
entity_attr_accessor :photo, 'SBF::Client::Photo'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'stbaldricks/entities/fund'
|
2
|
+
require 'stbaldricks/entities/lib/top_level'
|
3
|
+
require 'stbaldricks/entities/lib/fundraising_page'
|
4
|
+
require 'stbaldricks/endpoints/fund'
|
5
|
+
require 'htmlentities'
|
6
|
+
|
7
|
+
module SBF
|
8
|
+
module Client
|
9
|
+
class Fund < SBF::Client::TopLevelEntity
|
10
|
+
endpoint SBF::Client::FundEndpoint
|
11
|
+
action :allowed_entities
|
12
|
+
action :get
|
13
|
+
action :find
|
14
|
+
action :find_first
|
15
|
+
action :update
|
16
|
+
|
17
|
+
disallow_instantiation
|
18
|
+
|
19
|
+
class Photos < SBF::Client::BaseEntity
|
20
|
+
attr_reader :avatar, :default
|
21
|
+
end
|
22
|
+
|
23
|
+
class YearlyTotals < SBF::Client::BaseEntity
|
24
|
+
attr_reader :year
|
25
|
+
attr_reader :fundraisers
|
26
|
+
attr_reader :participants
|
27
|
+
attr_reader :shavees
|
28
|
+
attr_reader :non_shavees
|
29
|
+
attr_reader :teams
|
30
|
+
attr_reader :events
|
31
|
+
attr_reader :amount_raised
|
32
|
+
|
33
|
+
def to_hash
|
34
|
+
{}.tap do |hsh|
|
35
|
+
self.class.attributes.each { |name| hsh[name] = send(name.to_sym) unless name.to_sym == :year }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Totals < SBF::Client::BaseEntity
|
41
|
+
attr_reader :fundraisers
|
42
|
+
attr_reader :participants
|
43
|
+
attr_reader :shavees
|
44
|
+
attr_reader :non_shavees
|
45
|
+
attr_reader :teams
|
46
|
+
attr_reader :events
|
47
|
+
attr_reader :amount_raised
|
48
|
+
end
|
49
|
+
|
50
|
+
class Photos < SBF::Client::BaseEntity
|
51
|
+
attr_reader :avatar, :default
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class PartialFund < Fund
|
56
|
+
attr_accessor :id
|
57
|
+
end
|
58
|
+
|
59
|
+
class FullFund < Fund
|
60
|
+
attr_accessor :id
|
61
|
+
attr_reader :display_name
|
62
|
+
attr_accessor :name
|
63
|
+
attr_accessor :disabled
|
64
|
+
attr_accessor :description
|
65
|
+
entity_attr_accessor :photos, 'SBF::Client::Fund::Photos'
|
66
|
+
entity_attr_reader :totals, 'SBF::Client::Fund::Totals'
|
67
|
+
entity_collection_attr_accessor :totals_by_year, 'SBF::Client::Fund::Total'
|
68
|
+
entity_attr_accessor :fundraising_page, 'SBF::Client::FundraisingPage', nil, true
|
69
|
+
entity_attr_accessor :photos, 'SBF::Client::Fund::Photos'
|
70
|
+
attr_accessor :kid_name
|
71
|
+
attr_accessor :offline_donation_uuid, :offline_donation_form
|
72
|
+
|
73
|
+
def display_name
|
74
|
+
HTMLEntities.new.decode(@display_name)
|
75
|
+
end
|
76
|
+
|
77
|
+
def totals_by_year=(value)
|
78
|
+
return [] if value.nil? || value.empty?
|
79
|
+
|
80
|
+
@totals_by_year = value.map { |k, v|
|
81
|
+
SBF::Client::Fund::YearlyTotals.new(v.merge(year: k.to_s.to_i))
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
def to_hash
|
86
|
+
hsh = super.to_hash
|
87
|
+
return hsh if @totals_by_year.nil?
|
88
|
+
|
89
|
+
hsh[:totals_by_year] = {}
|
90
|
+
@totals_by_year.each do |year_total|
|
91
|
+
hsh[:totals_by_year][year_total.year.to_s.to_sym] = year_total.to_hash
|
92
|
+
end
|
93
|
+
|
94
|
+
hsh
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'stbaldricks/entities/lib/top_level'
|
2
|
+
require 'stbaldricks/entities/person'
|
3
|
+
require 'stbaldricks/entities/fund'
|
4
|
+
require 'stbaldricks/entities/event'
|
5
|
+
require 'stbaldricks/entities/team'
|
6
|
+
require 'stbaldricks/entities/lib/fundraising_page'
|
7
|
+
require 'stbaldricks/entities/lib/venue'
|
8
|
+
require 'stbaldricks/entities/lib/permissions'
|
9
|
+
require 'htmlentities'
|
10
|
+
require 'stbaldricks/entities/lib/default_cacheable'
|
11
|
+
|
12
|
+
module SBF
|
13
|
+
module Client
|
14
|
+
class Fundraiser < SBF::Client::TopLevelEntity
|
15
|
+
include Entities::DefaultCacheable
|
16
|
+
actions DEFAULT_CRUD_ACTIONS
|
17
|
+
|
18
|
+
disallow_instantiation
|
19
|
+
|
20
|
+
module Status
|
21
|
+
ACTIVE = 'active'
|
22
|
+
PENDING = 'pending'
|
23
|
+
end
|
24
|
+
|
25
|
+
module HowCreated
|
26
|
+
WEBSITE = 'website'
|
27
|
+
ADMIN_CONTROL_PANEL = 'admin_control_panel'
|
28
|
+
ADMIN_IMPORT = 'admin_import'
|
29
|
+
LEGACY = 'legacy'
|
30
|
+
MOBILE = 'mobile'
|
31
|
+
end
|
32
|
+
|
33
|
+
module FundRelationshipType
|
34
|
+
NO_ASSOCIATION = 'no_association'
|
35
|
+
INDIRECT_ONE = 'indirect_one'
|
36
|
+
INDIRECT_MULTIPLE = 'indirect_multiple'
|
37
|
+
DIRECT = 'direct'
|
38
|
+
DIRECT_BUT_LOCKED = 'direct_but_locked'
|
39
|
+
INHERITED_TEAM = 'inherited_team'
|
40
|
+
INHERITED_EVENT = 'inherited_event'
|
41
|
+
INHERITED_TEAMS_EVENT = 'inherited_teams_event'
|
42
|
+
INHERITED_BOTH_TEAM_AND_EVENT = 'inherited_both_team_and_event'
|
43
|
+
end
|
44
|
+
|
45
|
+
class Photos < SBF::Client::BaseEntity
|
46
|
+
attr_reader :avatar, :default
|
47
|
+
end
|
48
|
+
|
49
|
+
class Policies < SBF::Client::BaseEntity
|
50
|
+
attr_accessor :is_waiver_policy_accepted
|
51
|
+
end
|
52
|
+
|
53
|
+
class Totals < SBF::Client::BaseEntity
|
54
|
+
attr_reader :amount_raised
|
55
|
+
attr_reader :donations
|
56
|
+
end
|
57
|
+
|
58
|
+
class Rankings < SBF::Client::BaseEntity
|
59
|
+
class Ranking < SBF::Client::BaseEntity
|
60
|
+
attr_reader :rank, :total
|
61
|
+
end
|
62
|
+
|
63
|
+
entity_attr_reader :team, 'SBF::Client::Fundraiser::Rankings::Ranking'
|
64
|
+
entity_attr_reader :event, 'SBF::Client::Fundraiser::Rankings::Ranking'
|
65
|
+
end
|
66
|
+
|
67
|
+
class Venue < SBF::Client::BaseEntity
|
68
|
+
entity_attr_accessor :location, 'SBF::Client::Fundraiser::Location'
|
69
|
+
end
|
70
|
+
|
71
|
+
class Location < SBF::Client::BaseEntity
|
72
|
+
attr_accessor :name
|
73
|
+
entity_attr_accessor :address, 'SBF::Client::Address'
|
74
|
+
|
75
|
+
def name
|
76
|
+
HTMLEntities.new.decode(@name)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class PartialFundraiser < Fundraiser
|
82
|
+
attr_accessor :id
|
83
|
+
end
|
84
|
+
|
85
|
+
class FullFundraiser < Fundraiser
|
86
|
+
attr_accessor :id
|
87
|
+
attr_accessor :status
|
88
|
+
attr_accessor :title
|
89
|
+
attr_accessor :display_name_override
|
90
|
+
attr_reader :display_name
|
91
|
+
entity_attr_accessor :owner, 'SBF::Client::FullPerson'
|
92
|
+
attr_accessor :start_date, :end_date
|
93
|
+
attr_accessor :start_time, :end_time
|
94
|
+
attr_accessor :offline_donation_uuid, :offline_donation_form
|
95
|
+
attr_accessor :fundraising_goal, :fundraising_message
|
96
|
+
entity_attr_accessor :fundraising_page, 'SBF::Client::FundraisingPage', nil, true
|
97
|
+
entity_attr_accessor :event, 'SBF::Client::FullEvent', 'SBF::Client::PartialEvent', true
|
98
|
+
entity_attr_accessor :team, 'SBF::Client::FullTeam', 'SBF::Client::PartialTeam', true
|
99
|
+
entity_attr_accessor :fund, 'SBF::Client::FullFund', 'SBF::Client::PartialFund', true
|
100
|
+
attr_accessor :fund_relationship_type
|
101
|
+
entity_attr_accessor :venue, 'SBF::Client::Fundraiser::Venue'
|
102
|
+
entity_attr_accessor :photos, 'SBF::Client::Fundraiser::Photos'
|
103
|
+
entity_attr_accessor :policies, 'SBF::Client::Fundraiser::Policies'
|
104
|
+
entity_attr_reader :rankings, 'SBF::Client::Fundraiser::Rankings', nil, true
|
105
|
+
entity_attr_reader :totals, 'SBF::Client::Fundraiser::Totals'
|
106
|
+
attr_reader :created_at, :modified_at
|
107
|
+
attr_accessor :modified_by
|
108
|
+
attr_accessor :how_created
|
109
|
+
entity_attr_reader :permissions, 'SBF::Client::Permissions', nil, true
|
110
|
+
|
111
|
+
def active?
|
112
|
+
status == SBF::Client::Fundraiser::Status::ACTIVE
|
113
|
+
end
|
114
|
+
|
115
|
+
def display_name
|
116
|
+
HTMLEntities.new.decode(@display_name)
|
117
|
+
end
|
118
|
+
|
119
|
+
def title
|
120
|
+
HTMLEntities.new.decode(@title)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|