stbaldricks 10.9.0 → 10.10.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24ece577b8f7bbfc81ddf4d24a9783355b20fd822326d623e48f33a07569ce94
4
- data.tar.gz: fe11173627efa5567f9a28c43c1c038871d6d8c9ffc09f37d65ba0d45ae31a7f
3
+ metadata.gz: 3d83066303ab227b99c625d322e908e7e273ccfd1b9dd67fc705799304298eed
4
+ data.tar.gz: 64da5d2c51f91c64002971e4b9c732b170ab1af797ce87033b31028e8a07526e
5
5
  SHA512:
6
- metadata.gz: 9c3ffa75e60f9910122d30c766d686428ed5422a4ee80da6d59b079b6c47817cf3c4f50d5826f82d9b56d794b6edf72e78d2fc509b74edb38c45b45aa9edd9ed
7
- data.tar.gz: c20daab76aaac616715282f3ddea8006f3e6e41f935508fd21ffa3c7519c7687a82becb59fb37b246bee901938ab4a3056f50d54402ea83db291073900eaac6d
6
+ metadata.gz: 4e041a1c7eb162fde30206d263c217c753e9c14278063459ee3d8901680a86b1949ff1a0ab36c2e39173dcab31347f54257149dcb34f357e4f0ecd005cc99153
7
+ data.tar.gz: 1e17df05b1cc2325415515adcec442bad684d1f1ffd6b71ae7a107fe1df6c8e335fe63843a02cae706243e718e80a8adcec1c4670f97d0c444f700d44b5e0293
@@ -199,13 +199,19 @@ module SBF
199
199
  private :sanitize_entity
200
200
 
201
201
  def reconstitute_with(entity)
202
- return {} if entity.nil?
202
+ return {} unless entity.class.respond_to?(:optional_attributes)
203
203
 
204
204
  {}.tap do |hsh|
205
205
  entity.class.optional_attributes.each do |attribute|
206
206
  next if entity.not_provided_attributes.include?(attribute)
207
207
 
208
208
  attribute_value = entity.send(attribute)
209
+
210
+ if attribute_value.is_a?(Array)
211
+ hsh[attribute] = attribute_value.inject({}) { |h, it| h.merge(reconstitute_with(it)) }
212
+ next
213
+ end
214
+
209
215
  next if attribute_value.class.demodulize.start_with?('Partial')
210
216
  next unless attribute_value.is_a? SBF::Client::BaseEntity
211
217
 
@@ -109,32 +109,38 @@ module SBF
109
109
  def_delegator :@photos, :avatar, :avatar_photo_url
110
110
 
111
111
  attr_accessor :id
112
- attr_accessor :status
113
- attr_accessor :title
112
+
113
+ attr_reader :created_at, :modified_at
114
+ attr_reader :display_name
115
+
114
116
  attr_accessor :category
115
117
  attr_accessor :display_name_override
116
- attr_reader :display_name
117
- entity_attr_accessor :owner, 'SBF::Client::FullPerson', 'SBF::Client::PartialPerson'
118
+ attr_accessor :facebook_fundraiser_id
119
+ attr_accessor :fund_relationship_type
120
+ attr_accessor :fundraising_goal, :fundraising_message
121
+ attr_accessor :how_created
122
+ attr_accessor :modified_by
123
+ attr_accessor :offline_donation_uuid, :offline_donation_form
118
124
  attr_accessor :start_date, :end_date
119
125
  attr_accessor :start_time, :end_time
120
- attr_accessor :offline_donation_uuid, :offline_donation_form
121
- attr_accessor :fundraising_goal, :fundraising_message
122
- entity_attr_accessor :fundraising_page, 'SBF::Client::FundraisingPage', nil, true
126
+ attr_accessor :status
127
+ attr_accessor :title
128
+
129
+ entity_attr_reader :permissions, 'SBF::Client::Permissions', nil, true
130
+ entity_attr_reader :rankings, 'SBF::Client::Fundraiser::Rankings', nil, true
131
+ entity_attr_reader :totals, 'SBF::Client::Fundraiser::Totals'
132
+
123
133
  entity_attr_accessor :event, 'SBF::Client::Fundraiser::FullEvent', 'SBF::Client::Fundraiser::PartialEvent', true
124
- entity_attr_accessor :team, 'SBF::Client::FullTeam', 'SBF::Client::PartialTeam', true
125
- attr_accessor :facebook_fundraiser_id
126
134
  entity_attr_accessor :fund, 'SBF::Client::FullFund', 'SBF::Client::PartialFund', true
127
- attr_accessor :fund_relationship_type
128
- entity_attr_accessor :venue, 'SBF::Client::Venue'
135
+ entity_attr_accessor :fundraising_page, 'SBF::Client::FundraisingPage', nil, true
136
+ entity_attr_accessor :owner, 'SBF::Client::FullPerson', 'SBF::Client::PartialPerson'
129
137
  entity_attr_accessor :photos, 'SBF::Client::Fundraiser::Photos'
130
138
  entity_attr_accessor :policies, 'SBF::Client::Fundraiser::Policies'
131
- entity_attr_reader :rankings, 'SBF::Client::Fundraiser::Rankings', nil, true
132
- entity_attr_reader :totals, 'SBF::Client::Fundraiser::Totals'
133
- attr_reader :created_at, :modified_at
134
- attr_accessor :modified_by
135
- attr_accessor :how_created
136
- entity_attr_reader :permissions, 'SBF::Client::Permissions', nil, true
139
+ entity_attr_accessor :team, 'SBF::Client::FullTeam', 'SBF::Client::PartialTeam', true
137
140
  entity_attr_accessor :third_party_media, 'SBF::Client::ThirdPartyMedia', nil, true
141
+ entity_attr_accessor :venue, 'SBF::Client::Venue'
142
+
143
+ entity_collection_attr_accessor :milestones, 'SBF::Client::Milestone', nil, true
138
144
 
139
145
  def active?
140
146
  status == SBF::Client::Fundraiser::Status::ACTIVE
@@ -12,8 +12,8 @@ module SBF
12
12
  blacklist_action :update
13
13
  blacklist_action :aggregate
14
14
 
15
- entity_attr_accessor :kid, 'SBF::Client::FullKid', 'SBF::Client::PartialKid'
16
- entity_attr_accessor :institution, 'SBF::Client::FullInstitution', 'SBF::Client::PartialInstitution'
15
+ entity_attr_accessor :kid, 'SBF::Client::FullKid', 'SBF::Client::PartialKid', true
16
+ entity_attr_accessor :institution, 'SBF::Client::FullInstitution', 'SBF::Client::PartialInstitution', true
17
17
  end
18
18
  end
19
19
  end
@@ -0,0 +1,12 @@
1
+ require 'stbaldricks/entities/lib/base'
2
+
3
+ module SBF
4
+ module Client
5
+ class Milestone < SBF::Client::BaseEntity
6
+ attr_reader :id
7
+ attr_accessor :amount
8
+ attr_accessor :description
9
+ attr_accessor :icon
10
+ end
11
+ end
12
+ end
@@ -207,33 +207,39 @@ module SBF
207
207
  def_delegator :@photos, :avatar, :avatar_photo_url
208
208
 
209
209
  attr_accessor :id
210
- attr_accessor :status
211
- attr_accessor :display_name_override
210
+
211
+ attr_reader :created_at, :modified_at
212
212
  attr_reader :display_name
213
- entity_attr_accessor :person, 'SBF::Client::FullPerson'
214
- entity_attr_accessor :event, 'SBF::Client::FullEvent', 'SBF::Client::PartialEvent', true
215
- entity_attr_accessor :team, 'SBF::Client::FullTeam', 'SBF::Client::PartialTeam', true
213
+
214
+ attr_accessor :display_name_override
216
215
  attr_accessor :facebook_fundraiser_id
217
- entity_attr_accessor :fund, 'SBF::Client::FullFund', 'SBF::Client::PartialFund', true
218
216
  attr_accessor :fund_relationship_type
219
- attr_accessor :shirt_size
220
- attr_accessor :offline_donation_uuid, :offline_donation_form
221
217
  attr_accessor :fundraising_goal, :fundraising_message
222
- entity_attr_accessor :fundraising_page, 'SBF::Client::FundraisingPage', nil, true
223
- entity_attr_reader :photos, 'SBF::Client::Participant::Photos'
224
- entity_attr_accessor :policies, 'SBF::Client::Participant::Policies'
218
+ attr_accessor :how_created
225
219
  attr_accessor :is_virtual
226
- entity_attr_accessor :shave_schedule, 'SBF::Client::Participant::ShaveSchedule'
227
- entity_attr_accessor :roles, 'SBF::Client::Participant::Roles', nil, true
228
- entity_attr_reader :rankings, 'SBF::Client::Participant::Rankings', nil, true
229
- entity_attr_reader :totals, 'SBF::Client::Participant::Totals'
230
- attr_reader :created_at, :modified_at
231
220
  attr_accessor :modified_by
232
- attr_accessor :how_created
221
+ attr_accessor :offline_donation_uuid, :offline_donation_form
222
+ attr_accessor :shirt_size
223
+ attr_accessor :status
224
+
233
225
  entity_attr_reader :permissions, 'SBF::Client::Permissions', nil, true
234
226
  entity_attr_reader :permissions_at_event, 'SBF::Client::PermissionsAtEvent', nil, true
227
+ entity_attr_reader :photos, 'SBF::Client::Participant::Photos'
228
+ entity_attr_reader :rankings, 'SBF::Client::Participant::Rankings', nil, true
229
+ entity_attr_reader :totals, 'SBF::Client::Participant::Totals'
230
+
231
+ entity_attr_accessor :event, 'SBF::Client::FullEvent', 'SBF::Client::PartialEvent', true
232
+ entity_attr_accessor :fund, 'SBF::Client::FullFund', 'SBF::Client::PartialFund', true
233
+ entity_attr_accessor :fundraising_page, 'SBF::Client::FundraisingPage', nil, true
234
+ entity_attr_accessor :person, 'SBF::Client::FullPerson'
235
+ entity_attr_accessor :policies, 'SBF::Client::Participant::Policies'
236
+ entity_attr_accessor :roles, 'SBF::Client::Participant::Roles', nil, true
237
+ entity_attr_accessor :shave_schedule, 'SBF::Client::Participant::ShaveSchedule'
238
+ entity_attr_accessor :team, 'SBF::Client::FullTeam', 'SBF::Client::PartialTeam', true
235
239
  entity_attr_accessor :third_party_media, 'SBF::Client::ThirdPartyMedia', nil, true
236
240
 
241
+ entity_collection_attr_accessor :milestones, 'SBF::Client::Milestone', nil, true
242
+
237
243
  def active?
238
244
  status == SBF::Client::Participant::Status::ACTIVE
239
245
  end
@@ -1,5 +1,5 @@
1
1
  module SBF
2
2
  module Client
3
- VERSION = '10.9.0'.freeze
3
+ VERSION = '10.10.0.alpha.1'.freeze
4
4
  end
5
5
  end
@@ -2,9 +2,7 @@ require_relative 'lib/helpers'
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :event, class: SBF::Client::FullEvent do
5
- # TODO: Hack - including organizers in the save's with should not be necessary. We should always include any dirty data
6
- # we send to the api in the with so that we know we have the latest data. Fix and remove the with
7
- to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save(organizers: nil) }
5
+ to_create { |it| raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save }
8
6
 
9
7
  initialize_with do
10
8
  new(attributes)
@@ -4,8 +4,7 @@ FactoryBot.define do
4
4
  # This is the relationship object between the kid and system institutions
5
5
  factory :kid_institution, class: SBF::Client::KidInstitution do
6
6
  to_create do |it|
7
- it.kid = FactoryBot.create(:kid) if it.kid.nil?
8
- raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save(kid: {}, institution: {})
7
+ raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save
9
8
  end
10
9
 
11
10
  initialize_with do
@@ -15,5 +14,10 @@ FactoryBot.define do
15
14
  after :build do |kid_institution, evaluator|
16
15
  kid_institution.institution = build(:institution) if unpopulated?(evaluator, :institution)
17
16
  end
17
+
18
+ before :create do |kid_institution, evaluator|
19
+ kid_institution.institution = create(:institution) if unpopulated?(evaluator, :institution)
20
+ kid_institution.kid = create(:kid) if unpopulated?(evaluator, :kid)
21
+ end
18
22
  end
19
23
  end
@@ -0,0 +1,15 @@
1
+ require 'faker'
2
+
3
+ FactoryBot.define do
4
+ factory :milestone, class: SBF::Client::Milestone do
5
+ skip_create
6
+
7
+ initialize_with do
8
+ new(attributes)
9
+ end
10
+
11
+ description { Faker::Games::Pokemon.move }
12
+ amount { rand(1..10_000) }
13
+ icon { rand(1..10) }
14
+ end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stbaldricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.9.0
4
+ version: 10.10.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
@@ -391,6 +391,7 @@ files:
391
391
  - lib/stbaldricks/entities/lib/fundraising_page.rb
392
392
  - lib/stbaldricks/entities/lib/geo_location.rb
393
393
  - lib/stbaldricks/entities/lib/location.rb
394
+ - lib/stbaldricks/entities/lib/milestone.rb
394
395
  - lib/stbaldricks/entities/lib/name.rb
395
396
  - lib/stbaldricks/entities/lib/not_implemented_object.rb
396
397
  - lib/stbaldricks/entities/lib/opt_out_settings.rb
@@ -493,6 +494,7 @@ files:
493
494
  - spec/factories/memorial/totals.rb
494
495
  - spec/factories/memorial/tribute.rb
495
496
  - spec/factories/message.rb
497
+ - spec/factories/milestone.rb
496
498
  - spec/factories/name_pieces.rb
497
499
  - spec/factories/newsletter_recipient.rb
498
500
  - spec/factories/organization.rb
@@ -552,9 +554,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
552
554
  version: '0'
553
555
  required_rubygems_version: !ruby/object:Gem::Requirement
554
556
  requirements:
555
- - - ">="
557
+ - - ">"
556
558
  - !ruby/object:Gem::Version
557
- version: '0'
559
+ version: 1.3.1
558
560
  requirements: []
559
561
  rubygems_version: 3.0.3
560
562
  signing_key:
@@ -562,98 +564,99 @@ specification_version: 4
562
564
  summary: St. Baldrick's Foundation Ruby Client Library
563
565
  test_files:
564
566
  - lib/stbaldricks_factories.rb
565
- - spec/factories/organization/addresses.rb
566
- - spec/factories/organization/email_addresses.rb
567
- - spec/factories/organization/phone_numbers.rb
568
- - spec/factories/payment.rb
569
- - spec/factories/fundraising_page.rb
570
- - spec/factories/donation/participant.rb
571
- - spec/factories/challenge.rb
567
+ - spec/factories/photo.rb
568
+ - spec/factories/participant.rb
569
+ - spec/factories/search_team.rb
570
+ - spec/factories/fund.rb
572
571
  - spec/factories/kid_institution.rb
573
- - spec/factories/memorial/totals.rb
574
- - spec/factories/memorial/photos.rb
575
- - spec/factories/memorial/tribute.rb
576
- - spec/factories/search_kid.rb
577
- - spec/factories/contact.rb
578
- - spec/factories/researcher.rb
579
- - spec/factories/photos.rb
572
+ - spec/factories/phone.rb
573
+ - spec/factories/diagnosis.rb
574
+ - spec/factories/location.rb
575
+ - spec/factories/event_application.rb
576
+ - spec/factories/search_event.rb
577
+ - spec/factories/shave_schedule/time_selection_permissions.rb
578
+ - spec/factories/collection.rb
579
+ - spec/factories/event.rb
580
580
  - spec/factories/challenger.rb
581
- - spec/factories/name_pieces.rb
582
- - spec/factories/person/policies.rb
583
- - spec/factories/person/addresses.rb
584
- - spec/factories/person/email_addresses.rb
585
- - spec/factories/person/phone_numbers.rb
586
- - spec/factories/participant/policies.rb
581
+ - spec/factories/campaign/totals.rb
582
+ - spec/factories/kid_honor.rb
583
+ - spec/factories/response.rb
584
+ - spec/factories/grant_institution.rb
585
+ - spec/factories/organization.rb
586
+ - spec/factories/researcher.rb
587
+ - spec/factories/treatment_status.rb
588
+ - spec/factories/event/totals.rb
589
+ - spec/factories/event/contacts.rb
590
+ - spec/factories/event/photos.rb
591
+ - spec/factories/event/venue/location.rb
592
+ - spec/factories/event/venue/social.rb
593
+ - spec/factories/event/coach_tracking.rb
594
+ - spec/factories/event/venue.rb
595
+ - spec/factories/event/coach_tracking/coaching_interactions.rb
596
+ - spec/factories/event/coach_tracking/proceeds.rb
597
+ - spec/factories/event/coach_tracking/plaque.rb
598
+ - spec/factories/event/contacts/name_pieces.rb
599
+ - spec/factories/event/contacts/contact.rb
600
+ - spec/factories/fundraiser/totals.rb
601
+ - spec/factories/fundraiser/policies.rb
602
+ - spec/factories/fundraiser/photos.rb
603
+ - spec/factories/shave_schedule.rb
604
+ - spec/factories/event_supporter.rb
587
605
  - spec/factories/participant/totals.rb
588
- - spec/factories/participant/photos.rb
606
+ - spec/factories/participant/policies.rb
589
607
  - spec/factories/participant/roles/role.rb
590
- - spec/factories/participant/rankings/ranking.rb
608
+ - spec/factories/participant/photos.rb
591
609
  - spec/factories/participant/rankings.rb
610
+ - spec/factories/participant/rankings/ranking.rb
592
611
  - spec/factories/participant/roles.rb
593
- - spec/factories/donation.rb
594
- - spec/factories/third_party_media.rb
595
- - spec/factories/search_team.rb
596
- - spec/factories/permissions.rb
597
- - spec/factories/photo.rb
598
- - spec/factories/collection.rb
599
- - spec/factories/campaign.rb
600
- - spec/factories/grant.rb
601
- - spec/factories/location.rb
602
- - spec/factories/email_address.rb
603
- - spec/factories/disease.rb
604
- - spec/factories/participant.rb
605
- - spec/factories/kid.rb
612
+ - spec/factories/error.rb
613
+ - spec/factories/recurring_gift.rb
614
+ - spec/factories/challenge.rb
615
+ - spec/factories/address.rb
616
+ - spec/factories/kid/custom_institution.rb
617
+ - spec/factories/person.rb
606
618
  - spec/factories/search_participant.rb
607
- - spec/factories/event_supporter.rb
608
- - spec/factories/page.rb
609
- - spec/factories/message.rb
610
- - spec/factories/response.rb
611
- - spec/factories/search_event.rb
612
- - spec/factories/event_application.rb
613
- - spec/factories/fundraiser.rb
614
- - spec/factories/team.rb
615
- - spec/factories/memorial.rb
616
- - spec/factories/diagnosis.rb
619
+ - spec/factories/milestone.rb
620
+ - spec/factories/fundraising_page.rb
621
+ - spec/factories/photos.rb
617
622
  - spec/factories/team/totals.rb
618
623
  - spec/factories/team/photos.rb
619
- - spec/factories/team/rankings/ranking.rb
620
624
  - spec/factories/team/rankings.rb
621
- - spec/factories/newsletter_recipient.rb
622
- - spec/factories/shave_schedule.rb
623
- - spec/factories/organization.rb
624
- - spec/factories/campaign/totals.rb
625
- - spec/factories/lib/helpers.rb
626
- - spec/factories/lib/faker_patch.rb
627
- - spec/factories/error.rb
625
+ - spec/factories/team/rankings/ranking.rb
626
+ - spec/factories/donation.rb
627
+ - spec/factories/memorial.rb
628
+ - spec/factories/institution.rb
629
+ - spec/factories/memorial/totals.rb
630
+ - spec/factories/memorial/tribute.rb
631
+ - spec/factories/memorial/photos.rb
632
+ - spec/factories/person/policies.rb
633
+ - spec/factories/person/addresses.rb
634
+ - spec/factories/person/phone_numbers.rb
635
+ - spec/factories/person/email_addresses.rb
628
636
  - spec/factories/donor.rb
629
- - spec/factories/contact_group.rb
630
- - spec/factories/recurring_gift.rb
631
- - spec/factories/person.rb
632
- - spec/factories/treatment_status.rb
633
- - spec/factories/fundraiser/policies.rb
634
- - spec/factories/fundraiser/totals.rb
635
- - spec/factories/fundraiser/photos.rb
637
+ - spec/factories/kid.rb
638
+ - spec/factories/name_pieces.rb
639
+ - spec/factories/team.rb
640
+ - spec/factories/user.rb
641
+ - spec/factories/disease.rb
642
+ - spec/factories/search_kid.rb
643
+ - spec/factories/page.rb
636
644
  - spec/factories/venue.rb
645
+ - spec/factories/organization/addresses.rb
646
+ - spec/factories/organization/phone_numbers.rb
647
+ - spec/factories/organization/email_addresses.rb
648
+ - spec/factories/lib/faker_patch.rb
649
+ - spec/factories/lib/helpers.rb
650
+ - spec/factories/newsletter_recipient.rb
651
+ - spec/factories/payment.rb
652
+ - spec/factories/contact.rb
653
+ - spec/factories/message.rb
637
654
  - spec/factories/search_fundraiser.rb
638
- - spec/factories/institution.rb
639
- - spec/factories/grant_institution.rb
640
- - spec/factories/address.rb
641
- - spec/factories/phone.rb
642
- - spec/factories/event/totals.rb
643
- - spec/factories/event/photos.rb
644
- - spec/factories/event/contacts/contact.rb
645
- - spec/factories/event/contacts/name_pieces.rb
646
- - spec/factories/event/coach_tracking/coaching_interactions.rb
647
- - spec/factories/event/coach_tracking/proceeds.rb
648
- - spec/factories/event/coach_tracking/plaque.rb
649
- - spec/factories/event/coach_tracking.rb
650
- - spec/factories/event/venue/location.rb
651
- - spec/factories/event/venue/social.rb
652
- - spec/factories/event/contacts.rb
653
- - spec/factories/event/venue.rb
654
- - spec/factories/fund.rb
655
- - spec/factories/event.rb
656
- - spec/factories/kid/custom_institution.rb
657
- - spec/factories/shave_schedule/time_selection_permissions.rb
658
- - spec/factories/user.rb
659
- - spec/factories/kid_honor.rb
655
+ - spec/factories/third_party_media.rb
656
+ - spec/factories/donation/participant.rb
657
+ - spec/factories/grant.rb
658
+ - spec/factories/fundraiser.rb
659
+ - spec/factories/contact_group.rb
660
+ - spec/factories/email_address.rb
661
+ - spec/factories/permissions.rb
662
+ - spec/factories/campaign.rb