Class: Arkaan::Campaigns::Invitation
- Inherits:
-
Object
- Object
- Arkaan::Campaigns::Invitation
- Includes:
- Arkaan::Concerns::Enumerable, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/arkaan/campaigns/invitation.rb
Overview
An invitation is the linked between a player and a campaign, accepted or not.
Instance Attribute Summary collapse
-
#account ⇒ Arkaan::Account
The account the invitation has been issued to.
-
#campaign ⇒ Arkaan::Campaign
The campaign the invitation has been made in.
-
#characters ⇒ Array<Arkaan::Campaigns::Character>
The character sheets for this player.
-
#files ⇒ Array<Arkaan::Campaigns::Files::Document>
The files uploaded in this campaign by the user linked to this invitation.
-
#status ⇒ Symbol
The current status of the invitation.
Instance Method Summary collapse
-
#character ⇒ Arkaan::Campaigns::Files::Character
Gets the currently selected character in a convenient way.
- #documents ⇒ Object
- #has_file?(filename) ⇒ Boolean
Instance Attribute Details
#account ⇒ Arkaan::Account
Returns the account the invitation has been issued to.
16 |
# File 'lib/arkaan/campaigns/invitation.rb', line 16 belongs_to :account, class_name: 'Arkaan::Account', inverse_of: :invitations |
#campaign ⇒ Arkaan::Campaign
Returns the campaign the invitation has been made in.
19 |
# File 'lib/arkaan/campaigns/invitation.rb', line 19 belongs_to :campaign, class_name: 'Arkaan::Campaign', inverse_of: :invitations |
#characters ⇒ Array<Arkaan::Campaigns::Character>
Returns the character sheets for this player.
26 |
# File 'lib/arkaan/campaigns/invitation.rb', line 26 has_many :characters, class_name: 'Arkaan::Campaigns::Character', inverse_of: :invitation |
#files ⇒ Array<Arkaan::Campaigns::Files::Document>
Returns the files uploaded in this campaign by the user linked to this invitation.
23 |
# File 'lib/arkaan/campaigns/invitation.rb', line 23 has_many :permissions, class_name: 'Arkaan::Campaigns::Files::Permission', inverse_of: :invitation |
#status ⇒ Symbol
Returns the current status of the invitation.
12 |
# File 'lib/arkaan/campaigns/invitation.rb', line 12 enum_field :status, [:accepted, :blocked, :expelled, :ignored, :left, :pending, :refused, :request, :creator], default: :pending |
Instance Method Details
#character ⇒ Arkaan::Campaigns::Files::Character
Gets the currently selected character in a convenient way.
30 31 32 |
# File 'lib/arkaan/campaigns/invitation.rb', line 30 def character characters.where(selected: true).first end |
#documents ⇒ Object
34 35 36 |
# File 'lib/arkaan/campaigns/invitation.rb', line 34 def documents .map(&:document) end |
#has_file?(filename) ⇒ Boolean
38 39 40 41 42 |
# File 'lib/arkaan/campaigns/invitation.rb', line 38 def has_file?(filename) return .map(&:document).map(&:name).any? do |name| name == filename end end |