stbaldricks 12.15.0.alpha.1 → 12.15.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stbaldricks/configuration.rb +2 -2
- data/lib/stbaldricks/default_logger.rb +2 -2
- data/lib/stbaldricks/endpoints/blog_post.rb +8 -8
- data/lib/stbaldricks/endpoints/communicate.rb +1 -1
- data/lib/stbaldricks/endpoints/config.rb +1 -1
- data/lib/stbaldricks/endpoints/deduplicator_match.rb +2 -2
- data/lib/stbaldricks/endpoints/kid.rb +1 -1
- data/lib/stbaldricks/endpoints/lib/entity.rb +11 -13
- data/lib/stbaldricks/endpoints/newsletter_recipient.rb +5 -11
- data/lib/stbaldricks/endpoints/participant.rb +3 -3
- data/lib/stbaldricks/endpoints/photo.rb +4 -5
- data/lib/stbaldricks/endpoints/search.rb +2 -2
- data/lib/stbaldricks/endpoints/user.rb +1 -1
- data/lib/stbaldricks/entities/batch.rb +5 -3
- data/lib/stbaldricks/entities/blog_post.rb +7 -1
- data/lib/stbaldricks/entities/campaign.rb +13 -6
- data/lib/stbaldricks/entities/challenge.rb +6 -4
- data/lib/stbaldricks/entities/challenger.rb +6 -4
- data/lib/stbaldricks/entities/concerns/entity_response_concern.rb +1 -1
- data/lib/stbaldricks/entities/config.rb +8 -3
- data/lib/stbaldricks/entities/contact.rb +7 -4
- data/lib/stbaldricks/entities/contact_group.rb +2 -2
- data/lib/stbaldricks/entities/deduplicator_history.rb +6 -1
- data/lib/stbaldricks/entities/deduplicator_match.rb +7 -4
- data/lib/stbaldricks/entities/disease.rb +5 -2
- data/lib/stbaldricks/entities/document_library.rb +8 -3
- data/lib/stbaldricks/entities/document_library_category.rb +4 -1
- data/lib/stbaldricks/entities/donation/payment_gateway.rb +5 -0
- data/lib/stbaldricks/entities/donation/payment_type.rb +4 -0
- data/lib/stbaldricks/entities/donation.rb +23 -13
- data/lib/stbaldricks/entities/donor.rb +5 -1
- data/lib/stbaldricks/entities/event.rb +44 -33
- data/lib/stbaldricks/entities/event_application.rb +10 -6
- data/lib/stbaldricks/entities/event_donation_summary.rb +5 -2
- data/lib/stbaldricks/entities/event_participant_summary.rb +3 -1
- data/lib/stbaldricks/entities/event_supporter.rb +3 -3
- data/lib/stbaldricks/entities/fund.rb +23 -6
- data/lib/stbaldricks/entities/fundraiser.rb +29 -16
- data/lib/stbaldricks/entities/grant.rb +25 -12
- data/lib/stbaldricks/entities/institution.rb +4 -3
- data/lib/stbaldricks/entities/international_partner.rb +16 -4
- data/lib/stbaldricks/entities/kid.rb +28 -11
- data/lib/stbaldricks/entities/kid_honor.rb +0 -1
- data/lib/stbaldricks/entities/kid_institution.rb +2 -2
- data/lib/stbaldricks/entities/lib/address.rb +6 -3
- data/lib/stbaldricks/entities/lib/alternate_shipping_address.rb +3 -1
- data/lib/stbaldricks/entities/lib/base.rb +39 -47
- data/lib/stbaldricks/entities/lib/collection.rb +2 -2
- data/lib/stbaldricks/entities/lib/email_address.rb +2 -1
- data/lib/stbaldricks/entities/lib/fundraising_page.rb +2 -1
- data/lib/stbaldricks/entities/lib/location.rb +0 -1
- data/lib/stbaldricks/entities/lib/milestone.rb +3 -1
- data/lib/stbaldricks/entities/lib/name.rb +2 -2
- data/lib/stbaldricks/entities/lib/not_implemented_object.rb +1 -1
- data/lib/stbaldricks/entities/lib/payment.rb +33 -0
- data/lib/stbaldricks/entities/lib/permissions.rb +4 -2
- data/lib/stbaldricks/entities/lib/phone.rb +3 -2
- data/lib/stbaldricks/entities/lib/third_party_media.rb +5 -1
- data/lib/stbaldricks/entities/lib/top_level.rb +1 -1
- data/lib/stbaldricks/entities/matching_gift_company.rb +39 -16
- data/lib/stbaldricks/entities/memorial.rb +14 -9
- data/lib/stbaldricks/entities/message.rb +15 -4
- data/lib/stbaldricks/entities/organization.rb +17 -11
- data/lib/stbaldricks/entities/page.rb +17 -8
- data/lib/stbaldricks/entities/participant.rb +28 -18
- data/lib/stbaldricks/entities/participant_donation_summary.rb +4 -2
- data/lib/stbaldricks/entities/person.rb +31 -22
- data/lib/stbaldricks/entities/person_donation_by_year_summary.rb +2 -1
- data/lib/stbaldricks/entities/photo.rb +11 -5
- data/lib/stbaldricks/entities/recurring_gift.rb +18 -10
- data/lib/stbaldricks/entities/response.rb +0 -1
- data/lib/stbaldricks/entities/search.rb +168 -30
- data/lib/stbaldricks/entities/section.rb +4 -1
- data/lib/stbaldricks/entities/shave_schedule.rb +13 -4
- data/lib/stbaldricks/entities/summary.rb +7 -1
- data/lib/stbaldricks/entities/team.rb +16 -12
- data/lib/stbaldricks/entities/team_donation_summary.rb +4 -2
- data/lib/stbaldricks/request.rb +2 -2
- data/lib/stbaldricks/version.rb +1 -1
- data/lib/stbaldricks_factories.rb +5 -0
- data/spec/factories/address.rb +14 -0
- data/spec/factories/campaign/totals.rb +9 -0
- data/spec/factories/campaign.rb +9 -0
- data/spec/factories/challenge.rb +19 -0
- data/spec/factories/challenger.rb +33 -0
- data/spec/factories/collection.rb +17 -0
- data/spec/factories/contact.rb +18 -0
- data/spec/factories/contact_group.rb +18 -0
- data/spec/factories/diagnosis.rb +12 -0
- data/spec/factories/disease.rb +11 -0
- data/spec/factories/donation/participant.rb +27 -0
- data/spec/factories/donation.rb +68 -0
- data/spec/factories/donor.rb +13 -0
- data/spec/factories/email_address.rb +11 -0
- data/spec/factories/error.rb +9 -0
- data/spec/factories/event/coach_tracking/coaching_interactions.rb +12 -0
- data/spec/factories/event/coach_tracking/plaque.rb +12 -0
- data/spec/factories/event/coach_tracking/proceeds.rb +12 -0
- data/spec/factories/event/coach_tracking.rb +18 -0
- data/spec/factories/event/contacts/contact.rb +17 -0
- data/spec/factories/event/contacts/name_pieces.rb +12 -0
- data/spec/factories/event/contacts.rb +16 -0
- data/spec/factories/event/photos.rb +12 -0
- data/spec/factories/event/totals.rb +15 -0
- data/spec/factories/event/venue/location.rb +18 -0
- data/spec/factories/event/venue/social.rb +16 -0
- data/spec/factories/event/venue.rb +16 -0
- data/spec/factories/event.rb +66 -0
- data/spec/factories/event_application.rb +34 -0
- data/spec/factories/event_supporter.rb +19 -0
- data/spec/factories/fund.rb +18 -0
- data/spec/factories/fundraiser/photos.rb +12 -0
- data/spec/factories/fundraiser/policies.rb +11 -0
- data/spec/factories/fundraiser/totals.rb +11 -0
- data/spec/factories/fundraiser.rb +24 -0
- data/spec/factories/fundraising_page.rb +29 -0
- data/spec/factories/grant.rb +22 -0
- data/spec/factories/grant_institution.rb +17 -0
- data/spec/factories/institution.rb +18 -0
- data/spec/factories/kid/custom_institution.rb +12 -0
- data/spec/factories/kid.rb +58 -0
- data/spec/factories/kid_honor.rb +16 -0
- data/spec/factories/kid_institution.rb +23 -0
- data/spec/factories/lib/faker_patch.rb +27 -0
- data/spec/factories/lib/helpers.rb +7 -0
- data/spec/factories/location.rb +17 -0
- data/spec/factories/memorial/photos.rb +14 -0
- data/spec/factories/memorial/totals.rb +11 -0
- data/spec/factories/memorial/tribute.rb +19 -0
- data/spec/factories/memorial.rb +22 -0
- data/spec/factories/message.rb +31 -0
- data/spec/factories/milestone.rb +15 -0
- data/spec/factories/name_pieces.rb +24 -0
- data/spec/factories/newsletter_recipient.rb +13 -0
- data/spec/factories/organization/addresses.rb +16 -0
- data/spec/factories/organization/email_addresses.rb +14 -0
- data/spec/factories/organization/phone_numbers.rb +14 -0
- data/spec/factories/organization.rb +34 -0
- data/spec/factories/page.rb +5 -0
- data/spec/factories/participant/photos.rb +14 -0
- data/spec/factories/participant/policies.rb +12 -0
- data/spec/factories/participant/rankings/ranking.rb +12 -0
- data/spec/factories/participant/rankings.rb +16 -0
- data/spec/factories/participant/roles/role.rb +154 -0
- data/spec/factories/participant/roles.rb +37 -0
- data/spec/factories/participant/totals.rb +11 -0
- data/spec/factories/participant.rb +95 -0
- data/spec/factories/payment.rb +13 -0
- data/spec/factories/permissions.rb +12 -0
- data/spec/factories/person/addresses.rb +16 -0
- data/spec/factories/person/email_addresses.rb +14 -0
- data/spec/factories/person/phone_numbers.rb +14 -0
- data/spec/factories/person/policies.rb +13 -0
- data/spec/factories/person.rb +22 -0
- data/spec/factories/phone.rb +11 -0
- data/spec/factories/photo.rb +11 -0
- data/spec/factories/photos.rb +9 -0
- data/spec/factories/recurring_gift.rb +22 -0
- data/spec/factories/researcher.rb +15 -0
- data/spec/factories/response.rb +38 -0
- data/spec/factories/search_event.rb +19 -0
- data/spec/factories/search_fundraiser.rb +15 -0
- data/spec/factories/search_kid.rb +13 -0
- data/spec/factories/search_participant.rb +15 -0
- data/spec/factories/search_team.rb +13 -0
- data/spec/factories/shave_schedule/time_selection_permissions.rb +12 -0
- data/spec/factories/shave_schedule.rb +33 -0
- data/spec/factories/team/photos.rb +12 -0
- data/spec/factories/team/rankings/ranking.rb +12 -0
- data/spec/factories/team/rankings.rb +15 -0
- data/spec/factories/team/totals.rb +14 -0
- data/spec/factories/team.rb +43 -0
- data/spec/factories/third_party_media.rb +12 -0
- data/spec/factories/treatment_status.rb +10 -0
- data/spec/factories/user.rb +14 -0
- data/spec/factories/venue.rb +15 -0
- metadata +275 -81
@@ -11,7 +11,9 @@ require 'stbaldricks/entities/lib/default_cacheable'
|
|
11
11
|
module SBF
|
12
12
|
module Client
|
13
13
|
class Diagnosis < SBF::Client::BaseEntity
|
14
|
-
attr_accessor :date
|
14
|
+
attr_accessor :date
|
15
|
+
attr_accessor :cancer_type
|
16
|
+
attr_accessor :other
|
15
17
|
|
16
18
|
module CancerType
|
17
19
|
ACUTE_LYMPHOBLASTIC_LEUKEMIA = 'acute_lymphoblastic_leukemia'.freeze
|
@@ -36,7 +38,8 @@ module SBF
|
|
36
38
|
end
|
37
39
|
|
38
40
|
class TreatmentStatus < SBF::Client::BaseEntity
|
39
|
-
attr_accessor :state
|
41
|
+
attr_accessor :state
|
42
|
+
attr_accessor :other
|
40
43
|
|
41
44
|
module SurvivorState
|
42
45
|
IN_TREATMENT = 'in_treatment'.freeze
|
@@ -107,10 +110,11 @@ module SBF
|
|
107
110
|
attr_accessor :is_editor
|
108
111
|
end
|
109
112
|
|
110
|
-
attr_accessor :kid_id
|
111
|
-
|
113
|
+
attr_accessor :kid_id
|
112
114
|
entity_attr_accessor :person, 'SBF::Client::FullPerson', 'SBF::Client::PartialPerson'
|
113
|
-
|
115
|
+
attr_accessor :type
|
116
|
+
attr_accessor :guardian_type
|
117
|
+
attr_accessor :is_submitter
|
114
118
|
entity_attr_accessor :permissions, 'SBF::Client::Kid::Relationship::Permissions'
|
115
119
|
end
|
116
120
|
|
@@ -125,20 +129,33 @@ module SBF
|
|
125
129
|
extend Forwardable
|
126
130
|
def_delegator :@photos, :avatar, :avatar_photo_url
|
127
131
|
|
128
|
-
attr_accessor :id
|
129
|
-
|
130
|
-
|
132
|
+
attr_accessor :id
|
133
|
+
attr_accessor :status
|
134
|
+
attr_accessor :gender
|
135
|
+
attr_accessor :birthday
|
136
|
+
attr_accessor :ethnicity
|
137
|
+
attr_accessor :date_of_passing
|
138
|
+
attr_accessor :display_name
|
139
|
+
attr_accessor :display_name_override
|
140
|
+
attr_accessor :name
|
141
|
+
attr_accessor :ambassador_year
|
142
|
+
attr_accessor :date_activated
|
143
|
+
attr_accessor :date_packet_sent
|
131
144
|
entity_attr_accessor :name_pieces, 'SBF::Client::NamePieces'
|
132
145
|
entity_attr_accessor :address, 'SBF::Client::Address'
|
133
146
|
entity_attr_accessor :diagnosis, 'SBF::Client::Diagnosis'
|
134
147
|
entity_attr_accessor :treatment_status, 'SBF::Client::TreatmentStatus'
|
135
|
-
|
148
|
+
attr_accessor :web_message
|
136
149
|
entity_attr_accessor :photos, 'SBF::Client::Photos'
|
137
150
|
entity_attr_accessor :web_page, 'SBF::Client::WebPage'
|
138
151
|
entity_collection_attr_accessor :relationships, 'SBF::Client::Kid::Relationship'
|
139
152
|
entity_collection_attr_accessor :urls, 'SBF::Client::KidURL'
|
140
|
-
entity_collection_attr_accessor :custom_institutions, 'SBF::Client::Kid::CustomInstitution', nil,
|
141
|
-
entity_attr_accessor :third_party_media, 'SBF::Client::ThirdPartyMedia', nil,
|
153
|
+
entity_collection_attr_accessor :custom_institutions, 'SBF::Client::Kid::CustomInstitution', nil, true
|
154
|
+
entity_attr_accessor :third_party_media, 'SBF::Client::ThirdPartyMedia', nil, true
|
155
|
+
|
156
|
+
attr_accessor :created_at
|
157
|
+
attr_accessor :modified_at
|
158
|
+
attr_accessor :modified_by
|
142
159
|
|
143
160
|
def fundraising_page_url
|
144
161
|
web_page&.url
|
@@ -11,8 +11,8 @@ module SBF
|
|
11
11
|
blacklist_action :update
|
12
12
|
blacklist_action :aggregate
|
13
13
|
|
14
|
-
entity_attr_accessor :kid, 'SBF::Client::FullKid', 'SBF::Client::PartialKid',
|
15
|
-
entity_attr_accessor :institution, 'SBF::Client::FullInstitution', 'SBF::Client::PartialInstitution',
|
14
|
+
entity_attr_accessor :kid, 'SBF::Client::FullKid', 'SBF::Client::PartialKid', true
|
15
|
+
entity_attr_accessor :institution, 'SBF::Client::FullInstitution', 'SBF::Client::PartialInstitution', true
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -8,12 +8,15 @@ module SBF
|
|
8
8
|
BUSINESS = 'business'.freeze
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_accessor :type
|
11
|
+
attr_accessor :type
|
12
|
+
attr_accessor :business_name
|
13
|
+
attr_accessor :address1, :address2, :city, :state, :state_name, :zip, :country, :country_name
|
14
|
+
attr_accessor :latitude, :longitude
|
12
15
|
|
13
16
|
def city_state_zip
|
14
17
|
csz = ''
|
15
|
-
csz +=
|
16
|
-
csz +=
|
18
|
+
csz += @city + ', ' unless @city.nil?
|
19
|
+
csz += @state + ' ' unless @state.nil?
|
17
20
|
csz += @zip unless @zip.nil?
|
18
21
|
csz.strip
|
19
22
|
end
|
@@ -8,7 +8,9 @@ module SBF
|
|
8
8
|
BUSINESS = 'business'.freeze
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_accessor :type
|
11
|
+
attr_accessor :type
|
12
|
+
attr_accessor :business_name
|
13
|
+
attr_accessor :address1, :address2, :city, :state, :state_name, :zip, :country, :country_name
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -25,14 +25,14 @@ module SBF
|
|
25
25
|
@not_provided_attributes = nil
|
26
26
|
@disallow_instantiation = nil
|
27
27
|
|
28
|
-
def initialize(data = {}, clear_changes
|
28
|
+
def initialize(data = {}, clear_changes = false)
|
29
29
|
# If disallow instantiation has been set, raise an error if someone is trying to call initilaize
|
30
30
|
raise SBF::Client::Error, 'Initialize is not valid on a base object. Use the full or partial version' unless self.class.allow_instantiation?
|
31
31
|
|
32
32
|
super()
|
33
33
|
|
34
34
|
@errors = SBF::Client::Entity::Errors.new(self)
|
35
|
-
initialize_attributes(
|
35
|
+
initialize_attributes(data)
|
36
36
|
reload_recursive if clear_changes
|
37
37
|
end
|
38
38
|
|
@@ -70,30 +70,29 @@ module SBF
|
|
70
70
|
def to_partial
|
71
71
|
base_class = self.class.name.gsub(/(.*::)(Full|Partial)(.*)/, '\1')
|
72
72
|
base_name = self.class.name.gsub(/(.*::)(Full|Partial)(.*)/, '\3')
|
73
|
-
"#{base_class}Partial#{base_name}".to_class.new(to_hash
|
73
|
+
"#{base_class}Partial#{base_name}".to_class.new(to_hash)
|
74
74
|
end
|
75
75
|
|
76
76
|
## Returns a hash of changed data for the entity and its sub-entities
|
77
77
|
# @param with_keys [Boolean] when true, include the keys of the current entity. (sub-entity keys will always be included if they are present)
|
78
78
|
# @return [Hash] the changed data
|
79
|
-
def dirty_data(with_keys
|
79
|
+
def dirty_data(with_keys = false)
|
80
80
|
data = {}
|
81
81
|
changes.each { |k, arr| data[k.to_sym] = arr[1] }
|
82
82
|
|
83
83
|
instance_variables.each do |var|
|
84
84
|
attribute_symbol = var.to_s.delete('@').to_sym
|
85
85
|
attribute = instance_variable_get(var)
|
86
|
-
|
87
|
-
|
88
|
-
if attribute.dirty_data(with_keys: true).empty?
|
86
|
+
if attribute.is_a?(BaseEntity)
|
87
|
+
if attribute.dirty_data(true).empty?
|
89
88
|
next unless changed.map(&:to_sym).include?(attribute_symbol)
|
90
89
|
|
91
90
|
data.merge!(attribute_symbol => attribute.keys_hash)
|
92
91
|
else
|
93
|
-
data.merge!(attribute_symbol => attribute.dirty_data(
|
92
|
+
data.merge!(attribute_symbol => attribute.dirty_data(true))
|
94
93
|
end
|
95
|
-
|
96
|
-
next unless attribute.all?(BaseEntity) && attribute.any? { |e| !e.dirty_data(
|
94
|
+
elsif attribute.is_a?(Array)
|
95
|
+
next unless attribute.all? { |e| e.is_a?(BaseEntity) } && attribute.any? { |e| !e.dirty_data(true).empty? }
|
97
96
|
|
98
97
|
data.merge!(attribute_symbol => attribute)
|
99
98
|
end
|
@@ -105,7 +104,7 @@ module SBF
|
|
105
104
|
end
|
106
105
|
|
107
106
|
def keys_hash
|
108
|
-
|
107
|
+
respond_to?(:id) && id ? {id: id} : {}
|
109
108
|
end
|
110
109
|
|
111
110
|
# Mimic ActiveRecord::AttributeAssignment alias
|
@@ -242,7 +241,7 @@ module SBF
|
|
242
241
|
define_changing_attr_methods attribute
|
243
242
|
end
|
244
243
|
|
245
|
-
add_boolean_methods(vars,
|
244
|
+
add_boolean_methods(vars, true)
|
246
245
|
end
|
247
246
|
|
248
247
|
def self.attr_accessor(*vars)
|
@@ -251,10 +250,10 @@ module SBF
|
|
251
250
|
|
252
251
|
vars.each do |attribute|
|
253
252
|
define_attribute_methods attribute
|
254
|
-
define_changing_attr_methods attribute,
|
253
|
+
define_changing_attr_methods attribute, false, true
|
255
254
|
end
|
256
255
|
|
257
|
-
add_boolean_methods(vars,
|
256
|
+
add_boolean_methods(vars, true)
|
258
257
|
end
|
259
258
|
###########################################################################################
|
260
259
|
|
@@ -262,27 +261,24 @@ module SBF
|
|
262
261
|
# Multitype Attribute accessors. These methods take an array of type to class mappings.
|
263
262
|
# Expected form is:
|
264
263
|
# [[<lamda method which evals to true if this type should be used>, <full class>, <partial class>], [...]]
|
265
|
-
def self.multitype_attr_reader(attribute, class_mappings, optional
|
264
|
+
def self.multitype_attr_reader(attribute, class_mappings, optional = false)
|
266
265
|
entity_attributes << attribute
|
267
266
|
optional_attributes << attribute if optional
|
268
267
|
attr_reader(attribute)
|
269
|
-
|
270
|
-
add_multitype_setter_method(attribute, class_mappings, private_method: true)
|
268
|
+
add_multitype_setter_method(attribute, class_mappings, true)
|
271
269
|
end
|
272
270
|
|
273
|
-
def self.multitype_attr_writer(attribute, class_mappings, optional
|
271
|
+
def self.multitype_attr_writer(attribute, class_mappings, optional = false)
|
274
272
|
entity_attributes << attribute
|
275
273
|
optional_attributes << attribute if optional
|
276
274
|
attr_writer(attribute)
|
277
|
-
|
278
275
|
add_multitype_setter_method(attribute, class_mappings)
|
279
276
|
end
|
280
277
|
|
281
|
-
def self.multitype_attr_accessor(attribute, class_mappings, optional
|
278
|
+
def self.multitype_attr_accessor(attribute, class_mappings, optional = false)
|
282
279
|
entity_attributes << attribute
|
283
280
|
optional_attributes << attribute if optional
|
284
281
|
attr_accessor(attribute)
|
285
|
-
|
286
282
|
add_multitype_setter_method(attribute, class_mappings)
|
287
283
|
end
|
288
284
|
###########################################################################################
|
@@ -290,19 +286,19 @@ module SBF
|
|
290
286
|
###########################################################################################
|
291
287
|
# Entity attr accessors are simpler to define/easier to read but they really just create a type mapping
|
292
288
|
# for the given inputs and then function the same as the multitype attribute accessors do.
|
293
|
-
def self.entity_attr_reader(attribute, full_class, partial_class = nil, optional
|
289
|
+
def self.entity_attr_reader(attribute, full_class, partial_class = nil, optional = false)
|
294
290
|
mapping_for_single_class = [[ELSE, full_class, partial_class]]
|
295
|
-
multitype_attr_reader(attribute, mapping_for_single_class, optional
|
291
|
+
multitype_attr_reader(attribute, mapping_for_single_class, optional)
|
296
292
|
end
|
297
293
|
|
298
|
-
def self.entity_attr_writer(attribute, full_class, partial_class = nil, optional
|
294
|
+
def self.entity_attr_writer(attribute, full_class, partial_class = nil, optional = false)
|
299
295
|
mapping_for_single_class = [[ELSE, full_class, partial_class]]
|
300
|
-
multitype_attr_writer(attribute, mapping_for_single_class, optional
|
296
|
+
multitype_attr_writer(attribute, mapping_for_single_class, optional)
|
301
297
|
end
|
302
298
|
|
303
|
-
def self.entity_attr_accessor(attribute, full_class, partial_class = nil, optional
|
299
|
+
def self.entity_attr_accessor(attribute, full_class, partial_class = nil, optional = false)
|
304
300
|
mapping_for_single_class = [[ELSE, full_class, partial_class]]
|
305
|
-
multitype_attr_accessor(attribute, mapping_for_single_class, optional
|
301
|
+
multitype_attr_accessor(attribute, mapping_for_single_class, optional)
|
306
302
|
end
|
307
303
|
###########################################################################################
|
308
304
|
|
@@ -310,27 +306,24 @@ module SBF
|
|
310
306
|
# Multitype Collection accessors. These methods take an array of type to class mappings.
|
311
307
|
# Expected form is:
|
312
308
|
# [[<lamda method which evals to true if this type should be used>, <full class>, <partial class>], [...]]
|
313
|
-
def self.multitype_collection_attr_reader(attribute, class_mappings, optional
|
309
|
+
def self.multitype_collection_attr_reader(attribute, class_mappings, optional = false)
|
314
310
|
collection_attributes << attribute
|
315
311
|
optional_attributes << attribute if optional
|
316
312
|
attr_reader(attribute)
|
317
|
-
|
318
|
-
add_multitype_collection_setter_method(attribute, class_mappings, private_method: true)
|
313
|
+
add_multitype_collection_setter_method(attribute, class_mappings, true)
|
319
314
|
end
|
320
315
|
|
321
|
-
def self.multitype_collection_attr_writer(attribute, class_mappings, optional
|
316
|
+
def self.multitype_collection_attr_writer(attribute, class_mappings, optional = false)
|
322
317
|
collection_attributes << attribute
|
323
318
|
optional_attributes << attribute if optional
|
324
319
|
attr_writer(attribute)
|
325
|
-
|
326
320
|
add_multitype_collection_setter_method(attribute, class_mappings)
|
327
321
|
end
|
328
322
|
|
329
|
-
def self.multitype_collection_attr_accessor(attribute, class_mappings, optional
|
323
|
+
def self.multitype_collection_attr_accessor(attribute, class_mappings, optional = false)
|
330
324
|
collection_attributes << attribute
|
331
325
|
optional_attributes << attribute if optional
|
332
326
|
attr_accessor(attribute)
|
333
|
-
|
334
327
|
add_multitype_collection_setter_method(attribute, class_mappings)
|
335
328
|
end
|
336
329
|
###########################################################################################
|
@@ -338,19 +331,19 @@ module SBF
|
|
338
331
|
###########################################################################################
|
339
332
|
# Entity attr accessors are simpler to define/easier to read but they really just create a type mapping
|
340
333
|
# for the given inputs and then function the same as the multitype attribute accessors do.
|
341
|
-
def self.entity_collection_attr_reader(attribute, full_class, partial_class = nil, optional
|
334
|
+
def self.entity_collection_attr_reader(attribute, full_class, partial_class = nil, optional = false)
|
342
335
|
mapping_for_single_class = [[ELSE, full_class, partial_class]]
|
343
|
-
multitype_collection_attr_reader(attribute, mapping_for_single_class, optional
|
336
|
+
multitype_collection_attr_reader(attribute, mapping_for_single_class, optional)
|
344
337
|
end
|
345
338
|
|
346
|
-
def self.entity_collection_attr_writer(attribute, full_class, partial_class = nil, optional
|
339
|
+
def self.entity_collection_attr_writer(attribute, full_class, partial_class = nil, optional = false)
|
347
340
|
mapping_for_single_class = [[ELSE, full_class, partial_class]]
|
348
|
-
multitype_collection_attr_writer(attribute, mapping_for_single_class, optional
|
341
|
+
multitype_collection_attr_writer(attribute, mapping_for_single_class, optional)
|
349
342
|
end
|
350
343
|
|
351
|
-
def self.entity_collection_attr_accessor(attribute, full_class, partial_class = nil, optional
|
344
|
+
def self.entity_collection_attr_accessor(attribute, full_class, partial_class = nil, optional = false)
|
352
345
|
mapping_for_single_class = [[ELSE, full_class, partial_class]]
|
353
|
-
multitype_collection_attr_accessor(attribute, mapping_for_single_class, optional
|
346
|
+
multitype_collection_attr_accessor(attribute, mapping_for_single_class, optional)
|
354
347
|
end
|
355
348
|
###########################################################################################
|
356
349
|
|
@@ -370,18 +363,18 @@ module SBF
|
|
370
363
|
@collection_attributes ||= Set.new
|
371
364
|
end
|
372
365
|
|
373
|
-
def self.add_boolean_methods(vars, setter
|
366
|
+
def self.add_boolean_methods(vars, setter = false)
|
374
367
|
vars.each do |attribute|
|
375
368
|
split_attribute = attribute.to_s.split('is_')
|
376
369
|
next if split_attribute.length <= 1
|
377
370
|
|
378
371
|
define_method(:"#{split_attribute.last}?") { send(attribute) }
|
379
|
-
define_changing_attr_methods(attribute,
|
372
|
+
define_changing_attr_methods(attribute, true) if setter
|
380
373
|
end
|
381
374
|
end
|
382
375
|
private_class_method :add_boolean_methods
|
383
376
|
|
384
|
-
def self.define_changing_attr_methods(attribute, is_boolean
|
377
|
+
def self.define_changing_attr_methods(attribute, is_boolean = false, define_reader = false)
|
385
378
|
if define_reader
|
386
379
|
define_method(:"#{attribute}") do
|
387
380
|
instance_variable_get("@#{attribute}".to_sym)
|
@@ -510,12 +503,12 @@ module SBF
|
|
510
503
|
value = value.to_hash if !value.is_a?(Hash) && value.respond_to?(:to_hash)
|
511
504
|
|
512
505
|
# Convert to an instance of the appropriate entity class.
|
513
|
-
entity_class.new(value
|
506
|
+
entity_class.new(value)
|
514
507
|
end
|
515
508
|
private :convert_value
|
516
509
|
|
517
510
|
# Base entity setter. Allows for the property to be an array of types.
|
518
|
-
def self.add_multitype_setter_method(attribute, class_mappings, private_method
|
511
|
+
def self.add_multitype_setter_method(attribute, class_mappings, private_method = false)
|
519
512
|
add_class_selector_method(attribute, class_mappings)
|
520
513
|
|
521
514
|
method_name = :"#{attribute}="
|
@@ -530,7 +523,7 @@ module SBF
|
|
530
523
|
private_class_method :add_multitype_setter_method
|
531
524
|
|
532
525
|
# Base collection setter. Allows for the collection to be an array types of types.
|
533
|
-
def self.add_multitype_collection_setter_method(attribute, class_mappings, private_method
|
526
|
+
def self.add_multitype_collection_setter_method(attribute, class_mappings, private_method = false)
|
534
527
|
add_class_selector_method(attribute, class_mappings)
|
535
528
|
|
536
529
|
define_method(:"#{attribute}=") do |values|
|
@@ -590,7 +583,6 @@ module SBF
|
|
590
583
|
end
|
591
584
|
|
592
585
|
def self.inherited(base)
|
593
|
-
super
|
594
586
|
# Add all of our attributes to the class that is inheriting us.
|
595
587
|
base.defined_attributes.merge(defined_attributes) unless defined_attributes.empty?
|
596
588
|
base.optional_attributes.merge(optional_attributes) unless optional_attributes.empty?
|
@@ -4,10 +4,10 @@ module SBF
|
|
4
4
|
module Client
|
5
5
|
class EntityCollection < Array
|
6
6
|
include EntityResponseConcern
|
7
|
-
attr_reader :total_count
|
7
|
+
attr_reader :total_count
|
8
|
+
attr_reader :errors
|
8
9
|
|
9
10
|
def initialize(entities = [], total_count = 0, errors = nil)
|
10
|
-
super()
|
11
11
|
concat(entities)
|
12
12
|
@total_count = total_count
|
13
13
|
@errors = errors || SBF::Client::Entity::Errors.new(self)
|
@@ -3,7 +3,8 @@ require 'stbaldricks/entities/lib/base'
|
|
3
3
|
module SBF
|
4
4
|
module Client
|
5
5
|
class FundraisingPage < SBF::Client::BaseEntity
|
6
|
-
attr_accessor :is_enabled
|
6
|
+
attr_accessor :is_enabled
|
7
|
+
attr_accessor :custom_url_segment
|
7
8
|
attr_reader :url
|
8
9
|
|
9
10
|
HTTP_REGEX = %r{^https?://}.freeze
|
@@ -5,8 +5,8 @@ module SBF
|
|
5
5
|
class NamePiecesBase < SBF::Client::BaseEntity
|
6
6
|
def combined_name
|
7
7
|
name = ''
|
8
|
-
name +=
|
9
|
-
name +=
|
8
|
+
name += @first_name + ' ' unless @first_name.nil?
|
9
|
+
name += @middle_initial + '. ' unless @middle_initial.nil?
|
10
10
|
name += @last_name unless @last_name.nil?
|
11
11
|
name.strip
|
12
12
|
end
|
@@ -18,6 +18,10 @@ module SBF
|
|
18
18
|
VENMO = 'venmo'.freeze
|
19
19
|
UNKNOWN = 'unknown'.freeze
|
20
20
|
WIRE_TRANSFER = 'wire_transfer'.freeze
|
21
|
+
CRYPTO = 'crypto'.freeze
|
22
|
+
SQUARE = 'square'.freeze
|
23
|
+
STOCK = 'stock'.freeze
|
24
|
+
INSTAGRAM = 'instagram'.freeze
|
21
25
|
end
|
22
26
|
|
23
27
|
module Gateway
|
@@ -25,6 +29,11 @@ module SBF
|
|
25
29
|
UNKNOWN = 'unknown'.freeze
|
26
30
|
BRAINTREE = 'braintree'.freeze
|
27
31
|
PAYMENTSPRING = 'paymentspring'.freeze
|
32
|
+
GIVING_BLOCK = 'giving_block'.freeze
|
33
|
+
WIRE_TRANSFER = 'wire_transfer'.freeze
|
34
|
+
SBF_EMPLOYEE_PAYROLL = 'sbf_employee_payroll'.freeze
|
35
|
+
EMPLOYEE_FUND = 'employee_fund'.freeze
|
36
|
+
DONOR_ADVISED_FUND = 'donor_advised_fund'.freeze
|
28
37
|
end
|
29
38
|
|
30
39
|
class Details < SBF::Client::BaseEntity
|
@@ -141,6 +150,30 @@ module SBF
|
|
141
150
|
SBF::Client::Payment::Type::GOOGLEPAY
|
142
151
|
end
|
143
152
|
end
|
153
|
+
|
154
|
+
class CryptoDetails < SBF::Client::Payment::Details
|
155
|
+
def type
|
156
|
+
SBF::Client::Payment::Type::CRYPTO
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
class SquareDetails < SBF::Client::Payment::Details
|
161
|
+
def type
|
162
|
+
SBF::Client::Payment::Type::SQUARE
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
class StockDetails < SBF::Client::Payment::Details
|
167
|
+
def type
|
168
|
+
SBF::Client::Payment::Type::STOCK
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
class InstagramDetails < SBF::Client::Payment::Details
|
173
|
+
def type
|
174
|
+
SBF::Client::Payment::Type::INSTAGRAM
|
175
|
+
end
|
176
|
+
end
|
144
177
|
end
|
145
178
|
end
|
146
179
|
end
|
@@ -5,7 +5,8 @@ require 'set'
|
|
5
5
|
module SBF
|
6
6
|
module Client
|
7
7
|
class Permissions < SBF::Client::BaseEntity
|
8
|
-
attr_accessor :is_owner
|
8
|
+
attr_accessor :is_owner
|
9
|
+
attr_accessor :permission_ids
|
9
10
|
|
10
11
|
# rubocop:disable Style/MissingRespondToMissing
|
11
12
|
def method_missing(method, *arguments, &block)
|
@@ -27,7 +28,8 @@ module SBF
|
|
27
28
|
end
|
28
29
|
|
29
30
|
class PermissionsAtEvent < SBF::Client::BaseEntity
|
30
|
-
attr_accessor :granted
|
31
|
+
attr_accessor :granted
|
32
|
+
attr_accessor :inherited_from_roles
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -9,11 +9,12 @@ module SBF
|
|
9
9
|
MOBILE = 'mobile'.freeze
|
10
10
|
end
|
11
11
|
|
12
|
-
attr_accessor :type
|
12
|
+
attr_accessor :type
|
13
|
+
attr_accessor :number, :extension
|
13
14
|
|
14
15
|
# (402)555-5555 --> tel:4025555555
|
15
16
|
def format_href
|
16
|
-
return
|
17
|
+
return 'tel:' + number.gsub(/\D/, '') unless number.nil?
|
17
18
|
|
18
19
|
number
|
19
20
|
end
|
@@ -14,7 +14,11 @@ module SBF
|
|
14
14
|
TWITCH = 'twitch'.freeze
|
15
15
|
end
|
16
16
|
|
17
|
-
attr_accessor :id
|
17
|
+
attr_accessor :id
|
18
|
+
attr_accessor :type
|
19
|
+
attr_accessor :identifier
|
20
|
+
attr_accessor :title
|
21
|
+
attr_accessor :caption
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
@@ -45,7 +45,7 @@ module SBF
|
|
45
45
|
define_method(name) do |*args|
|
46
46
|
result = endpoint.send(name, self, *args)
|
47
47
|
result unless result.is_a?(SBF::Client::TopLevelEntity)
|
48
|
-
|
48
|
+
%i(save create).include?(name) && result.errors? ? false : result
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -12,48 +12,71 @@ module SBF
|
|
12
12
|
disallow_instantiation
|
13
13
|
|
14
14
|
class Contact < SBF::Client::BaseEntity
|
15
|
-
attr_reader :title
|
16
|
-
|
15
|
+
attr_reader :title
|
16
|
+
attr_reader :name
|
17
17
|
entity_attr_reader :name_pieces, 'SBF::Client::NamePieces'
|
18
18
|
entity_attr_reader :address, 'SBF::Client::Address'
|
19
19
|
entity_attr_reader :phone, 'SBF::Client::Phone'
|
20
20
|
entity_attr_reader :email, 'SBF::Client::EmailAddress'
|
21
|
+
attr_reader :websites
|
21
22
|
end
|
22
23
|
|
23
24
|
class GiftRatio < SBF::Client::BaseEntity
|
24
|
-
attr_reader :match_ratio
|
25
|
+
attr_reader :match_ratio
|
26
|
+
attr_reader :minimum_matched
|
27
|
+
attr_reader :maximum_matched
|
28
|
+
attr_reader :total_matched_per_employee
|
29
|
+
attr_reader :fiscal_year
|
30
|
+
attr_reader :deadline
|
25
31
|
end
|
26
32
|
|
27
33
|
class EmployeeEligibility < SBF::Client::BaseEntity
|
28
|
-
attr_reader :full_time
|
34
|
+
attr_reader :full_time
|
35
|
+
attr_reader :part_time
|
36
|
+
attr_reader :retired
|
37
|
+
attr_reader :spouse
|
38
|
+
attr_reader :board
|
29
39
|
end
|
30
40
|
|
31
41
|
class Procedures < SBF::Client::BaseEntity
|
32
|
-
attr_reader :officer_certification
|
42
|
+
attr_reader :officer_certification
|
43
|
+
attr_reader :fax
|
44
|
+
attr_reader :website
|
45
|
+
attr_reader :phone
|
46
|
+
attr_reader :presenting_evidence
|
47
|
+
attr_reader :sending_check
|
48
|
+
attr_reader :sending_letter
|
33
49
|
end
|
34
50
|
|
35
51
|
class Requirements < SBF::Client::BaseEntity
|
36
|
-
attr_reader :gift_receipt
|
52
|
+
attr_reader :gift_receipt
|
53
|
+
attr_reader :ack_letter
|
37
54
|
end
|
38
55
|
|
39
56
|
class Restrictions < SBF::Client::BaseEntity
|
40
|
-
attr_reader :follow_donor_designation
|
57
|
+
attr_reader :follow_donor_designation
|
58
|
+
attr_reader :match_unrestricted
|
41
59
|
end
|
42
60
|
end
|
43
61
|
|
44
62
|
class PartialCompany < Company
|
45
|
-
attr_reader :name
|
63
|
+
attr_reader :name
|
64
|
+
attr_reader :id
|
46
65
|
end
|
47
66
|
|
48
67
|
class FullCompany < Company
|
49
|
-
attr_reader :id
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
entity_attr_reader :
|
56
|
-
entity_attr_reader :
|
68
|
+
attr_reader :id
|
69
|
+
attr_reader :name
|
70
|
+
attr_reader :matching_gift_forms
|
71
|
+
attr_reader :special_comments
|
72
|
+
attr_reader :last_updated
|
73
|
+
|
74
|
+
entity_attr_reader :contact_info, 'SBF::Client::MatchingGift::Company::Contact', nil, true
|
75
|
+
entity_attr_reader :match_info, 'SBF::Client::MatchingGift::Company::GiftRatio', nil, true
|
76
|
+
entity_attr_reader :employee_eligibility, 'SBF::Client::MatchingGift::Company::EmployeeEligibility', nil, true
|
77
|
+
entity_attr_reader :procedures, 'SBF::Client::MatchingGift::Company::Procedures', nil, true
|
78
|
+
entity_attr_reader :requirements, 'SBF::Client::MatchingGift::Company::Requirements', nil, true
|
79
|
+
entity_attr_reader :restrictions, 'SBF::Client::MatchingGift::Company::Restrictions', nil, true
|
57
80
|
end
|
58
81
|
end
|
59
82
|
end
|