stbaldricks 10.4.0 → 10.5.0

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: 254d423d0fdb844756ed3264289692ee19597cd8078730932018162ac051da55
4
- data.tar.gz: 5900aa212949f0beef94aff67c920d8c6cb5b7c43f0cfd52231fd3c2f8149319
3
+ metadata.gz: 40ee415e8e0dd5d54923a9448415b0e80072dabb72c0bc77d28629e4838f44c7
4
+ data.tar.gz: dd69753ce37eb835761bfa9b33609f0c50e47dfdc2c337154a8c6fb95c7d95af
5
5
  SHA512:
6
- metadata.gz: bf845b62302243cddfe7638ad68aa13a40efa53a841df9f5d920d99ef97263ee35d7c02acf171d6ec73559aba0231aa11fe7200de700ab76a9d2aebf55d8aa0b
7
- data.tar.gz: 72b7d87bce689e881877c5ff267dabde7eb1297013da2a94a8168443a3d49ca1dc2d972f6b9bb5d834c37a9a20cad1ff35054d487b91600695f5b9e542ade36f
6
+ metadata.gz: fdfbfc41d0ac85668274164d0a6d2dd7320ce21225aa097754630f1c6c2d1f05c169f0c6e3dda5d33cadac5fbe5fd91baf23ae814e481ddb57f954235aa4316d
7
+ data.tar.gz: b820f25373c8195c610f67bf121086357eadae39f4d14b38548555971ddf42ce923b02b1d539c1d8ffa8093f61fa961aef993d815d5030a76f709e075f82ae69
@@ -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
@@ -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
@@ -42,12 +42,23 @@ module SBF
42
42
  SCHICK = 'schick'
43
43
  BATTLE = 'battle'
44
44
  BLANK4 = 'blank4'
45
- BLANK5 = 'blank5'
45
+ QREVENTPRINTOUT = 'qreventprintout'
46
46
  BLANK6 = 'blank6'
47
47
  APPEAL = 'appeal'
48
- BLANK8 = 'blank8'
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, APPEAL, BLANK8, BLANK9, BLANK10]
69
+ SCHICK, BATTLE, BLANK4, QREVENTPRINTOUT, BLANK6, 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
@@ -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 }
@@ -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'
3
+ VERSION = '10.5.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)
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stbaldricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.4.0
4
+ version: 10.5.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-04-03 00:00:00.000000000 Z
11
+ date: 2020-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -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
@@ -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/collection.rb
566
- - spec/factories/user.rb
567
565
  - spec/factories/organization/addresses.rb
568
566
  - spec/factories/organization/email_addresses.rb
569
567
  - 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
- - spec/factories/response.rb
568
+ - spec/factories/payment.rb
575
569
  - spec/factories/fundraising_page.rb
576
- - spec/factories/grant.rb
577
- - spec/factories/campaign.rb
578
- - spec/factories/donor.rb
579
- - spec/factories/kid_institution.rb
580
- - spec/factories/shave_schedule.rb
581
570
  - spec/factories/donation/participant.rb
571
+ - spec/factories/challenge.rb
572
+ - 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
580
+ - spec/factories/challenger.rb
581
+ - spec/factories/name_pieces.rb
582
+ - spec/factories/person/policies.rb
582
583
  - spec/factories/person/addresses.rb
583
584
  - spec/factories/person/email_addresses.rb
584
- - spec/factories/person/policies.rb
585
585
  - spec/factories/person/phone_numbers.rb
586
+ - spec/factories/participant/policies.rb
587
+ - spec/factories/participant/totals.rb
588
+ - spec/factories/participant/photos.rb
589
+ - spec/factories/participant/roles/role.rb
590
+ - spec/factories/participant/rankings/ranking.rb
591
+ - spec/factories/participant/rankings.rb
592
+ - 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
586
597
  - spec/factories/photo.rb
587
- - spec/factories/event_application.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
588
605
  - 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
606
+ - spec/factories/search_participant.rb
607
+ - spec/factories/event_supporter.rb
600
608
  - spec/factories/page.rb
601
- - spec/factories/newsletter_recipient.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
602
615
  - spec/factories/memorial.rb
603
- - spec/factories/institution.rb
604
- - spec/factories/participant.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
616
  - spec/factories/diagnosis.rb
617
- - spec/factories/researcher.rb
618
- - spec/factories/contact.rb
617
+ - spec/factories/team/totals.rb
618
+ - spec/factories/team/photos.rb
619
+ - spec/factories/team/rankings/ranking.rb
620
+ - spec/factories/team/rankings.rb
621
+ - spec/factories/newsletter_recipient.rb
622
+ - spec/factories/shave_schedule.rb
619
623
  - 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
624
+ - spec/factories/campaign/totals.rb
628
625
  - spec/factories/lib/helpers.rb
629
- - spec/factories/treatment_status.rb
626
+ - spec/factories/lib/faker_patch.rb
627
+ - spec/factories/error.rb
628
+ - spec/factories/donor.rb
629
+ - spec/factories/contact_group.rb
630
630
  - spec/factories/recurring_gift.rb
631
- - spec/factories/name_pieces.rb
632
- - spec/factories/shave_schedule/time_selection_permissions.rb
633
- - spec/factories/event/coach_tracking/coaching_interactions.rb
634
- - spec/factories/event/coach_tracking/proceeds.rb
635
- - spec/factories/event/coach_tracking/plaque.rb
636
- - spec/factories/event/contacts.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
636
+ - spec/factories/venue.rb
637
+ - 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
637
643
  - spec/factories/event/photos.rb
638
644
  - spec/factories/event/contacts/contact.rb
639
645
  - spec/factories/event/contacts/name_pieces.rb
640
- - spec/factories/event/venue.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
641
649
  - spec/factories/event/coach_tracking.rb
642
650
  - spec/factories/event/venue/location.rb
643
651
  - spec/factories/event/venue/social.rb
644
- - spec/factories/event/totals.rb
645
- - spec/factories/team/rankings/ranking.rb
646
- - spec/factories/team/photos.rb
647
- - spec/factories/team/totals.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
652
- - spec/factories/search_event.rb
653
- - spec/factories/person.rb
654
- - spec/factories/search_team.rb
655
- - spec/factories/fundraiser.rb
656
- - spec/factories/error.rb
657
- - spec/factories/payment.rb
658
- - spec/factories/challenge.rb
652
+ - spec/factories/event/contacts.rb
653
+ - spec/factories/event/venue.rb
659
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