stbaldricks 10.4.0.alpha.1 → 10.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stbaldricks/configuration.rb +3 -3
  3. data/lib/stbaldricks/endpoints/donation.rb +2 -2
  4. data/lib/stbaldricks/endpoints/lib/entity.rb +2 -2
  5. data/lib/stbaldricks/endpoints/photo.rb +1 -3
  6. data/lib/stbaldricks/entities/concerns/entity_response_concern.rb +2 -4
  7. data/lib/stbaldricks/entities/config.rb +1 -1
  8. data/lib/stbaldricks/entities/donation/promo_code.rb +18 -6
  9. data/lib/stbaldricks/entities/event.rb +1 -5
  10. data/lib/stbaldricks/entities/fund.rb +1 -2
  11. data/lib/stbaldricks/entities/fundraiser.rb +1 -5
  12. data/lib/stbaldricks/entities/lib/base.rb +24 -27
  13. data/lib/stbaldricks/entities/lib/cacheable.rb +1 -3
  14. data/lib/stbaldricks/entities/lib/collection.rb +2 -2
  15. data/lib/stbaldricks/entities/lib/not_implemented_object.rb +4 -4
  16. data/lib/stbaldricks/entities/lib/top_level.rb +4 -4
  17. data/lib/stbaldricks/entities/memorial.rb +1 -2
  18. data/lib/stbaldricks/entities/page.rb +2 -4
  19. data/lib/stbaldricks/entities/participant.rb +16 -19
  20. data/lib/stbaldricks/entities/person.rb +4 -5
  21. data/lib/stbaldricks/entities/photo.rb +1 -1
  22. data/lib/stbaldricks/entities/team.rb +1 -4
  23. data/lib/stbaldricks/enums/permission.rb +8 -8
  24. data/lib/stbaldricks/log.rb +1 -1
  25. data/lib/stbaldricks/patches/hash.rb +2 -2
  26. data/lib/stbaldricks/request.rb +3 -3
  27. data/lib/stbaldricks/version.rb +1 -1
  28. data/lib/stbaldricks_factories.rb +1 -1
  29. data/spec/factories/challenger.rb +2 -2
  30. data/spec/factories/kid.rb +3 -3
  31. data/spec/factories/kid_institution.rb +2 -2
  32. data/spec/factories/team.rb +2 -2
  33. metadata +88 -88
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23006a43310cb68778025d2c4d4b01ebbd8b8b5ff97537307cc80736e0767818
4
- data.tar.gz: 16883adc356055802ee3508b606ac6434a414120485127a0e8d00a47ce0cffa9
3
+ metadata.gz: 0ea675b1d359942d0694800c9e8588275e83ef41a8e363e39a2d6aa4ef4a5a02
4
+ data.tar.gz: 13a1140cc333d580dd7725e6acf598a840d3b1529fb41edddf3cccc59761df7e
5
5
  SHA512:
6
- metadata.gz: 26ae5dc27958518bf7022b6983f7bd054ad174ba558b57e93941adf23a93b7aad253f6732632ccc17e126d2e44de3ea42b82f77cbf05cdaca977f714dc4416e7
7
- data.tar.gz: d6c39f9181c85719f98c8fe72b256c33764895351ba7d9d2a439ad219084395d7ca6a51db7cc5c33a2092497196a5deaa2ada9bfdbbbd0a76c9163df78b04e87
6
+ metadata.gz: c44585e4e05bd24ef4a976926995f409790707149d0298fcf3223febdf9219cf4ad774bd7213268cbe2b7d896393a4344d4f60f7cfd392cddbd1c8b895412830
7
+ data.tar.gz: 400493e6ff586305caf3d53bf22fd79f6838515ddfbc4266b7530f9c584e9a11e9fa70e1d35fcb2e1e3518837a9649a3499847ea11060a8f277cfe01d4c72b17
@@ -8,7 +8,7 @@ module SBF
8
8
  class Configuration
9
9
  DEFAULT_API_ENDPOINT = 'https://api'
10
10
 
11
- @_logger = nil
11
+ @logger = nil
12
12
 
13
13
  class << self
14
14
  attr_writer :base_uri, :user_token, :general_token, :request_id
@@ -31,11 +31,11 @@ module SBF
31
31
  missing_methods = SBF::Client::LOG::REQUIRED_METHODS.reject { |method| new_logger.respond_to?(method) }
32
32
  raise SBF::Client::Configuration::Error.new('logger', "must respond to: #{missing_methods.join(', ')}") unless missing_methods.empty?
33
33
 
34
- @_logger = new_logger
34
+ @logger = new_logger
35
35
  end
36
36
 
37
37
  def self.logger
38
- @_logger ||= SBF::Client::DefaultLogger.instance
38
+ @logger ||= SBF::Client::DefaultLogger.instance
39
39
  end
40
40
 
41
41
  class Error < ::StandardError
@@ -6,10 +6,10 @@ module SBF
6
6
  class DonationEndpoint < SBF::Client::EntityEndpoint
7
7
  def create(entity_or_hash, with = {})
8
8
  unless SBF::Client::Configuration.forwarded_for
9
- SBF::Client::LOG.warn {
9
+ SBF::Client::LOG.warn do
10
10
  "SBF::Client No forwarded_for configured for the client on the donation create route. \
11
11
  This may cause your app to be blocked from creating donations if too many errors occur."
12
- }
12
+ end
13
13
  end
14
14
  super
15
15
  end
@@ -224,7 +224,7 @@ module SBF
224
224
  end
225
225
  private :normalize_with
226
226
 
227
- # rubocop:disable IdenticalConditionalBranches
227
+ # rubocop:disable Style/IdenticalConditionalBranches
228
228
  def hydrated_entity(response, data, entity_or_hash)
229
229
  parsed_response_body = JSON.parse(response.body).symbolize!
230
230
 
@@ -258,7 +258,7 @@ module SBF
258
258
  end
259
259
  end
260
260
  private :hydrated_entity
261
- # rubocop:enable IdenticalConditionalBranches
261
+ # rubocop:enable Style/IdenticalConditionalBranches
262
262
  end
263
263
  end
264
264
  end
@@ -61,9 +61,7 @@ module SBF
61
61
  end
62
62
  end
63
63
 
64
- private
65
-
66
- def photo_for_upload(file, data)
64
+ private def photo_for_upload(file, data)
67
65
  if data.is_a?(SBF::Client::Photo)
68
66
  data.file = file
69
67
  data
@@ -47,16 +47,14 @@ module EntityResponseConcern
47
47
  self
48
48
  end
49
49
 
50
- private
51
-
52
- def single_active_model_error
50
+ private def single_active_model_error
53
51
  return if errors.empty?
54
52
  return [:base, errors[:base].first] if errors[:base].any?
55
53
 
56
54
  errors.first
57
55
  end
58
56
 
59
- def log_deprecated(method_name, method_caller = nil)
57
+ private def log_deprecated(method_name, method_caller = nil)
60
58
  SBF::Client::Configuration.logger.warn do
61
59
  caller_message = method_caller.nil? ? '' : " Called from #{method_caller.first}"
62
60
 
@@ -19,7 +19,7 @@ module SBF
19
19
  attr_reader :years_for_knight_commander
20
20
  attr_reader :years_for_crusader
21
21
  attr_reader :years_for_baron
22
- #NOTE: If you add another attribute, be sure to mock it out in `configure :test` of app.rb
22
+ # NOTE: If you add another attribute, be sure to mock it out in `configure :test` of app.rb
23
23
 
24
24
  # Attempts to call the method on the cached configuration object
25
25
  # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
@@ -41,13 +41,24 @@ module SBF
41
41
  BRIGADE = 'brigade'
42
42
  SCHICK = 'schick'
43
43
  BATTLE = 'battle'
44
- BLANK4 = 'blank4'
45
- BLANK5 = 'blank5'
46
- BLANK6 = 'blank6'
47
- BLANK7 = 'blank7'
48
- BLANK8 = 'blank8'
44
+ CCQR = 'ccqr'
45
+ QREVENTPRINTOUT = 'qreventprintout'
46
+ PDASHQR = 'pdashqr'
47
+ APPEAL = 'appeal'
48
+ INSTAGRAM = 'instagram'
49
49
  BLANK9 = 'blank9'
50
50
  BLANK10 = 'blank10'
51
+ BLANK11 = 'blank11'
52
+ BLANK12 = 'blank12'
53
+ BLANK13 = 'blank13'
54
+ BLANK14 = 'blank14'
55
+ BLANK15 = 'blank15'
56
+ BLANK16 = 'blank16'
57
+ BLANK17 = 'blank17'
58
+ BLANK18 = 'blank18'
59
+ BLANK19 = 'blank19'
60
+ BLANK20 = 'blank20'
61
+ BLANK21 = 'blank21'
51
62
 
52
63
  def self.to_a
53
64
  # Defining the array explicitly, in order rather than const_getting since some things in website-ruby depend on the order
@@ -55,7 +66,8 @@ module SBF
55
66
  GIVING_TUESDAY, SURVIVOR, SPONSORSHIP, LAPSED_LOW, LAPSED_MID, RMMEVENTS, YEAR_END_DG, LAPSED_DG, FB_FUNDRAISER,
56
67
  MOBILE_CAUSE, INTERNATIONAL, ACS, HEAD_SHAVING, SPORT_CLIPS, TWENTIETH_ANNIVERSARY, DWYW, GRANTS, SUMMER,
57
68
  ADVOCACY, MISSION, RECURRING_GIVING, ACSEVENTS, HS_TO_DONOR, WIRELESS_VISION, BMC, DUTCH_BROS, FADO, SAP, BRIGADE,
58
- SCHICK, BATTLE, BLANK4, BLANK5, BLANK6, BLANK7, BLANK8, BLANK9, BLANK10]
69
+ SCHICK, BATTLE, CCQR, QREVENTPRINTOUT, PDASHQR, APPEAL, INSTAGRAM, BLANK9, BLANK10, BLANK11, BLANK12, BLANK13,
70
+ BLANK14, BLANK15, BLANK16, BLANK17, BLANK18, BLANK19, BLANK20, BLANK21]
59
71
  end
60
72
  end
61
73
  end
@@ -22,11 +22,7 @@ require 'stbaldricks/entities/concerns/venue_concern'
22
22
  module SBF
23
23
  module Client
24
24
  class Event < SBF::Client::TopLevelEntity
25
- include Entities::Cacheable
26
- include DonationRecipientConcern
27
- include EventYearConcern
28
- include FundraisingPageConcern
29
- include VenueConcern
25
+ include VenueConcern, FundraisingPageConcern, EventYearConcern, DonationRecipientConcern, Entities::Cacheable
30
26
  endpoint SBF::Client::EventEndpoint
31
27
  actions DEFAULT_CRUD_ACTIONS
32
28
  action :invite
@@ -8,8 +8,7 @@ require 'stbaldricks/entities/concerns/donation_recipient_concern'
8
8
  module SBF
9
9
  module Client
10
10
  class Fund < SBF::Client::TopLevelEntity
11
- include Entities::DefaultCacheable
12
- include DonationRecipientConcern
11
+ include DonationRecipientConcern, Entities::DefaultCacheable
13
12
  endpoint SBF::Client::FundEndpoint
14
13
  action :allowed_entities
15
14
  action :get
@@ -16,11 +16,7 @@ require 'stbaldricks/entities/concerns/venue_concern'
16
16
  module SBF
17
17
  module Client
18
18
  class Fundraiser < SBF::Client::TopLevelEntity
19
- include Entities::DefaultCacheable
20
- include DonationRecipientConcern
21
- include EventYearConcern
22
- include FundraisingPageConcern
23
- include VenueConcern
19
+ include VenueConcern, FundraisingPageConcern, EventYearConcern, DonationRecipientConcern, Entities::DefaultCacheable
24
20
  endpoint SBF::Client::FundraiserEndpoint
25
21
  actions DEFAULT_CRUD_ACTIONS
26
22
  action :join_team
@@ -1,6 +1,6 @@
1
1
  # Require all monkey patches
2
2
  patch_dir = File.expand_path('../../patches', __dir__)
3
- Dir["#{patch_dir}/*.rb"].each { |file| require file }
3
+ Dir["#{patch_dir}/*.rb"].sort.each { |file| require file }
4
4
 
5
5
  require 'set'
6
6
  require 'stbaldricks/client'
@@ -11,12 +11,8 @@ require 'securerandom'
11
11
  module SBF
12
12
  module Client
13
13
  class BaseEntity
14
- include ActiveModel::AttributeAssignment
15
- include ActiveModel::Dirty
16
- extend ActiveModel::Naming
17
- extend ActiveModel::Translation
18
- include ActiveModel::Conversion
19
- include EntityResponseConcern
14
+ include EntityResponseConcern, ActiveModel::Conversion, ActiveModel::Dirty, ActiveModel::AttributeAssignment
15
+ extend ActiveModel::Translation, ActiveModel::Naming
20
16
 
21
17
  attr_reader :errors
22
18
 
@@ -42,7 +38,7 @@ module SBF
42
38
 
43
39
  # Overridden from ActiveModel::Naming to remove namespace and Full/Partial
44
40
  def model_name
45
- @_model_name ||= ActiveModel::Name.new(self, SBF::Client, self.class.name.gsub(/::(Full|Partial)/, '::'))
41
+ @model_name ||= ActiveModel::Name.new(self, SBF::Client, self.class.name.gsub(/::(Full|Partial)/, '::'))
46
42
  end
47
43
 
48
44
  def persisted?
@@ -113,7 +109,7 @@ module SBF
113
109
 
114
110
  # Mimic ActiveRecord::AttributeAssignment alias
115
111
  alias_method :attributes=, :assign_attributes
116
-
112
+ # rubocop:disable Naming/MemoizedInstanceVariableName
117
113
  def initialize_attributes(data)
118
114
  data ||= {}
119
115
  data.each do |key, value|
@@ -138,6 +134,7 @@ module SBF
138
134
  @collection_attributes ||= Set.new
139
135
  end
140
136
  private :initialize_attributes
137
+ # rubocop:enable Naming/MemoizedInstanceVariableName
141
138
 
142
139
  def mark_attribute_not_provided(name)
143
140
  return if not_provided_attributes.include?(name)
@@ -157,18 +154,18 @@ module SBF
157
154
 
158
155
  # If we set the value in a not_provided method, that means we now have requested the data and we
159
156
  # should replace the original getter/setter and set the value using the original method
160
- define_singleton_method(setter) { |v|
157
+ define_singleton_method(setter) do |v|
161
158
  unmark_attribute_not_provided(name)
162
159
  super(v)
163
- }
160
+ end
164
161
 
165
162
  # If we try to get the value in a not_provided method, we should raise an error
166
- define_singleton_method(getter) {
163
+ define_singleton_method(getter) do
167
164
  raise(
168
165
  SBF::Client::DataNotProvidedError,
169
166
  "Data not provided for the #{name} attribute. This is usually due to the attribute not being requested in the 'with' declaration"
170
167
  )
171
- }
168
+ end
172
169
  end
173
170
  private :mark_attribute_not_provided
174
171
 
@@ -392,7 +389,7 @@ module SBF
392
389
  private_class_method :define_changing_attr_methods
393
390
 
394
391
  # Creates a private method which resolves the class type based on the class mappings and the value
395
- # rubocop:disable MethodLength
392
+ # rubocop:disable Metrics/MethodLength
396
393
  def self.add_class_selector_method(attribute, class_mappings)
397
394
  method_name = :"select_#{attribute}_class"
398
395
 
@@ -418,8 +415,8 @@ module SBF
418
415
 
419
416
  else
420
417
  # No class conversion if the value is already an entity
421
- return nil if parsed_class_mappings.any? { |_, c1, c2|
422
- [c1, c2].compact.any? { |allowed_class|
418
+ return nil if parsed_class_mappings.any? do |_, c1, c2|
419
+ [c1, c2].compact.any? do |allowed_class|
423
420
  if allowed_class.instance_of?(Class)
424
421
  # Otherwise, return true if the value is an instance of the allowed class
425
422
  value.is_a?(allowed_class)
@@ -430,15 +427,15 @@ module SBF
430
427
  allowed_class.constants.any? { |const_name| allowed_class.const_get(const_name) == value }
431
428
 
432
429
  end
433
- }
434
- }
430
+ end
431
+ end
435
432
 
436
433
  # Convert to child class if given class is a parent of the same name
437
- parsed_class_mappings.each { |_, c1, c2|
438
- [c1, c2].compact.each { |allowed_class|
434
+ parsed_class_mappings.each do |_, c1, c2|
435
+ [c1, c2].compact.each do |allowed_class|
439
436
  return allowed_class if allowed_class.ancestors.find { |a| a == value.class && a.demodulize == value.class.demodulize }
440
- }
441
- }
437
+ end
438
+ end
442
439
 
443
440
  # Don't know how to handle whatever the user entered. Raise an error.
444
441
  # (Nil and Hash are always valid values)
@@ -454,7 +451,7 @@ module SBF
454
451
 
455
452
  private_class_method method_name
456
453
  end
457
- # rubocop:enable MethodLength
454
+ # rubocop:enable Metrics/MethodLength
458
455
  private_class_method :add_class_selector_method
459
456
 
460
457
  def self.get_mappings(attribute, class_mappings)
@@ -544,7 +541,7 @@ module SBF
544
541
  # Recursively converts an entity into a Hash
545
542
  def to_hash
546
543
  entity_hash = {}
547
- self.class.defined_attributes.each { |key|
544
+ self.class.defined_attributes.each do |key|
548
545
  # If the method was not retrieved, do not include it in the hash
549
546
  next if not_provided_attributes.include?(key)
550
547
 
@@ -557,11 +554,11 @@ module SBF
557
554
 
558
555
  # If the value is an Array, need to try to call to_hash on each item
559
556
  elsif value.is_a?(Array)
560
- value.map { |element|
557
+ value.map do |element|
561
558
  next element.to_hash if element.is_a?(BaseEntity)
562
559
 
563
560
  next element
564
- }
561
+ end
565
562
 
566
563
  # Collections should return empty array rather than nil
567
564
  elsif value.nil? && self.class.collection_attributes.include?(key)
@@ -572,7 +569,7 @@ module SBF
572
569
  value
573
570
 
574
571
  end
575
- }
572
+ end
576
573
 
577
574
  # Return the hash
578
575
  entity_hash
@@ -31,9 +31,7 @@ module SBF
31
31
  id
32
32
  end
33
33
 
34
- private
35
-
36
- def cache_id_from_hash_func(proc)
34
+ private def cache_id_from_hash_func(proc)
37
35
  raise ArgumentError, "Unable to re-set cache_id_from_hash on #{name}" if @cache_id_proc
38
36
 
39
37
  @cache_id_proc = proc
@@ -27,7 +27,7 @@ module SBF
27
27
  SBF::Client::ErrorEntity.new(code: errors.code, type: errors.type, details: details)
28
28
  end
29
29
 
30
- # rubocop:disable MultipleComparison
30
+ # rubocop:disable Style/MultipleComparison
31
31
  def [](*args)
32
32
  log_deprecated('[]', caller) if args == [:results] || args == [:total_count]
33
33
  return self if args == [:results]
@@ -36,7 +36,7 @@ module SBF
36
36
  result = super
37
37
  result.is_a?(Array) ? self.class.new(result, total_count) : result
38
38
  end
39
- # rubocop:enable MultipleComparison
39
+ # rubocop:enable Style/MultipleComparison
40
40
  end
41
41
  end
42
42
  end
@@ -7,11 +7,11 @@ module SBF
7
7
  attr_accessor :props
8
8
 
9
9
  def initialize(attributes = {})
10
- @props = {}.tap { |hsh|
11
- attributes.each { |k, v|
10
+ @props = {}.tap do |hsh|
11
+ attributes.each do |k, v|
12
12
  hsh[k.to_sym] = v
13
- }
14
- }
13
+ end
14
+ end
15
15
 
16
16
  super
17
17
  end
@@ -8,8 +8,8 @@ module SBF
8
8
  include Entities::Cacheable
9
9
 
10
10
  DEFAULT_ENDPOINT = SBF::Client::EntityEndpoint
11
- DEFAULT_INSTANCE_ACTIONS = [:save, :create, :update, :delete]
12
- DEFAULT_CLASS_ACTIONS = [:get, :find, :find_first, :aggregate, :update, :delete]
11
+ DEFAULT_INSTANCE_ACTIONS = %i(save create update delete)
12
+ DEFAULT_CLASS_ACTIONS = %i(get find find_first aggregate update delete)
13
13
  DEFAULT_CRUD_ACTIONS = DEFAULT_INSTANCE_ACTIONS + DEFAULT_CLASS_ACTIONS
14
14
 
15
15
  class << self
@@ -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
- [:save, :create].include?(name) && result.errors? ? false : result
48
+ %i(save create).include?(name) && result.errors? ? false : result
49
49
  end
50
50
  end
51
51
 
@@ -58,7 +58,7 @@ module SBF
58
58
  end
59
59
 
60
60
  def action(name)
61
- instance_action(name) if [:save, :create].include?(name)
61
+ instance_action(name) if %i(save create).include?(name)
62
62
 
63
63
  if name == :update
64
64
  define_method(name) do |*args|
@@ -7,8 +7,7 @@ require 'stbaldricks/entities/concerns/donation_recipient_concern'
7
7
  module SBF
8
8
  module Client
9
9
  class Memorial < SBF::Client::TopLevelEntity
10
- include Entities::DefaultCacheable
11
- include DonationRecipientConcern
10
+ include DonationRecipientConcern, Entities::DefaultCacheable
12
11
  actions DEFAULT_CRUD_ACTIONS
13
12
  blacklist_action :save
14
13
  blacklist_action :create
@@ -61,7 +61,7 @@ module SBF
61
61
 
62
62
  def add_draft_sections(sections)
63
63
  sections.each do |cid, data|
64
- #convert symbol to integer
64
+ # convert symbol to integer
65
65
  cid = cid.to_s.to_i
66
66
 
67
67
  content = published_content.find { |c| c.id == cid }
@@ -69,9 +69,7 @@ module SBF
69
69
  end
70
70
  end
71
71
 
72
- private
73
-
74
- def update_draft_content_section(content, data, cid)
72
+ private def update_draft_content_section(content, data, cid)
75
73
  # update or create draft version of content
76
74
  draft = draft_content.find { |d| d.id == cid }
77
75
  if draft.nil?
@@ -18,10 +18,7 @@ require 'stbaldricks/entities/concerns/fundraising_page_concern'
18
18
  module SBF
19
19
  module Client
20
20
  class Participant < SBF::Client::TopLevelEntity
21
- include Entities::DefaultCacheable
22
- include DonationRecipientConcern
23
- include EventYearConcern
24
- include FundraisingPageConcern
21
+ include FundraisingPageConcern, EventYearConcern, DonationRecipientConcern, Entities::DefaultCacheable
25
22
  endpoint SBF::Client::ParticipantEndpoint
26
23
  actions DEFAULT_CRUD_ACTIONS
27
24
  action :join_team
@@ -54,21 +51,21 @@ module SBF
54
51
  XXXXXL = '5x'
55
52
 
56
53
  def self.list
57
- [
58
- :FAST_REG_UNSPECIFIED,
59
- :YOUTH_SMALL,
60
- :YOUTH_MEDIUM,
61
- :YOUTH_LARGE,
62
- :XS,
63
- :SMALL,
64
- :MEDIUM,
65
- :LARGE,
66
- :XL,
67
- :XXL,
68
- :XXXL,
69
- :XXXXL,
70
- :XXXXXL
71
- ]
54
+ %i(
55
+ FAST_REG_UNSPECIFIED
56
+ YOUTH_SMALL
57
+ YOUTH_MEDIUM
58
+ YOUTH_LARGE
59
+ XS
60
+ SMALL
61
+ MEDIUM
62
+ LARGE
63
+ XL
64
+ XXL
65
+ XXXL
66
+ XXXXL
67
+ XXXXXL
68
+ )
72
69
  end
73
70
  end
74
71
 
@@ -13,17 +13,16 @@ require 'stbaldricks/entities/concerns/type_concern'
13
13
  module SBF
14
14
  module Client
15
15
  class Person < SBF::Client::TopLevelEntity
16
- include Entities::DefaultCacheable
17
- include TypeConcern
16
+ include TypeConcern, Entities::DefaultCacheable
18
17
  disallow_instantiation
19
18
 
20
19
  actions DEFAULT_CRUD_ACTIONS
21
20
  blacklist_action :delete
22
21
 
23
22
  module Status
24
- PENDING = 'pending' #1
25
- ACTIVE = 'active' #2
26
- DECEASED = 'deceased' #7 (may be deprecated: working on this with SBF)
23
+ PENDING = 'pending' # 1
24
+ ACTIVE = 'active' # 2
25
+ DECEASED = 'deceased' # 7 (may be deprecated: working on this with SBF)
27
26
  end
28
27
 
29
28
  module Type
@@ -89,7 +89,7 @@ module SBF
89
89
  attr_reader :original_filename
90
90
 
91
91
  def to_json(*a)
92
- to_hash.reject { |k, _v| [:file, :filename].include? k }.to_json(*a)
92
+ to_hash.reject { |k, _v| %i(file filename).include? k }.to_json(*a)
93
93
  end
94
94
 
95
95
  module Category
@@ -12,10 +12,7 @@ require 'stbaldricks/entities/concerns/fundraising_page_concern'
12
12
  module SBF
13
13
  module Client
14
14
  class Team < SBF::Client::TopLevelEntity
15
- include Entities::DefaultCacheable
16
- include DonationRecipientConcern
17
- include EventYearConcern
18
- include FundraisingPageConcern
15
+ include FundraisingPageConcern, EventYearConcern, DonationRecipientConcern, Entities::DefaultCacheable
19
16
  actions DEFAULT_CRUD_ACTIONS
20
17
 
21
18
  blacklist_action :create
@@ -18,7 +18,7 @@ module SBF
18
18
 
19
19
  MANAGE_SYSTEM = 109
20
20
 
21
- #Event permissions
21
+ # Event permissions
22
22
  EVENT_MANAGE = 200
23
23
  EVENT_MANAGE_INFO = 201
24
24
  EVENT_MANAGE_ACTIVITIES = 202
@@ -42,7 +42,7 @@ module SBF
42
42
  EVENT_FAST_REGISTRATION = 220
43
43
  EVENT_DELETE_EVENT = 221
44
44
 
45
- #text descriptions found in LookupUtility
45
+ # text descriptions found in LookupUtility
46
46
  EVENT_MEMBER_UPDATE_EVENT_INFORMATION = 300
47
47
  EVENT_MEMBER_ACTIVITIES = 301
48
48
  EVENT_MEMBER_PHOTO_GALLERY = 302
@@ -60,7 +60,7 @@ module SBF
60
60
  EVENT_MEMBER_COMMUNICATE = 315
61
61
  EVENT_MEMBER_FAST_DONATION = 316
62
62
 
63
- #Participant Role Permissions
63
+ # Participant Role Permissions
64
64
  EVENT_ORGANIZER = 1905
65
65
  EVENT_BARBER_COORDINATOR = 1911
66
66
  EVENT_SHAVEE_RECRUITER = 1913
@@ -115,7 +115,7 @@ module SBF
115
115
 
116
116
  EVENT_APPLICATION_MANAGE = 2202
117
117
 
118
- #Team Permissions
118
+ # Team Permissions
119
119
  TEAM_TEAM_CAPTAIN = 2101
120
120
 
121
121
  # Memorial Permissions
@@ -140,7 +140,7 @@ module SBF
140
140
  DELETE_GROUPS => :DELETE_GROUPS,
141
141
  EDIT_GROUPS => :EDIT_GROUPS,
142
142
  MANAGE_SYSTEM => :MANAGE_SYSTEM,
143
- #Event permissions
143
+ # Event permissions
144
144
  EVENT_MANAGE => :EVENT_MANAGE,
145
145
  EVENT_MANAGE_INFO => :EVENT_MANAGE_INFO,
146
146
  EVENT_MANAGE_ACTIVITIES => :EVENT_MANAGE_ACTIVITIES,
@@ -179,7 +179,7 @@ module SBF
179
179
  EVENT_MEMBER_VIEW_TEAM_TOTALS_LIST => :EVENT_MEMBER_VIEW_TEAM_TOTALS_LIST,
180
180
  EVENT_MEMBER_COMMUNICATE => :EVENT_MEMBER_COMMUNICATE,
181
181
  EVENT_MEMBER_FAST_DONATION => :EVENT_MEMBER_FAST_DONATION,
182
- #Participant Role Permissions
182
+ # Participant Role Permissions
183
183
  EVENT_ORGANIZER => :EVENT_ORGANIZER,
184
184
  EVENT_BARBER_COORDINATOR => :EVENT_BARBER_COORDINATOR,
185
185
  EVENT_SHAVEE_RECRUITER => :EVENT_SHAVEE_RECRUITER,
@@ -211,9 +211,9 @@ module SBF
211
211
  FUNDRAISER_MANAGE => :FUNDRAISER_MANAGE,
212
212
  FUNDRAISER_DELETE_FUNDRAISER => :FUNDRAISER_DELETE_FUNDRAISER,
213
213
  EVENT_APPLICATION_MANAGE => :EVENT_APPLICATION_MANAGE,
214
- #Team Permissions
214
+ # Team Permissions
215
215
  TEAM_TEAM_CAPTAIN => :TEAM_TEAM_CAPTAIN,
216
- #Memorial Permissions
216
+ # Memorial Permissions
217
217
  MEMORIAL_VIEW => :MEMORIAL_VIEW,
218
218
  MEMORIAL_MANAGE => :MEMORIAL_MANAGE,
219
219
  # Challenge Permissions
@@ -6,7 +6,7 @@ module SBF
6
6
  class LOG
7
7
  include Singleton
8
8
 
9
- REQUIRED_METHODS = [:debug, :info, :warn, :error, :fatal, :unknown, :add, :level]
9
+ REQUIRED_METHODS = %i(debug info warn error fatal unknown add level)
10
10
 
11
11
  # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
12
12
  def self.method_missing(sym, *args, &block)
@@ -3,9 +3,9 @@ class Hash
3
3
  keys.each do |key|
4
4
  unless key.is_a? Symbol
5
5
  value = delete(key)
6
- # rubocop:disable RescueModifier
6
+ # rubocop:disable Style/RescueModifier
7
7
  self[(key.to_sym rescue key) || key] = value
8
- # rubocop:enable RescueModifier
8
+ # rubocop:enable Style/RescueModifier
9
9
  end
10
10
 
11
11
  value.symbolize! if value.is_a?(Hash) || value.is_a?(Array)
@@ -7,15 +7,15 @@ require 'uri'
7
7
 
8
8
  # Require all monkey patches
9
9
  patch_dir = File.realpath("#{File.dirname(__FILE__)}/patches/")
10
- Dir["#{patch_dir}/*.rb"].each { |file| require file }
10
+ Dir["#{patch_dir}/*.rb"].sort.each { |file| require file }
11
11
 
12
12
  # Require all entities
13
13
  entity_dir = File.realpath("#{File.dirname(__FILE__)}/entities/")
14
- Dir["#{entity_dir}/**/*.rb"].each { |file| require file }
14
+ Dir["#{entity_dir}/**/*.rb"].sort.each { |file| require file }
15
15
 
16
16
  # Require all enums
17
17
  enum_dir = File.realpath("#{File.dirname(__FILE__)}/enums/")
18
- Dir["#{enum_dir}/*.rb"].each { |file| require file }
18
+ Dir["#{enum_dir}/*.rb"].sort.each { |file| require file }
19
19
 
20
20
  # Client library class for accessing the St. Baldrick's Foundation API
21
21
  module SBF
@@ -1,5 +1,5 @@
1
1
  module SBF
2
2
  module Client
3
- VERSION = '10.4.0.alpha.1'
3
+ VERSION = '10.6.0'
4
4
  end
5
5
  end
@@ -2,4 +2,4 @@ require 'stbaldricks'
2
2
 
3
3
  project_root = File.realpath("#{File.dirname(__FILE__)}/../")
4
4
  $LOAD_PATH.unshift(project_root)
5
- Dir["#{project_root}/spec/factories/**/*.rb"].each { |file| require file }
5
+ Dir["#{project_root}/spec/factories/**/*.rb"].sort.each { |file| require file }
@@ -2,9 +2,9 @@ require_relative 'lib/helpers'
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :_base_challenger, class: SBF::Client::Challenger do
5
- to_create { |it|
5
+ to_create do |it|
6
6
  raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save
7
- }
7
+ end
8
8
 
9
9
  initialize_with do
10
10
  new(attributes)
@@ -2,10 +2,10 @@ require_relative 'lib/helpers'
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :kid, class: SBF::Client::FullKid do
5
- to_create { |it|
5
+ to_create do |it|
6
6
  it.relationships.first.person = FactoryBot.create(:person) if it.relationships.first.person.nil?
7
7
  raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save
8
- }
8
+ end
9
9
 
10
10
  initialize_with do
11
11
  new(attributes)
@@ -19,7 +19,7 @@ FactoryBot.define do
19
19
  after :build do |kid, evaluator|
20
20
  kid.name_pieces = build(:name_pieces) if unpopulated?(evaluator, :name_pieces)
21
21
  kid.address = build(:address) if unpopulated?(evaluator, :address)
22
- kid.diagnosis = build(:diagnosis) if unpopulated?(evaluator, :diagnosis)
22
+ kid.diagnosis = build(:diagnosis, date: Faker::Date.between(from: kid.birthday, to: DateTime.now).to_s) if unpopulated?(evaluator, :diagnosis)
23
23
  kid.treatment_status = build(:treatment_status) if unpopulated?(evaluator, :treatment_status)
24
24
  kid.web_page = build(:web_page) if unpopulated?(evaluator, :web_page)
25
25
  kid.photos = build(:photos) if unpopulated?(evaluator, :photos)
@@ -3,10 +3,10 @@ require_relative 'lib/helpers'
3
3
  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
- to_create { |it|
6
+ to_create do |it|
7
7
  it.kid = FactoryBot.create(:kid) if it.kid.nil?
8
8
  raise "Failed to create #{it.class}: #{it.errors.details}" unless it.save(kid: {}, institution: {})
9
- }
9
+ end
10
10
 
11
11
  initialize_with do
12
12
  new(attributes)
@@ -2,7 +2,7 @@ require_relative 'lib/helpers'
2
2
 
3
3
  FactoryBot.define do
4
4
  factory :team, class: SBF::Client::FullTeam do
5
- to_create { |it|
5
+ to_create do |it|
6
6
  # Really gross - we don't support team create through the api currently.
7
7
  # Instead we need to use the start_team/move_participant_to_team logic
8
8
 
@@ -25,7 +25,7 @@ FactoryBot.define do
25
25
 
26
26
  # Return the new team
27
27
  it.attributes = team_hash.merge(captain: it.captain)
28
- }
28
+ end
29
29
 
30
30
  initialize_with do
31
31
  new(attributes)
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stbaldricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.4.0.alpha.1
4
+ version: 10.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.2
19
+ version: 5.2.4.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.2
26
+ version: 5.2.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: htmlentities
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -224,16 +224,16 @@ dependencies:
224
224
  name: rubocop
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - ">="
227
+ - - '='
228
228
  - !ruby/object:Gem::Version
229
- version: '0'
229
+ version: 0.82.0
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ">="
234
+ - - '='
235
235
  - !ruby/object:Gem::Version
236
- version: '0'
236
+ version: 0.82.0
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: rubocop-performance
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -552,9 +552,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
552
552
  version: '0'
553
553
  required_rubygems_version: !ruby/object:Gem::Requirement
554
554
  requirements:
555
- - - ">"
555
+ - - ">="
556
556
  - !ruby/object:Gem::Version
557
- version: 1.3.1
557
+ version: '0'
558
558
  requirements: []
559
559
  rubygems_version: 3.0.3
560
560
  signing_key:
@@ -562,98 +562,98 @@ specification_version: 4
562
562
  summary: St. Baldrick's Foundation Ruby Client Library
563
563
  test_files:
564
564
  - lib/stbaldricks_factories.rb
565
- - spec/factories/memorial.rb
566
- - spec/factories/kid_honor.rb
567
- - spec/factories/donor.rb
568
- - spec/factories/newsletter_recipient.rb
569
- - spec/factories/recurring_gift.rb
570
- - spec/factories/contact.rb
571
- - spec/factories/team.rb
572
- - spec/factories/donation/participant.rb
573
- - spec/factories/phone.rb
565
+ - spec/factories/collection.rb
566
+ - spec/factories/user.rb
567
+ - spec/factories/organization/addresses.rb
568
+ - spec/factories/organization/email_addresses.rb
569
+ - spec/factories/organization/phone_numbers.rb
570
+ - spec/factories/search_participant.rb
571
+ - spec/factories/location.rb
572
+ - spec/factories/email_address.rb
573
+ - spec/factories/grant_institution.rb
574
574
  - spec/factories/response.rb
575
+ - spec/factories/fundraising_page.rb
575
576
  - spec/factories/grant.rb
576
- - spec/factories/researcher.rb
577
- - spec/factories/payment.rb
578
- - spec/factories/collection.rb
579
- - spec/factories/fundraiser.rb
580
- - spec/factories/lib/helpers.rb
581
- - spec/factories/lib/faker_patch.rb
582
- - spec/factories/person/email_addresses.rb
583
- - spec/factories/person/phone_numbers.rb
577
+ - spec/factories/campaign.rb
578
+ - spec/factories/donor.rb
579
+ - spec/factories/kid_institution.rb
580
+ - spec/factories/shave_schedule.rb
581
+ - spec/factories/donation/participant.rb
584
582
  - spec/factories/person/addresses.rb
583
+ - spec/factories/person/email_addresses.rb
585
584
  - spec/factories/person/policies.rb
586
- - spec/factories/campaign.rb
585
+ - spec/factories/person/phone_numbers.rb
586
+ - spec/factories/photo.rb
587
+ - spec/factories/event_application.rb
588
+ - spec/factories/kid.rb
589
+ - spec/factories/event.rb
590
+ - spec/factories/donation.rb
591
+ - spec/factories/kid_honor.rb
592
+ - spec/factories/message.rb
593
+ - spec/factories/memorial/photos.rb
594
+ - spec/factories/memorial/tribute.rb
595
+ - spec/factories/memorial/totals.rb
596
+ - spec/factories/photos.rb
597
+ - spec/factories/kid/custom_institution.rb
598
+ - spec/factories/phone.rb
599
+ - spec/factories/campaign/totals.rb
587
600
  - spec/factories/page.rb
588
- - spec/factories/kid_institution.rb
601
+ - spec/factories/newsletter_recipient.rb
602
+ - spec/factories/memorial.rb
603
+ - spec/factories/institution.rb
589
604
  - spec/factories/participant.rb
590
- - spec/factories/donation.rb
591
- - spec/factories/event/venue/social.rb
592
- - spec/factories/event/venue/location.rb
605
+ - spec/factories/address.rb
606
+ - spec/factories/contact_group.rb
607
+ - spec/factories/venue.rb
608
+ - spec/factories/permissions.rb
609
+ - spec/factories/participant/rankings/ranking.rb
610
+ - spec/factories/participant/photos.rb
611
+ - spec/factories/participant/roles.rb
612
+ - spec/factories/participant/roles/role.rb
613
+ - spec/factories/participant/totals.rb
614
+ - spec/factories/participant/rankings.rb
615
+ - spec/factories/participant/policies.rb
616
+ - spec/factories/diagnosis.rb
617
+ - spec/factories/researcher.rb
618
+ - spec/factories/contact.rb
619
+ - spec/factories/organization.rb
620
+ - spec/factories/search_fundraiser.rb
621
+ - spec/factories/team.rb
622
+ - spec/factories/event_supporter.rb
623
+ - spec/factories/challenger.rb
624
+ - spec/factories/disease.rb
625
+ - spec/factories/third_party_media.rb
626
+ - spec/factories/search_kid.rb
627
+ - spec/factories/lib/faker_patch.rb
628
+ - spec/factories/lib/helpers.rb
629
+ - spec/factories/treatment_status.rb
630
+ - spec/factories/recurring_gift.rb
631
+ - spec/factories/name_pieces.rb
632
+ - spec/factories/shave_schedule/time_selection_permissions.rb
593
633
  - spec/factories/event/coach_tracking/coaching_interactions.rb
594
- - spec/factories/event/coach_tracking/plaque.rb
595
634
  - spec/factories/event/coach_tracking/proceeds.rb
596
- - spec/factories/event/venue.rb
635
+ - spec/factories/event/coach_tracking/plaque.rb
636
+ - spec/factories/event/contacts.rb
637
+ - spec/factories/event/photos.rb
597
638
  - spec/factories/event/contacts/contact.rb
598
639
  - spec/factories/event/contacts/name_pieces.rb
599
- - spec/factories/event/photos.rb
640
+ - spec/factories/event/venue.rb
600
641
  - spec/factories/event/coach_tracking.rb
601
- - spec/factories/event/contacts.rb
642
+ - spec/factories/event/venue/location.rb
643
+ - spec/factories/event/venue/social.rb
602
644
  - spec/factories/event/totals.rb
603
- - spec/factories/permissions.rb
604
- - spec/factories/location.rb
605
- - spec/factories/participant/rankings/ranking.rb
606
- - spec/factories/participant/rankings.rb
607
- - spec/factories/participant/photos.rb
608
- - spec/factories/participant/policies.rb
609
- - spec/factories/participant/roles/role.rb
610
- - spec/factories/participant/roles.rb
611
- - spec/factories/participant/totals.rb
612
- - spec/factories/event_application.rb
613
- - spec/factories/message.rb
614
- - spec/factories/user.rb
615
- - spec/factories/shave_schedule.rb
616
645
  - spec/factories/team/rankings/ranking.rb
617
- - spec/factories/team/rankings.rb
618
646
  - spec/factories/team/photos.rb
619
647
  - spec/factories/team/totals.rb
620
- - spec/factories/search_participant.rb
648
+ - spec/factories/team/rankings.rb
649
+ - spec/factories/fundraiser/photos.rb
650
+ - spec/factories/fundraiser/totals.rb
651
+ - spec/factories/fundraiser/policies.rb
621
652
  - spec/factories/search_event.rb
622
- - spec/factories/photo.rb
623
- - spec/factories/kid/custom_institution.rb
653
+ - spec/factories/person.rb
624
654
  - spec/factories/search_team.rb
655
+ - spec/factories/fundraiser.rb
625
656
  - spec/factories/error.rb
626
- - spec/factories/search_fundraiser.rb
627
- - spec/factories/campaign/totals.rb
628
- - spec/factories/name_pieces.rb
629
- - spec/factories/challenger.rb
630
- - spec/factories/memorial/tribute.rb
631
- - spec/factories/memorial/photos.rb
632
- - spec/factories/memorial/totals.rb
633
- - spec/factories/venue.rb
634
- - spec/factories/institution.rb
635
- - spec/factories/treatment_status.rb
636
- - spec/factories/photos.rb
637
- - spec/factories/fund.rb
638
- - spec/factories/search_kid.rb
639
- - spec/factories/person.rb
640
- - spec/factories/contact_group.rb
641
- - spec/factories/disease.rb
642
- - spec/factories/fundraising_page.rb
643
- - spec/factories/event_supporter.rb
644
- - spec/factories/event.rb
645
- - spec/factories/organization/email_addresses.rb
646
- - spec/factories/organization/phone_numbers.rb
647
- - spec/factories/organization/addresses.rb
648
- - spec/factories/address.rb
649
- - spec/factories/third_party_media.rb
650
- - spec/factories/kid.rb
651
- - spec/factories/shave_schedule/time_selection_permissions.rb
657
+ - spec/factories/payment.rb
652
658
  - spec/factories/challenge.rb
653
- - spec/factories/fundraiser/photos.rb
654
- - spec/factories/fundraiser/policies.rb
655
- - spec/factories/fundraiser/totals.rb
656
- - spec/factories/organization.rb
657
- - spec/factories/grant_institution.rb
658
- - spec/factories/email_address.rb
659
- - spec/factories/diagnosis.rb
659
+ - spec/factories/fund.rb