stbaldricks 12.14.0.alpha.1 → 12.14.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stbaldricks/configuration.rb +2 -2
  3. data/lib/stbaldricks/default_logger.rb +2 -2
  4. data/lib/stbaldricks/endpoints/blog_post.rb +8 -8
  5. data/lib/stbaldricks/endpoints/communicate.rb +1 -1
  6. data/lib/stbaldricks/endpoints/config.rb +1 -1
  7. data/lib/stbaldricks/endpoints/deduplicator_match.rb +2 -2
  8. data/lib/stbaldricks/endpoints/kid.rb +1 -1
  9. data/lib/stbaldricks/endpoints/lib/entity.rb +11 -13
  10. data/lib/stbaldricks/endpoints/newsletter_recipient.rb +5 -11
  11. data/lib/stbaldricks/endpoints/participant.rb +3 -3
  12. data/lib/stbaldricks/endpoints/photo.rb +4 -5
  13. data/lib/stbaldricks/endpoints/search.rb +2 -2
  14. data/lib/stbaldricks/endpoints/user.rb +1 -1
  15. data/lib/stbaldricks/entities/batch.rb +5 -3
  16. data/lib/stbaldricks/entities/blog_post.rb +7 -1
  17. data/lib/stbaldricks/entities/campaign.rb +13 -6
  18. data/lib/stbaldricks/entities/challenge.rb +6 -4
  19. data/lib/stbaldricks/entities/challenger.rb +6 -4
  20. data/lib/stbaldricks/entities/concerns/entity_response_concern.rb +1 -1
  21. data/lib/stbaldricks/entities/config.rb +8 -3
  22. data/lib/stbaldricks/entities/contact.rb +7 -4
  23. data/lib/stbaldricks/entities/contact_group.rb +2 -2
  24. data/lib/stbaldricks/entities/deduplicator_history.rb +6 -1
  25. data/lib/stbaldricks/entities/deduplicator_match.rb +7 -4
  26. data/lib/stbaldricks/entities/disease.rb +5 -2
  27. data/lib/stbaldricks/entities/document_library.rb +8 -3
  28. data/lib/stbaldricks/entities/document_library_category.rb +4 -1
  29. data/lib/stbaldricks/entities/donation.rb +18 -12
  30. data/lib/stbaldricks/entities/donor.rb +5 -1
  31. data/lib/stbaldricks/entities/event.rb +44 -33
  32. data/lib/stbaldricks/entities/event_application.rb +10 -6
  33. data/lib/stbaldricks/entities/event_donation_summary.rb +5 -2
  34. data/lib/stbaldricks/entities/event_participant_summary.rb +3 -1
  35. data/lib/stbaldricks/entities/event_supporter.rb +3 -3
  36. data/lib/stbaldricks/entities/fund.rb +23 -6
  37. data/lib/stbaldricks/entities/fundraiser.rb +29 -16
  38. data/lib/stbaldricks/entities/grant.rb +25 -12
  39. data/lib/stbaldricks/entities/institution.rb +4 -3
  40. data/lib/stbaldricks/entities/international_partner.rb +16 -4
  41. data/lib/stbaldricks/entities/kid.rb +28 -11
  42. data/lib/stbaldricks/entities/kid_honor.rb +0 -1
  43. data/lib/stbaldricks/entities/kid_institution.rb +2 -2
  44. data/lib/stbaldricks/entities/lib/address.rb +6 -3
  45. data/lib/stbaldricks/entities/lib/alternate_shipping_address.rb +3 -1
  46. data/lib/stbaldricks/entities/lib/base.rb +39 -47
  47. data/lib/stbaldricks/entities/lib/collection.rb +2 -2
  48. data/lib/stbaldricks/entities/lib/email_address.rb +2 -1
  49. data/lib/stbaldricks/entities/lib/fundraising_page.rb +2 -1
  50. data/lib/stbaldricks/entities/lib/location.rb +0 -1
  51. data/lib/stbaldricks/entities/lib/milestone.rb +3 -1
  52. data/lib/stbaldricks/entities/lib/name.rb +2 -2
  53. data/lib/stbaldricks/entities/lib/not_implemented_object.rb +1 -1
  54. data/lib/stbaldricks/entities/lib/permissions.rb +4 -2
  55. data/lib/stbaldricks/entities/lib/phone.rb +3 -2
  56. data/lib/stbaldricks/entities/lib/third_party_media.rb +5 -1
  57. data/lib/stbaldricks/entities/lib/top_level.rb +1 -1
  58. data/lib/stbaldricks/entities/matching_gift_company.rb +39 -16
  59. data/lib/stbaldricks/entities/memorial.rb +14 -9
  60. data/lib/stbaldricks/entities/message.rb +15 -4
  61. data/lib/stbaldricks/entities/organization.rb +17 -11
  62. data/lib/stbaldricks/entities/page.rb +17 -9
  63. data/lib/stbaldricks/entities/participant.rb +28 -18
  64. data/lib/stbaldricks/entities/participant_donation_summary.rb +4 -2
  65. data/lib/stbaldricks/entities/person.rb +31 -22
  66. data/lib/stbaldricks/entities/person_donation_by_year_summary.rb +2 -1
  67. data/lib/stbaldricks/entities/photo.rb +11 -5
  68. data/lib/stbaldricks/entities/recurring_gift.rb +18 -10
  69. data/lib/stbaldricks/entities/response.rb +0 -1
  70. data/lib/stbaldricks/entities/search.rb +168 -30
  71. data/lib/stbaldricks/entities/section.rb +4 -1
  72. data/lib/stbaldricks/entities/shave_schedule.rb +13 -4
  73. data/lib/stbaldricks/entities/summary.rb +7 -1
  74. data/lib/stbaldricks/entities/team.rb +16 -12
  75. data/lib/stbaldricks/entities/team_donation_summary.rb +4 -2
  76. data/lib/stbaldricks/request.rb +2 -2
  77. data/lib/stbaldricks/version.rb +1 -1
  78. data/lib/stbaldricks_factories.rb +5 -0
  79. data/spec/factories/address.rb +14 -0
  80. data/spec/factories/campaign/totals.rb +9 -0
  81. data/spec/factories/campaign.rb +9 -0
  82. data/spec/factories/challenge.rb +19 -0
  83. data/spec/factories/challenger.rb +33 -0
  84. data/spec/factories/collection.rb +17 -0
  85. data/spec/factories/contact.rb +18 -0
  86. data/spec/factories/contact_group.rb +18 -0
  87. data/spec/factories/diagnosis.rb +12 -0
  88. data/spec/factories/disease.rb +11 -0
  89. data/spec/factories/donation/participant.rb +27 -0
  90. data/spec/factories/donation.rb +68 -0
  91. data/spec/factories/donor.rb +13 -0
  92. data/spec/factories/email_address.rb +11 -0
  93. data/spec/factories/error.rb +9 -0
  94. data/spec/factories/event/coach_tracking/coaching_interactions.rb +12 -0
  95. data/spec/factories/event/coach_tracking/plaque.rb +12 -0
  96. data/spec/factories/event/coach_tracking/proceeds.rb +12 -0
  97. data/spec/factories/event/coach_tracking.rb +18 -0
  98. data/spec/factories/event/contacts/contact.rb +17 -0
  99. data/spec/factories/event/contacts/name_pieces.rb +12 -0
  100. data/spec/factories/event/contacts.rb +16 -0
  101. data/spec/factories/event/photos.rb +12 -0
  102. data/spec/factories/event/totals.rb +15 -0
  103. data/spec/factories/event/venue/location.rb +18 -0
  104. data/spec/factories/event/venue/social.rb +16 -0
  105. data/spec/factories/event/venue.rb +16 -0
  106. data/spec/factories/event.rb +66 -0
  107. data/spec/factories/event_application.rb +34 -0
  108. data/spec/factories/event_supporter.rb +19 -0
  109. data/spec/factories/fund.rb +18 -0
  110. data/spec/factories/fundraiser/photos.rb +12 -0
  111. data/spec/factories/fundraiser/policies.rb +11 -0
  112. data/spec/factories/fundraiser/totals.rb +11 -0
  113. data/spec/factories/fundraiser.rb +24 -0
  114. data/spec/factories/fundraising_page.rb +29 -0
  115. data/spec/factories/grant.rb +22 -0
  116. data/spec/factories/grant_institution.rb +17 -0
  117. data/spec/factories/institution.rb +18 -0
  118. data/spec/factories/kid/custom_institution.rb +12 -0
  119. data/spec/factories/kid.rb +58 -0
  120. data/spec/factories/kid_honor.rb +16 -0
  121. data/spec/factories/kid_institution.rb +23 -0
  122. data/spec/factories/lib/faker_patch.rb +27 -0
  123. data/spec/factories/lib/helpers.rb +7 -0
  124. data/spec/factories/location.rb +17 -0
  125. data/spec/factories/memorial/photos.rb +14 -0
  126. data/spec/factories/memorial/totals.rb +11 -0
  127. data/spec/factories/memorial/tribute.rb +19 -0
  128. data/spec/factories/memorial.rb +22 -0
  129. data/spec/factories/message.rb +31 -0
  130. data/spec/factories/milestone.rb +15 -0
  131. data/spec/factories/name_pieces.rb +24 -0
  132. data/spec/factories/newsletter_recipient.rb +13 -0
  133. data/spec/factories/organization/addresses.rb +16 -0
  134. data/spec/factories/organization/email_addresses.rb +14 -0
  135. data/spec/factories/organization/phone_numbers.rb +14 -0
  136. data/spec/factories/organization.rb +34 -0
  137. data/spec/factories/page.rb +5 -0
  138. data/spec/factories/participant/photos.rb +14 -0
  139. data/spec/factories/participant/policies.rb +12 -0
  140. data/spec/factories/participant/rankings/ranking.rb +12 -0
  141. data/spec/factories/participant/rankings.rb +16 -0
  142. data/spec/factories/participant/roles/role.rb +154 -0
  143. data/spec/factories/participant/roles.rb +37 -0
  144. data/spec/factories/participant/totals.rb +11 -0
  145. data/spec/factories/participant.rb +95 -0
  146. data/spec/factories/payment.rb +13 -0
  147. data/spec/factories/permissions.rb +12 -0
  148. data/spec/factories/person/addresses.rb +16 -0
  149. data/spec/factories/person/email_addresses.rb +14 -0
  150. data/spec/factories/person/phone_numbers.rb +14 -0
  151. data/spec/factories/person/policies.rb +13 -0
  152. data/spec/factories/person.rb +22 -0
  153. data/spec/factories/phone.rb +11 -0
  154. data/spec/factories/photo.rb +11 -0
  155. data/spec/factories/photos.rb +9 -0
  156. data/spec/factories/recurring_gift.rb +22 -0
  157. data/spec/factories/researcher.rb +15 -0
  158. data/spec/factories/response.rb +38 -0
  159. data/spec/factories/search_event.rb +19 -0
  160. data/spec/factories/search_fundraiser.rb +15 -0
  161. data/spec/factories/search_kid.rb +13 -0
  162. data/spec/factories/search_participant.rb +15 -0
  163. data/spec/factories/search_team.rb +13 -0
  164. data/spec/factories/shave_schedule/time_selection_permissions.rb +12 -0
  165. data/spec/factories/shave_schedule.rb +33 -0
  166. data/spec/factories/team/photos.rb +12 -0
  167. data/spec/factories/team/rankings/ranking.rb +12 -0
  168. data/spec/factories/team/rankings.rb +15 -0
  169. data/spec/factories/team/totals.rb +14 -0
  170. data/spec/factories/team.rb +43 -0
  171. data/spec/factories/third_party_media.rb +12 -0
  172. data/spec/factories/treatment_status.rb +10 -0
  173. data/spec/factories/user.rb +14 -0
  174. data/spec/factories/venue.rb +15 -0
  175. metadata +275 -81
@@ -0,0 +1,33 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :shave_schedule, class: SBF::Client::ShaveSchedule do
5
+ skip_create
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ start_time { '00:00:00' }
12
+ end_time { '23:59:59' }
13
+ number_of_seats { 50 }
14
+ shave_duration_in_minutes { 5 }
15
+ end
16
+ end
17
+
18
+ FactoryBot.define do
19
+ factory :shave_schedule_assignment, class: SBF::Client::ShaveSchedule::ShaveScheduleAssignment do
20
+ skip_create
21
+
22
+ initialize_with do
23
+ new(attributes)
24
+ end
25
+
26
+ type { SBF::Client::ShaveSchedule::ShaveScheduleAssignment::Type::SHAVEE }
27
+ shave_time { '12:00:00' }
28
+
29
+ after :build do |_shave_schedule_assignment, evaluator|
30
+ raise 'participant is required' if unpopulated?(evaluator, :participant)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :team_photos, class: SBF::Client::Team::Photos do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ avatar { 'avatar.jpg' }
10
+ default { 'default.jpg' }
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :team_rankings_ranking, class: SBF::Client::Team::Rankings::Ranking do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ rank { 5 }
10
+ total { 10 }
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ require_relative '../lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :team_rankings, class: SBF::Client::Team::Rankings do
5
+ skip_create
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ after :build do |rankings, evaluator|
12
+ rankings.send(:event=, build(:team_rankings_ranking)) if unpopulated?(evaluator, :event)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ FactoryBot.define do
2
+ factory :team_totals, class: SBF::Client::Team::Totals do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ fundraisers { 1 }
10
+ participants { 8 }
11
+ shavees { 5 }
12
+ amount_raised { 0 }
13
+ end
14
+ end
@@ -0,0 +1,43 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :team, class: SBF::Client::FullTeam do
5
+ to_create do |it|
6
+ # Really gross - we don't support team create through the api currently.
7
+ # Instead we need to use the start_team/move_participant_to_team logic
8
+
9
+ # Save the participant first so we can move it
10
+ raise "Failed to create #{it.class}: #{it.errors.details}" unless it.captain.save
11
+
12
+ # Start the team using the info from the existing object and the participant we created
13
+ response = SBF::Client::Participant.start_team(it.captain.id, it.name, it.fundraising_goal)
14
+ raise "Failed to create #{it.class}: #{it.errors.details}" unless response.success?
15
+
16
+ p = response.data
17
+ raise "Failed to create #{it.class}: #{it.errors.details}" unless p.is_a?(SBF::Client::Participant)
18
+
19
+ # Query the team on the participant that was returned (we are creating a team after all)
20
+ team_hash = SBF::Client::Team.get(p.team.id).to_hash
21
+
22
+ # Gross... find a better way eventually
23
+ readonly_attributes = %w(display_name photos totals created_at modified_at)
24
+ readonly_attributes.each { |attr| it.instance_variable_set("@#{attr}".to_sym, team_hash.delete(attr.to_sym)) }
25
+
26
+ # Return the new team
27
+ it.attributes = team_hash.merge(captain: it.captain)
28
+ end
29
+
30
+ initialize_with do
31
+ new(attributes)
32
+ end
33
+
34
+ name { "#{Faker::Team.name} #{random}" }
35
+ status { SBF::Client::Team::Status::ACTIVE }
36
+ fundraising_goal { rand(50) * 500 }
37
+ fundraising_message { 'We are raising money for SBF' }
38
+
39
+ after :build do |team, evaluator|
40
+ team.captain = build(:team_captain, event: team.event) if unpopulated?(evaluator, :captain)
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :third_party_media, class: SBF::Client::ThirdPartyMedia do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ type { SBF::Client::ThirdPartyMedia::Type::YOUTUBE }
10
+ identifier { random }
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :treatment_status, class: SBF::Client::TreatmentStatus do
3
+ skip_create
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+ state { SBF::Client::TreatmentStatus::SurvivorState::IN_TREATMENT }
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ FactoryBot.define do
2
+ factory :user, class: SBF::Client::User do
3
+ to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
4
+
5
+ initialize_with do
6
+ new(attributes)
7
+ end
8
+
9
+ type { SBF::Client::User::ProviderType::SBF }
10
+ access_scope { SBF::Client::User::AccessScope::MEMBER }
11
+ username { random }
12
+ password { 'Super123' }
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'lib/helpers'
2
+
3
+ FactoryBot.define do
4
+ factory :venue, class: SBF::Client::Venue do
5
+ skip_create
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ after :build do |venue, evaluator|
12
+ venue.location = build(:location) if unpopulated?(evaluator, :location)
13
+ end
14
+ end
15
+ end