Class: Effective::RegistrarAction
- Inherits:
-
Object
- Object
- Effective::RegistrarAction
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/effective/registrar_action.rb
Instance Attribute Summary collapse
-
#bad_standing_reason ⇒ Object
Bad Standing.
-
#category_id ⇒ Object
Reclassify & Register.
-
#category_ids ⇒ Object
Assign.
-
#current_action ⇒ Object
Returns the value of attribute current_action.
-
#current_user ⇒ Object
All Actions.
-
#membership_number ⇒ Object
Returns the value of attribute membership_number.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#owner_id ⇒ Object
Returns the value of attribute owner_id.
-
#owner_type ⇒ Object
Returns the value of attribute owner_type.
-
#skip_fees ⇒ Object
Returns the value of attribute skip_fees.
Instance Method Summary collapse
- #assign! ⇒ Object
- #bad_standing! ⇒ Object
- #fees_paid! ⇒ Object
- #good_standing! ⇒ Object
- #reclassify! ⇒ Object
- #register! ⇒ Object
- #remove! ⇒ Object
- #save! ⇒ Object
- #to_s ⇒ Object
- #update!(atts) ⇒ Object
Instance Attribute Details
#bad_standing_reason ⇒ Object
Bad Standing
13 14 15 |
# File 'app/models/effective/registrar_action.rb', line 13 def bad_standing_reason @bad_standing_reason end |
#category_id ⇒ Object
Reclassify & Register
16 17 18 |
# File 'app/models/effective/registrar_action.rb', line 16 def category_id @category_id end |
#category_ids ⇒ Object
Assign
21 22 23 |
# File 'app/models/effective/registrar_action.rb', line 21 def category_ids @category_ids end |
#current_action ⇒ Object
Returns the value of attribute current_action.
9 10 11 |
# File 'app/models/effective/registrar_action.rb', line 9 def current_action @current_action end |
#current_user ⇒ Object
All Actions
8 9 10 |
# File 'app/models/effective/registrar_action.rb', line 8 def current_user @current_user end |
#membership_number ⇒ Object
Returns the value of attribute membership_number.
17 18 19 |
# File 'app/models/effective/registrar_action.rb', line 17 def membership_number @membership_number end |
#owner ⇒ Object
Returns the value of attribute owner.
10 11 12 |
# File 'app/models/effective/registrar_action.rb', line 10 def owner @owner end |
#owner_id ⇒ Object
Returns the value of attribute owner_id.
10 11 12 |
# File 'app/models/effective/registrar_action.rb', line 10 def owner_id @owner_id end |
#owner_type ⇒ Object
Returns the value of attribute owner_type.
10 11 12 |
# File 'app/models/effective/registrar_action.rb', line 10 def owner_type @owner_type end |
#skip_fees ⇒ Object
Returns the value of attribute skip_fees.
18 19 20 |
# File 'app/models/effective/registrar_action.rb', line 18 def skip_fees @skip_fees end |
Instance Method Details
#assign! ⇒ Object
51 52 53 54 |
# File 'app/models/effective/registrar_action.rb', line 51 def assign! update!(current_action: :assign) EffectiveMemberships.Registrar.assign!(owner, categories: categories, number: membership_number.presence) end |
#bad_standing! ⇒ Object
61 62 63 64 |
# File 'app/models/effective/registrar_action.rb', line 61 def bad_standing! update!(current_action: :bad_standing) EffectiveMemberships.Registrar.bad_standing!(owner, reason: bad_standing_reason) end |
#fees_paid! ⇒ Object
66 67 68 69 |
# File 'app/models/effective/registrar_action.rb', line 66 def fees_paid! update!(current_action: :fees_paid) EffectiveMemberships.Registrar.fees_paid!(owner) end |
#good_standing! ⇒ Object
56 57 58 59 |
# File 'app/models/effective/registrar_action.rb', line 56 def good_standing! update!(current_action: :good_standing) EffectiveMemberships.Registrar.good_standing!(owner) end |
#reclassify! ⇒ Object
46 47 48 49 |
# File 'app/models/effective/registrar_action.rb', line 46 def reclassify! update!(current_action: :reclassify) EffectiveMemberships.Registrar.reclassify!(owner, to: category, skip_fees: skip_fees?) end |
#register! ⇒ Object
41 42 43 44 |
# File 'app/models/effective/registrar_action.rb', line 41 def register! update!(current_action: :register) EffectiveMemberships.Registrar.register!(owner, to: category, number: membership_number.presence, skip_fees: skip_fees?) end |
#remove! ⇒ Object
71 72 73 74 |
# File 'app/models/effective/registrar_action.rb', line 71 def remove! update!(current_action: :remove) EffectiveMemberships.Registrar.remove!(owner) end |
#save! ⇒ Object
80 81 82 |
# File 'app/models/effective/registrar_action.rb', line 80 def save! valid? ? true : raise('invalid') end |
#to_s ⇒ Object
37 38 39 |
# File 'app/models/effective/registrar_action.rb', line 37 def to_s 'action' end |
#update!(atts) ⇒ Object
76 77 78 |
# File 'app/models/effective/registrar_action.rb', line 76 def update!(atts) assign_attributes(atts); save! end |