Class: Challonge::Participant
- Defined in:
- lib/challonge/participant.rb
Overview
the only attributes that will save are: name, seed, challonge_username, email, misc
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Participant
constructor
A new instance of Participant.
- #randomize! ⇒ Object
- #tournament ⇒ Object
- #tournament=(tournament) ⇒ Object
Methods inherited from API
key, key=, username, username=
Constructor Details
#initialize(attributes = {}) ⇒ Participant
Returns a new instance of Participant.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/challonge/participant.rb', line 6 def initialize(attributes = {}) @attributes = {} @prefix_options = {} # allow new and create to be passed a tournament or tournament_id real_attributes = attributes.slice!(:tournament, :tournament_id, "tournament", "tournament_id") load(real_attributes) attributes.each_pair do |attr, val| self.send("#{attr}=", val) end end |
Instance Method Details
#randomize! ⇒ Object
26 27 28 |
# File 'lib/challonge/participant.rb', line 26 def randomize! validated_post(:randomize) end |
#tournament ⇒ Object
18 19 20 |
# File 'lib/challonge/participant.rb', line 18 def tournament Challonge::Tournament.find(self.[:tournament_id]) end |
#tournament=(tournament) ⇒ Object
22 23 24 |
# File 'lib/challonge/participant.rb', line 22 def tournament=(tournament) self.[:tournament_id] = tournament.id end |