stbaldricks 10.8.3 → 10.10.1.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: de610d3d12ccd16a6a3080162c6106654e99ad7218b44c4b4f82c7fda773da65
4
- data.tar.gz: ec7a326612153aa6665e7eace72035421f05d76705e3dfeffaba18ef602167bb
3
+ metadata.gz: 68139f1ffca2ac1e00f1c8ddb011a76116c53e3d0f535c69da379ad8c527785e
4
+ data.tar.gz: 8547d7ca5073a2f31f9af099e1bccd10231b9517935261fea8d3d1fde5b37bf2
5
5
  SHA512:
6
- metadata.gz: 317d353fe5ab69f6eedbc36b3917ab850f603ad861a3a32cacb2a6981cc95388a8c3d5ca23f9ed53c1113431b34185412b3c7484b62fe225dd3a24fdf850dfb4
7
- data.tar.gz: 79909f1beb3a55bda5950c05ac644ccf5a8b6e165db29c2bdc78b20dffe8b04ca93a21ca3a8ee0d972334baca1ef662d51bcf108c63ef3fc321cb953d0807e4a
6
+ metadata.gz: 3facdf398a27a0855c36d58f8490c88005449c10787a10d978c62e63f56a6e53ca454d898f24eb3a1337225914a124997384e59d647270fa9d7e9e8f9a6848e3
7
+ data.tar.gz: 5b99536bcb45d7eb1663c0a63caa468c2b8396457af2d856bf3bdd04b5eaecc630a02984b7666ef69d01abf9f2cce2bd0975f5fb391a04c8f02a7614dfaf1ebb
@@ -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
 
@@ -130,6 +130,7 @@ module SBF
130
130
  OTHER = 'other'.freeze
131
131
  LEGACY = 'legacy'.freeze
132
132
  VIRTUAL = 'virtual'.freeze
133
+ HYBRID = 'hybrid'.freeze
133
134
  end
134
135
 
135
136
  attr_accessor :type
@@ -198,6 +199,11 @@ module SBF
198
199
  status == SBF::Client::Event::Status::ACTIVE
199
200
  end
200
201
 
202
+ def venue_virtual?
203
+ [SBF::Client::Event::Venue::Location::Type::VIRTUAL,
204
+ SBF::Client::Event::Venue::Location::Type::HYBRID].include? venue.location.type
205
+ end
206
+
201
207
  def virtual?
202
208
  (id == 1) && (sub_type == SBF::Client::Event::SubType::VIRTUAL)
203
209
  end
@@ -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.8.3'.freeze
3
+ VERSION = '10.10.1.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stbaldricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.8.3
4
+ version: 10.10.1.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -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:
@@ -614,6 +616,7 @@ test_files:
614
616
  - spec/factories/kid/custom_institution.rb
615
617
  - spec/factories/person.rb
616
618
  - spec/factories/search_participant.rb
619
+ - spec/factories/milestone.rb
617
620
  - spec/factories/fundraising_page.rb
618
621
  - spec/factories/photos.rb
619
622
  - spec/factories/team/totals.rb