stbaldricks 12.15.0 → 15.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -38
  3. data/lib/stbaldricks/configuration.rb +2 -2
  4. data/lib/stbaldricks/default_logger.rb +2 -2
  5. data/lib/stbaldricks/endpoints/blog_post.rb +8 -8
  6. data/lib/stbaldricks/endpoints/communicate.rb +1 -1
  7. data/lib/stbaldricks/endpoints/config.rb +1 -1
  8. data/lib/stbaldricks/endpoints/deduplicator_match.rb +2 -2
  9. data/lib/stbaldricks/endpoints/fund.rb +1 -1
  10. data/lib/stbaldricks/endpoints/fundraiser.rb +1 -1
  11. data/lib/stbaldricks/endpoints/kid.rb +1 -1
  12. data/lib/stbaldricks/endpoints/lib/entity.rb +13 -11
  13. data/lib/stbaldricks/endpoints/newsletter_recipient.rb +11 -5
  14. data/lib/stbaldricks/endpoints/participant.rb +3 -3
  15. data/lib/stbaldricks/endpoints/photo.rb +5 -4
  16. data/lib/stbaldricks/endpoints/search.rb +2 -2
  17. data/lib/stbaldricks/endpoints/user.rb +1 -1
  18. data/lib/stbaldricks/entities/batch.rb +3 -5
  19. data/lib/stbaldricks/entities/blog_post.rb +1 -7
  20. data/lib/stbaldricks/entities/campaign.rb +6 -13
  21. data/lib/stbaldricks/entities/challenge.rb +4 -6
  22. data/lib/stbaldricks/entities/challenger.rb +4 -6
  23. data/lib/stbaldricks/entities/concerns/entity_response_concern.rb +2 -2
  24. data/lib/stbaldricks/entities/config.rb +3 -8
  25. data/lib/stbaldricks/entities/contact.rb +4 -7
  26. data/lib/stbaldricks/entities/contact_group.rb +2 -2
  27. data/lib/stbaldricks/entities/deduplicator_history.rb +1 -6
  28. data/lib/stbaldricks/entities/deduplicator_match.rb +4 -7
  29. data/lib/stbaldricks/entities/disease.rb +2 -5
  30. data/lib/stbaldricks/entities/document_library.rb +3 -8
  31. data/lib/stbaldricks/entities/document_library_category.rb +1 -4
  32. data/lib/stbaldricks/entities/donation/payment_type.rb +6 -5
  33. data/lib/stbaldricks/entities/donation.rb +13 -18
  34. data/lib/stbaldricks/entities/donor.rb +1 -5
  35. data/lib/stbaldricks/entities/event.rb +33 -44
  36. data/lib/stbaldricks/entities/event_application.rb +6 -10
  37. data/lib/stbaldricks/entities/event_donation_summary.rb +2 -5
  38. data/lib/stbaldricks/entities/event_participant_summary.rb +1 -3
  39. data/lib/stbaldricks/entities/event_supporter.rb +3 -3
  40. data/lib/stbaldricks/entities/fund.rb +6 -23
  41. data/lib/stbaldricks/entities/fundraiser.rb +16 -29
  42. data/lib/stbaldricks/entities/grant.rb +12 -25
  43. data/lib/stbaldricks/entities/institution.rb +3 -4
  44. data/lib/stbaldricks/entities/international_partner.rb +4 -16
  45. data/lib/stbaldricks/entities/kid.rb +12 -29
  46. data/lib/stbaldricks/entities/kid_honor.rb +1 -0
  47. data/lib/stbaldricks/entities/kid_institution.rb +2 -2
  48. data/lib/stbaldricks/entities/lib/address.rb +3 -6
  49. data/lib/stbaldricks/entities/lib/alternate_shipping_address.rb +1 -3
  50. data/lib/stbaldricks/entities/lib/base.rb +48 -40
  51. data/lib/stbaldricks/entities/lib/collection.rb +2 -2
  52. data/lib/stbaldricks/entities/lib/email_address.rb +1 -2
  53. data/lib/stbaldricks/entities/lib/fundraising_page.rb +1 -2
  54. data/lib/stbaldricks/entities/lib/location.rb +1 -0
  55. data/lib/stbaldricks/entities/lib/milestone.rb +1 -3
  56. data/lib/stbaldricks/entities/lib/name.rb +2 -2
  57. data/lib/stbaldricks/entities/lib/not_implemented_object.rb +1 -1
  58. data/lib/stbaldricks/entities/lib/payment.rb +25 -4
  59. data/lib/stbaldricks/entities/lib/permissions.rb +2 -4
  60. data/lib/stbaldricks/entities/lib/phone.rb +2 -3
  61. data/lib/stbaldricks/entities/lib/third_party_media.rb +1 -5
  62. data/lib/stbaldricks/entities/lib/top_level.rb +1 -1
  63. data/lib/stbaldricks/entities/matching_gift_company.rb +16 -39
  64. data/lib/stbaldricks/entities/memorial.rb +9 -14
  65. data/lib/stbaldricks/entities/message.rb +4 -15
  66. data/lib/stbaldricks/entities/organization.rb +11 -17
  67. data/lib/stbaldricks/entities/page.rb +9 -17
  68. data/lib/stbaldricks/entities/participant.rb +18 -28
  69. data/lib/stbaldricks/entities/participant_donation_summary.rb +2 -4
  70. data/lib/stbaldricks/entities/person.rb +24 -33
  71. data/lib/stbaldricks/entities/person_donation_by_year_summary.rb +1 -2
  72. data/lib/stbaldricks/entities/photo.rb +5 -11
  73. data/lib/stbaldricks/entities/recurring_gift.rb +10 -18
  74. data/lib/stbaldricks/entities/response.rb +1 -0
  75. data/lib/stbaldricks/entities/search.rb +30 -168
  76. data/lib/stbaldricks/entities/section.rb +1 -4
  77. data/lib/stbaldricks/entities/shave_schedule.rb +4 -13
  78. data/lib/stbaldricks/entities/summary.rb +1 -7
  79. data/lib/stbaldricks/entities/team.rb +12 -16
  80. data/lib/stbaldricks/entities/team_donation_summary.rb +2 -4
  81. data/lib/stbaldricks/request.rb +2 -2
  82. data/lib/stbaldricks/version.rb +1 -1
  83. metadata +85 -279
  84. data/lib/stbaldricks_factories.rb +0 -5
  85. data/spec/factories/address.rb +0 -14
  86. data/spec/factories/campaign/totals.rb +0 -9
  87. data/spec/factories/campaign.rb +0 -9
  88. data/spec/factories/challenge.rb +0 -19
  89. data/spec/factories/challenger.rb +0 -33
  90. data/spec/factories/collection.rb +0 -17
  91. data/spec/factories/contact.rb +0 -18
  92. data/spec/factories/contact_group.rb +0 -18
  93. data/spec/factories/diagnosis.rb +0 -12
  94. data/spec/factories/disease.rb +0 -11
  95. data/spec/factories/donation/participant.rb +0 -27
  96. data/spec/factories/donation.rb +0 -68
  97. data/spec/factories/donor.rb +0 -13
  98. data/spec/factories/email_address.rb +0 -11
  99. data/spec/factories/error.rb +0 -9
  100. data/spec/factories/event/coach_tracking/coaching_interactions.rb +0 -12
  101. data/spec/factories/event/coach_tracking/plaque.rb +0 -12
  102. data/spec/factories/event/coach_tracking/proceeds.rb +0 -12
  103. data/spec/factories/event/coach_tracking.rb +0 -18
  104. data/spec/factories/event/contacts/contact.rb +0 -17
  105. data/spec/factories/event/contacts/name_pieces.rb +0 -12
  106. data/spec/factories/event/contacts.rb +0 -16
  107. data/spec/factories/event/photos.rb +0 -12
  108. data/spec/factories/event/totals.rb +0 -15
  109. data/spec/factories/event/venue/location.rb +0 -18
  110. data/spec/factories/event/venue/social.rb +0 -16
  111. data/spec/factories/event/venue.rb +0 -16
  112. data/spec/factories/event.rb +0 -66
  113. data/spec/factories/event_application.rb +0 -34
  114. data/spec/factories/event_supporter.rb +0 -19
  115. data/spec/factories/fund.rb +0 -18
  116. data/spec/factories/fundraiser/photos.rb +0 -12
  117. data/spec/factories/fundraiser/policies.rb +0 -11
  118. data/spec/factories/fundraiser/totals.rb +0 -11
  119. data/spec/factories/fundraiser.rb +0 -24
  120. data/spec/factories/fundraising_page.rb +0 -29
  121. data/spec/factories/grant.rb +0 -22
  122. data/spec/factories/grant_institution.rb +0 -17
  123. data/spec/factories/institution.rb +0 -18
  124. data/spec/factories/kid/custom_institution.rb +0 -12
  125. data/spec/factories/kid.rb +0 -58
  126. data/spec/factories/kid_honor.rb +0 -16
  127. data/spec/factories/kid_institution.rb +0 -23
  128. data/spec/factories/lib/faker_patch.rb +0 -27
  129. data/spec/factories/lib/helpers.rb +0 -7
  130. data/spec/factories/location.rb +0 -17
  131. data/spec/factories/memorial/photos.rb +0 -14
  132. data/spec/factories/memorial/totals.rb +0 -11
  133. data/spec/factories/memorial/tribute.rb +0 -19
  134. data/spec/factories/memorial.rb +0 -22
  135. data/spec/factories/message.rb +0 -31
  136. data/spec/factories/milestone.rb +0 -15
  137. data/spec/factories/name_pieces.rb +0 -24
  138. data/spec/factories/newsletter_recipient.rb +0 -13
  139. data/spec/factories/organization/addresses.rb +0 -16
  140. data/spec/factories/organization/email_addresses.rb +0 -14
  141. data/spec/factories/organization/phone_numbers.rb +0 -14
  142. data/spec/factories/organization.rb +0 -34
  143. data/spec/factories/page.rb +0 -5
  144. data/spec/factories/participant/photos.rb +0 -14
  145. data/spec/factories/participant/policies.rb +0 -12
  146. data/spec/factories/participant/rankings/ranking.rb +0 -12
  147. data/spec/factories/participant/rankings.rb +0 -16
  148. data/spec/factories/participant/roles/role.rb +0 -154
  149. data/spec/factories/participant/roles.rb +0 -37
  150. data/spec/factories/participant/totals.rb +0 -11
  151. data/spec/factories/participant.rb +0 -95
  152. data/spec/factories/payment.rb +0 -13
  153. data/spec/factories/permissions.rb +0 -12
  154. data/spec/factories/person/addresses.rb +0 -16
  155. data/spec/factories/person/email_addresses.rb +0 -14
  156. data/spec/factories/person/phone_numbers.rb +0 -14
  157. data/spec/factories/person/policies.rb +0 -13
  158. data/spec/factories/person.rb +0 -22
  159. data/spec/factories/phone.rb +0 -11
  160. data/spec/factories/photo.rb +0 -11
  161. data/spec/factories/photos.rb +0 -9
  162. data/spec/factories/recurring_gift.rb +0 -22
  163. data/spec/factories/researcher.rb +0 -15
  164. data/spec/factories/response.rb +0 -38
  165. data/spec/factories/search_event.rb +0 -19
  166. data/spec/factories/search_fundraiser.rb +0 -15
  167. data/spec/factories/search_kid.rb +0 -13
  168. data/spec/factories/search_participant.rb +0 -15
  169. data/spec/factories/search_team.rb +0 -13
  170. data/spec/factories/shave_schedule/time_selection_permissions.rb +0 -12
  171. data/spec/factories/shave_schedule.rb +0 -33
  172. data/spec/factories/team/photos.rb +0 -12
  173. data/spec/factories/team/rankings/ranking.rb +0 -12
  174. data/spec/factories/team/rankings.rb +0 -15
  175. data/spec/factories/team/totals.rb +0 -14
  176. data/spec/factories/team.rb +0 -43
  177. data/spec/factories/third_party_media.rb +0 -12
  178. data/spec/factories/treatment_status.rb +0 -10
  179. data/spec/factories/user.rb +0 -14
  180. data/spec/factories/venue.rb +0 -15
@@ -1,37 +0,0 @@
1
- FactoryBot.define do
2
- factory :participant_roles, class: SBF::Client::Participant::Roles do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- transient do
10
- shavee { true }
11
- event_support_volunteer { nil }
12
- individual_fundraiser { nil }
13
- shavee_recruiter { nil }
14
- team_captain { nil }
15
- barber_coordinator { nil }
16
- organizer { nil }
17
- lead_organizer { nil }
18
- treasurer { nil }
19
- lead_treasurer { nil }
20
- barber { nil }
21
- end
22
-
23
- after :build do |roles, evaluator|
24
- roles.shavee = build(:participant_roles_shavee) if evaluator.shavee
25
- roles.event_support_volunteer = build(:participant_roles_event_support_volunteer) if evaluator.event_support_volunteer
26
- roles.individual_fundraiser = build(:participant_roles_individual_fundraiser) if evaluator.individual_fundraiser
27
- roles.shavee_recruiter = build(:participant_roles_shavee_recruiter) if evaluator.shavee_recruiter
28
- roles.team_captain = build(:participant_roles_team_captain) if evaluator.team_captain
29
- roles.barber_coordinator = build(:participant_roles_barber_coordinator) if evaluator.barber_coordinator
30
- roles.organizer = build(:participant_roles_lead_organizer) if evaluator.lead_organizer
31
- roles.organizer = build(:participant_roles_organizer) if evaluator.organizer
32
- roles.treasurer = build(:participant_roles_treasurer) if evaluator.treasurer
33
- roles.treasurer = build(:participant_roles_lead_treasurer) if evaluator.lead_treasurer
34
- roles.barber = build(:participant_roles_barber) if evaluator.barber
35
- end
36
- end
37
- end
@@ -1,11 +0,0 @@
1
- FactoryBot.define do
2
- factory :participant_totals, class: SBF::Client::Participant::Totals do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- amount_raised { 0 }
10
- end
11
- end
@@ -1,95 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :participant, class: SBF::Client::FullParticipant do
5
- to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- fundraising_goal { 100 }
12
- shave_time { Time.now.to_s }
13
- model_type { 'person' }
14
- fundraising_message { 'I am raising money for SBF' }
15
- how_created { 'admin_control_panel' }
16
-
17
- after :build do |participant, evaluator|
18
- participant.person = build(:person) if unpopulated?(evaluator, :person)
19
- if !unpopulated?(evaluator, :event) && evaluator.event.virtual?
20
- participant.is_virtual = true
21
- participant.shave_schedule = {date: Date.today + 30, time: '12:00:00'} if unpopulated?(evaluator, :shave_schedule)
22
- end
23
- end
24
- end
25
-
26
- factory :lead_organizer, class: SBF::Client::FullParticipant, parent: :participant do
27
- after :build do |participant, evaluator|
28
- participant.roles = build(:participant_roles, lead_organizer: true, shavee: false) if unpopulated?(evaluator, :roles)
29
- end
30
- end
31
-
32
- factory :organizer, class: SBF::Client::FullParticipant, parent: :participant do
33
- after :build do |participant, evaluator|
34
- participant.roles = build(:participant_roles, organizer: true, shavee: false) if unpopulated?(evaluator, :roles)
35
- end
36
- end
37
-
38
- factory :shavee, class: SBF::Client::FullParticipant, parent: :participant do
39
- after :build do |participant, evaluator|
40
- participant.roles = build(:participant_roles, shavee: true) if unpopulated?(evaluator, :roles)
41
- end
42
- end
43
-
44
- factory :team_captain, class: SBF::Client::FullParticipant, parent: :participant do
45
- after :build do |participant, evaluator|
46
- # NOTE: The roles are being ignored on purpose. Do not change this until team create through the api works - and when
47
- # that happens we will need to re-write the team factory. Instead we are using the move_participant_to_team route
48
- # which will create the roles for us.
49
- # participant.roles = build(:participant_roles, team_captain: true, shavee: true) if unpopulated?(evaluator, :roles)
50
- participant.roles = build(:participant_roles, team_captain: false, shavee: true) if unpopulated?(evaluator, :roles)
51
- end
52
- end
53
-
54
- factory :shavee_recruiter, class: SBF::Client::FullParticipant, parent: :participant do
55
- after :build do |participant, evaluator|
56
- participant.roles = build(:participant_roles, shavee_recruiter: true, shavee: false) if unpopulated?(evaluator, :roles)
57
- end
58
- end
59
-
60
- factory :treasurer, class: SBF::Client::FullParticipant, parent: :participant do
61
- after :build do |participant, evaluator|
62
- participant.roles = build(:participant_roles, treasurer: true, shavee: false) if unpopulated?(evaluator, :roles)
63
- end
64
- end
65
-
66
- factory :lead_treasurer, class: SBF::Client::FullParticipant, parent: :participant do
67
- after :build do |participant, evaluator|
68
- participant.roles = build(:participant_roles, lead_treasurer: true, shavee: false) if unpopulated?(evaluator, :roles)
69
- end
70
- end
71
-
72
- factory :barber_coordinator, class: SBF::Client::FullParticipant, parent: :participant do
73
- after :build do |participant, evaluator|
74
- participant.roles = build(:participant_roles, barber_coordinator: true, shavee: false) if unpopulated?(evaluator, :roles)
75
- end
76
- end
77
-
78
- factory :barber, class: SBF::Client::FullParticipant, parent: :participant do
79
- after :build do |participant, evaluator|
80
- participant.roles = build(:participant_roles, barber: true, shavee: false) if unpopulated?(evaluator, :roles)
81
- end
82
- end
83
-
84
- factory :event_support_volunteer, class: SBF::Client::FullParticipant, parent: :participant do
85
- after :build do |participant, evaluator|
86
- participant.roles = build(:participant_roles, event_support_volunteer: true, shavee: false) if unpopulated?(evaluator, :roles)
87
- end
88
- end
89
-
90
- factory :individual_fundraiser, class: SBF::Client::FullParticipant, parent: :participant do
91
- after :build do |participant, evaluator|
92
- participant.roles = build(:participant_roles, individual_fundraiser: true, shavee: false) if unpopulated?(evaluator, :roles)
93
- end
94
- end
95
- end
@@ -1,13 +0,0 @@
1
- FactoryBot.define do
2
- factory :payment, class: SBF::Client::Payment do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
- end
9
-
10
- factory :subscription_credit_card_payment, class: SBF::Client::Payment::SubscriptionCreditCardDetails, parent: :payment do
11
- type { SBF::Client::Payment::Type::CREDIT_CARD }
12
- end
13
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :permissions, class: SBF::Client::Permissions do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- is_owner { false }
10
- permission_ids { [] }
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- require_relative '../lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :person_addresses, class: SBF::Client::Person::Addresses do
5
- skip_create
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- after :build do |addresses, evaluator|
12
- addresses.primary = build(:address) if unpopulated?(evaluator, :primary)
13
- addresses.secondary = build(:address) if unpopulated?(evaluator, :secondary)
14
- end
15
- end
16
- end
@@ -1,14 +0,0 @@
1
- FactoryBot.define do
2
- factory :person_email_addresses, class: SBF::Client::Person::EmailAddresses do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- after :build do |email_addresses|
10
- email_addresses.primary = build(:email_address)
11
- email_addresses.secondary = build(:email_address)
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- FactoryBot.define do
2
- factory :person_phone_numbers, class: SBF::Client::Person::PhoneNumbers do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- after :build do |phone_numbers|
10
- phone_numbers.primary = build(:phone)
11
- phone_numbers.secondary = build(:phone)
12
- end
13
- end
14
- end
@@ -1,13 +0,0 @@
1
- FactoryBot.define do
2
- factory :policies, class: SBF::Client::Person::Policies do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- is_photo_policy_accepted { Time.now.to_s }
10
- background_check_date { Time.now.to_s }
11
- background_check_url { 'http://example.com' }
12
- end
13
- end
@@ -1,22 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :person, class: SBF::Client::FullPerson do
5
- to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- after :build do |person, evaluator|
12
- person.email_addresses = build(:person_email_addresses) if unpopulated?(evaluator, :email_addresses)
13
- person.phone_numbers = build(:person_phone_numbers) if unpopulated?(evaluator, :phone_numbers)
14
- person.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
15
- person.policies = build(:policies) if unpopulated?(evaluator, :policies)
16
- person.addresses = build(:person_addresses) if unpopulated?(evaluator, :addresses)
17
- person.status = 'active' if unpopulated?(evaluator, :status)
18
- person.type = SBF::Client::Person::Type::INDIVIDUAL if unpopulated?(evaluator, :type)
19
- person.birthday = Faker::Date.birthday(min_age: 19, max_age: 65).to_s if unpopulated?(evaluator, :birthday)
20
- end
21
- end
22
- end
@@ -1,11 +0,0 @@
1
- FactoryBot.define do
2
- factory :phone, class: SBF::Client::Phone do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- number { "#{Faker::Number.between(from: 200, to: 999)}-#{Faker::Number.number(digits: 3)}-#{Faker::Number.number(digits: 4)}" }
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- FactoryBot.define do
2
- factory :photo, class: SBF::Client::Photo do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:id) { |n| n + 100 }
10
- end
11
- end
@@ -1,9 +0,0 @@
1
- FactoryBot.define do
2
- factory :photos, class: SBF::Client::Photos do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
- end
9
- end
@@ -1,22 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :recurring_gift, class: SBF::Client::FullRecurringGift do
5
- to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- amount { rand(10..100) }
12
- status { SBF::Client::RecurringGift::Status::PENDING }
13
- created_at { Date.today }
14
- last_collected_at { Date.today }
15
- is_unrecognized { false }
16
-
17
- after :build do |recurring_gift, evaluator|
18
- recurring_gift.donor = build(:person, status: SBF::Client::Person::Status::ACTIVE) if unpopulated?(evaluator, :donor)
19
- recurring_gift.payment_details = build(:nonce_payment) if unpopulated?(evaluator, :payment_details)
20
- end
21
- end
22
- end
@@ -1,15 +0,0 @@
1
- require_relative 'lib/helpers'
2
-
3
- FactoryBot.define do
4
- factory :researcher, class: SBF::Client::Grant::FullResearcher do
5
- to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
6
-
7
- initialize_with do
8
- new(attributes)
9
- end
10
-
11
- after :build do |researcher, evaluator|
12
- researcher.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
13
- end
14
- end
15
- end
@@ -1,38 +0,0 @@
1
- FactoryBot.define do
2
- factory :response, class: SBF::Client::Api::Response do
3
- skip_create
4
-
5
- transient do
6
- # allow passing in results as an argument
7
- results { nil }
8
- total_count { nil }
9
- end
10
-
11
- after :build do |response, evaluator|
12
- # Either set data to data passed in as an arg or an empty hash if no data arg
13
- response.data = evaluator.data || {}
14
-
15
- # Set data[:results] to the arg results
16
- response.data[:results] = evaluator.results if evaluator.results
17
-
18
- # Set data[:total_count] to the arg total_count
19
- response.data[:total_count] = evaluator.total_count if evaluator.total_count
20
- end
21
-
22
- http_code { 200 }
23
- end
24
-
25
- factory :not_found, class: SBF::Client::Api::Response do
26
- skip_create
27
-
28
- data { nil }
29
- http_code { 404 }
30
- end
31
-
32
- factory :unavailable, class: SBF::Client::Api::Response do
33
- skip_create
34
-
35
- data { nil }
36
- http_code { 503 }
37
- end
38
- end
@@ -1,19 +0,0 @@
1
- FactoryBot.define do
2
- factory :search_event, class: SBF::Client::Search::Event do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:event_id) { |n| n + 10_000 }
10
- event_year { 2015 }
11
- event_title { 'My Event Title' }
12
- event_date { '2015-05-05' }
13
- total_donations { 12_345 }
14
- total_participants { 5 }
15
- total_shavees { rand(10) }
16
- address1 { '123 Main Street' }
17
- closed_roles { [] }
18
- end
19
- end
@@ -1,15 +0,0 @@
1
- FactoryBot.define do
2
- factory :search_fundraiser, class: SBF::Client::Search::Fundraiser do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:fundraiser_id) { |n| n }
10
- sequence(:profile_id) { |n| n + 100 }
11
- sequence(:team_id) { |n| n + 1000 }
12
- sequence(:event_id) { |n| n + 10_000 }
13
- event_year { 2014 }
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- FactoryBot.define do
2
- factory :search_kid, class: SBF::Client::Search::Kid do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:kid_id) { |n| n }
10
- sequence(:treatment_status_slug) { |n| "Treatment status slug #{n}" }
11
- sequence(:treatment_status_other) { |n| "Treatment status other #{n}" }
12
- end
13
- end
@@ -1,15 +0,0 @@
1
- FactoryBot.define do
2
- factory :search_participant, class: SBF::Client::Search::Participant do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:participant_id) { |n| n }
10
- sequence(:profile_id) { |n| n + 100 }
11
- sequence(:team_id) { |n| n + 1000 }
12
- sequence(:event_id) { |n| n + 10_000 }
13
- event_year { 2014 }
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- FactoryBot.define do
2
- factory :search_team, class: SBF::Client::Search::Team do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- sequence(:team_id) { |n| n + 10_000 }
10
- sequence(:event_id) { |n| n + 10_000 }
11
- event_year { 2014 }
12
- end
13
- end
@@ -1,12 +0,0 @@
1
- FactoryBot.define do
2
- factory :shave_schedule_time_selection_permissions, class: SBF::Client::ShaveSchedule::TimeSelectionPermissions do
3
- skip_create
4
-
5
- initialize_with do
6
- new(attributes)
7
- end
8
-
9
- shavees { [] }
10
- team_captains { [] }
11
- end
12
- end
@@ -1,33 +0,0 @@
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
@@ -1,12 +0,0 @@
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
@@ -1,12 +0,0 @@
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
@@ -1,15 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,43 +0,0 @@
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
@@ -1,12 +0,0 @@
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
@@ -1,10 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,15 +0,0 @@
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