Class: MembershipKit

Inherits:
Kit
  • Object
show all
Includes:
ActionView::Helpers::SanitizeHelper
Defined in:
app/models/kits/membership_kit.rb

Constant Summary collapse

ACCESSORS =
[ :marketing_copy_heading, :marketing_copy_sidebar, :limit_per_transaction ]

Instance Method Summary collapse

Methods inherited from Kit

#abilities, #activatable?, activate, activation_requirements, acts_as_kit, #admin_approvable?, admin_approval_requirements, admin_approve, #alternatives, #approvable?, approval_requirements, approve, #has_alternatives?, mailchimp, pad_with_new_kits, #requirements_met?, subklasses, visible, when_active

Methods included from Ext::Integrations::Kit

#record_activation, #record_approval

Instance Method Details

#configured!Object



46
47
48
49
# File 'app/models/kits/membership_kit.rb', line 46

def configured!
  settings[:membership_state] = "configured"
  save
end

#configured?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/models/kits/membership_kit.rb', line 42

def configured?
  membership_state == "configured"
end

#friendly_nameObject



29
30
31
# File 'app/models/kits/membership_kit.rb', line 29

def friendly_name
  "Membership"
end

#initialize_accessorsObject



51
52
53
54
55
# File 'app/models/kits/membership_kit.rb', line 51

def initialize_accessors
  ACCESSORS.each do |accessor|
    self.send("#{accessor}=", "") if self.send("#{accessor}").nil?
  end  
end

#no_bank_account?Boolean

Returns:

  • (Boolean)


33
34
35
36
# File 'app/models/kits/membership_kit.rb', line 33

def no_bank_account?
  errors.add(:requirements, "Your organization needs bank account information first.") if organization..nil?
  organization..nil?
end

#pitchObject



38
39
40
# File 'app/models/kits/membership_kit.rb', line 38

def pitch
  "Sell Memberships!"
end

#sanitize_accessorsObject



57
58
59
60
61
# File 'app/models/kits/membership_kit.rb', line 57

def sanitize_accessors
  ACCESSORS.each do |accessor|
    self.send("#{accessor}=", (sanitize self.send(accessor)))
  end
end