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



224
225
226
# File 'app/models/concerns/effective_memberships_category.rb', line 224

def applicant_fee_qb_item_name
  'Applicant'
end

#applicant_fee_tax_exemptObject



228
229
230
# File 'app/models/concerns/effective_memberships_category.rb', line 228

def applicant_fee_tax_exempt
  tax_exempt
end

#applicant_review_wizard_stepsObject



202
203
204
# File 'app/models/concerns/effective_memberships_category.rb', line 202

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

#applicant_wizard_stepsObject



194
195
196
# File 'app/models/concerns/effective_memberships_category.rb', line 194

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

#applicant_wizard_steps_collectionObject



206
207
208
209
210
211
212
213
# File 'app/models/concerns/effective_memberships_category.rb', line 206

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)


158
159
160
# File 'app/models/concerns/effective_memberships_category.rb', line 158

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

#can_apply_restricted_idsObject



178
179
180
# File 'app/models/concerns/effective_memberships_category.rb', line 178

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

#discount_fee(date:) ⇒ Object



174
175
176
# File 'app/models/concerns/effective_memberships_category.rb', line 174

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

#fee_payment_wizard_stepsObject



198
199
200
# File 'app/models/concerns/effective_memberships_category.rb', line 198

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

#fee_payment_wizard_steps_collectionObject



215
216
217
218
219
220
221
222
# File 'app/models/concerns/effective_memberships_category.rb', line 215

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)


162
163
164
# File 'app/models/concerns/effective_memberships_category.rb', line 162

def individual?
  category_type == 'Individual'
end

#optional_applicant_review_wizard_stepsObject



190
191
192
# File 'app/models/concerns/effective_memberships_category.rb', line 190

def optional_applicant_review_wizard_steps
  applicant_review_wizard_steps - EffectiveMemberships.ApplicantReview.required_wizard_steps
end

#optional_applicant_wizard_stepsObject



182
183
184
# File 'app/models/concerns/effective_memberships_category.rb', line 182

def optional_applicant_wizard_steps
  applicant_wizard_steps - EffectiveMemberships.Applicant.required_wizard_steps
end

#optional_fee_payment_wizard_stepsObject



186
187
188
# File 'app/models/concerns/effective_memberships_category.rb', line 186

def optional_fee_payment_wizard_steps
  fee_payment_wizard_steps - EffectiveMemberships.FeePayment.required_wizard_steps
end

#organization?Boolean

Returns:

  • (Boolean)


166
167
168
# File 'app/models/concerns/effective_memberships_category.rb', line 166

def organization?
  category_type == 'Organization'
end

#prorated_fee(date:) ⇒ Object



170
171
172
# File 'app/models/concerns/effective_memberships_category.rb', line 170

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

#stamp_feeObject



232
233
234
# File 'app/models/concerns/effective_memberships_category.rb', line 232

def stamp_fee
  0
end

#stamp_fee_qb_item_nameObject



236
237
238
# File 'app/models/concerns/effective_memberships_category.rb', line 236

def stamp_fee_qb_item_name
  qb_item_name
end

#stamp_fee_tax_exemptObject



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

def stamp_fee_tax_exempt
  tax_exempt
end

#to_sObject

Instance Methods



154
155
156
# File 'app/models/concerns/effective_memberships_category.rb', line 154

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