Class: Spree::Invitation

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/invitation.rb

Instance Method Summary collapse

Instance Method Details

#expired?Boolean

returns true if the invitation has expired

Returns:

  • (Boolean)


75
76
77
# File 'app/models/spree/invitation.rb', line 75

def expired?
  expires_at < Time.current
end

#resend!Object

Resends the invitation email if the invitation is pending and not expired



80
81
82
83
84
# File 'app/models/spree/invitation.rb', line 80

def resend!
  return if expired? || deleted? || accepted?

  send_invitation_email
end

#storeSpree::Store

returns the store for the invitation if the resource is a store, return the resource if the resource responds to store, return the store otherwise, return the current store

Returns:



63
64
65
66
67
68
69
70
71
# File 'app/models/spree/invitation.rb', line 63

def store
  if resource.is_a?(Spree::Store)
    resource
  elsif resource.respond_to?(:store)
    resource.store
  else
    Spree::Store.current
  end
end