Module: EffectiveMembershipsCategory

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/effective_memberships_category.rb

Overview

EffectiveMembershipsCategory

Mark your category model with effective_memberships_category to get all the includes

Defined Under Namespace

Modules: Base, ClassMethods

Instance Method Summary collapse

Instance Method Details

#applicant_fee_qb_item_nameObject



240
241
242
# File 'app/models/concerns/effective_memberships_category.rb', line 240

def applicant_fee_qb_item_name
  'Applicant'
end

#applicant_fee_tax_exemptObject



244
245
246
# File 'app/models/concerns/effective_memberships_category.rb', line 244

def applicant_fee_tax_exempt
  tax_exempt
end

#applicant_reinstatement_wizard_stepsObject

Apply for Reinstatement



210
211
212
# File 'app/models/concerns/effective_memberships_category.rb', line 210

def applicant_reinstatement_wizard_steps
  [:reinstatement]
end

#applicant_review_wizard_stepsObject



218
219
220
# File 'app/models/concerns/effective_memberships_category.rb', line 218

def applicant_review_wizard_steps
  (Array(self[:applicant_review_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#applicant_wizard_stepsObject

Apply to Join or Apply to Reclassify



205
206
207
# File 'app/models/concerns/effective_memberships_category.rb', line 205

def applicant_wizard_steps
  (Array(self[:applicant_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#applicant_wizard_steps_collectionObject



222
223
224
225
226
227
228
229
# File 'app/models/concerns/effective_memberships_category.rb', line 222

def applicant_wizard_steps_collection
  wizard_steps = EffectiveMemberships.Applicant.wizard_steps_hash
  required_steps = EffectiveMemberships.Applicant.required_wizard_steps

  wizard_steps.map do |step, title|
    [title, step, 'disabled' => required_steps.include?(step)]
  end
end

#can_apply?Boolean

Returns:

  • (Boolean)


164
165
166
# File 'app/models/concerns/effective_memberships_category.rb', line 164

def can_apply?
  can_apply_new? || can_apply_existing? || can_apply_restricted?
end

#can_apply_restricted_idsObject



188
189
190
# File 'app/models/concerns/effective_memberships_category.rb', line 188

def can_apply_restricted_ids
  Array(self[:can_apply_restricted_ids]) - [nil, '']
end

#discount_fee(date:) ⇒ Object



184
185
186
# File 'app/models/concerns/effective_memberships_category.rb', line 184

def discount_fee(date:)
  0 - prorated_fee(date: date)
end

#fee_payment_wizard_stepsObject



214
215
216
# File 'app/models/concerns/effective_memberships_category.rb', line 214

def fee_payment_wizard_steps
  (Array(self[:fee_payment_wizard_steps]) - [nil, '']).map(&:to_sym)
end

#fee_payment_wizard_steps_collectionObject



231
232
233
234
235
236
237
238
# File 'app/models/concerns/effective_memberships_category.rb', line 231

def fee_payment_wizard_steps_collection
  wizard_steps = EffectiveMemberships.FeePayment.wizard_steps_hash
  required_steps = EffectiveMemberships.FeePayment.required_wizard_steps

  wizard_steps.map do |step, title|
    [title, step, 'disabled' => required_steps.include?(step)]
  end
end

#individual?Boolean

Returns:

  • (Boolean)


168
169
170
# File 'app/models/concerns/effective_memberships_category.rb', line 168

def individual?
  category_type == 'Individual'
end

#membership_directory_titleObject



160
161
162
# File 'app/models/concerns/effective_memberships_category.rb', line 160

def membership_directory_title
  to_s
end

#membership_number_required?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'app/models/concerns/effective_memberships_category.rb', line 176

def membership_number_required?
  true
end

#optional_applicant_review_wizard_stepsObject



200
201
202
# File 'app/models/concerns/effective_memberships_category.rb', line 200

def optional_applicant_review_wizard_steps
  applicant_review_wizard_steps - EffectiveMemberships.ApplicantReview.required_wizard_steps
end

#optional_applicant_wizard_stepsObject



192
193
194
# File 'app/models/concerns/effective_memberships_category.rb', line 192

def optional_applicant_wizard_steps
  applicant_wizard_steps - EffectiveMemberships.Applicant.required_wizard_steps
end

#optional_fee_payment_wizard_stepsObject



196
197
198
# File 'app/models/concerns/effective_memberships_category.rb', line 196

def optional_fee_payment_wizard_steps
  fee_payment_wizard_steps - EffectiveMemberships.FeePayment.required_wizard_steps
end

#organization?Boolean

Returns:

  • (Boolean)


172
173
174
# File 'app/models/concerns/effective_memberships_category.rb', line 172

def organization?
  category_type == 'Organization'
end

#prorated_fee(date:) ⇒ Object



180
181
182
# File 'app/models/concerns/effective_memberships_category.rb', line 180

def prorated_fee(date:)
  send("prorated_#{date.strftime('%b').downcase}").to_i
end

#stamp_feeObject



248
249
250
# File 'app/models/concerns/effective_memberships_category.rb', line 248

def stamp_fee
  0
end

#stamp_fee_qb_item_nameObject



252
253
254
# File 'app/models/concerns/effective_memberships_category.rb', line 252

def stamp_fee_qb_item_name
  qb_item_name
end

#stamp_fee_tax_exemptObject



256
257
258
# File 'app/models/concerns/effective_memberships_category.rb', line 256

def stamp_fee_tax_exempt
  tax_exempt
end

#to_sObject

Instance Methods



156
157
158
# File 'app/models/concerns/effective_memberships_category.rb', line 156

def to_s
  title.presence || 'New Membership Category'
end