Class: ZombieBattleground::Api::Models::Match
- Inherits:
-
Object
- Object
- ZombieBattleground::Api::Models::Match
- Includes:
- ActiveModel::Validations, ValidationHelper
- Defined in:
- lib/zombie_battleground/api/models/match.rb
Overview
Validator for Match
Instance Attribute Summary collapse
-
#block_height ⇒ Integer
readonly
the Match’s block_height.
-
#created_at ⇒ Time
readonly
the Match’s created_at time.
-
#id ⇒ Integer
readonly
the Match’s id.
-
#player1_accepted ⇒ Boolean
readonly
the Match’s player1_accepted.
-
#player1_deck_id ⇒ Integer
readonly
the Match’s player1_deck_id.
-
#player1_id ⇒ String
readonly
the Match’s player1_id.
-
#player2_accepted ⇒ Boolean
readonly
the Match’s player2_accepted.
-
#player2_deck_id ⇒ Integer
readonly
the Match’s player2_deck_id.
-
#player2_id ⇒ String
readonly
the Match’s player2_id.
-
#random_seed ⇒ Integer
readonly
the Match’s random_seed.
-
#status ⇒ String
readonly
the Match’s status.
-
#updated_at ⇒ Time
readonly
the Match’s updated_at time.
-
#version ⇒ String
readonly
the Match’s version.
-
#winner_id ⇒ String
readonly
the Match’s winner_id.
Instance Method Summary collapse
-
#initialize(match) ⇒ ZombieBattleground::Api::Match
constructor
Creates a new Match.
Constructor Details
#initialize(match) ⇒ ZombieBattleground::Api::Match
Creates a new Match
211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/zombie_battleground/api/models/match.rb', line 211 def initialize(match) match.each do |key, value| next if value.nil? # this is an illegal response, match id 1 is bogus if %w[created_at updated_at].include?(key) instance_variable_set("@#{key}".to_sym, Time.parse(value)) else instance_variable_set("@#{key}".to_sym, value) end end end |
Instance Attribute Details
#block_height ⇒ Integer (readonly)
the Match’s block_height
182 183 184 |
# File 'lib/zombie_battleground/api/models/match.rb', line 182 def block_height @block_height end |
#created_at ⇒ Time (readonly)
the Match’s created_at time
38 39 40 |
# File 'lib/zombie_battleground/api/models/match.rb', line 38 def created_at @created_at end |
#id ⇒ Integer (readonly)
the Match’s id
26 27 28 |
# File 'lib/zombie_battleground/api/models/match.rb', line 26 def id @id end |
#player1_accepted ⇒ Boolean (readonly)
the Match’s player1_accepted
86 87 88 |
# File 'lib/zombie_battleground/api/models/match.rb', line 86 def player1_accepted @player1_accepted end |
#player1_deck_id ⇒ Integer (readonly)
the Match’s player1_deck_id
110 111 112 |
# File 'lib/zombie_battleground/api/models/match.rb', line 110 def player1_deck_id @player1_deck_id end |
#player1_id ⇒ String (readonly)
the Match’s player1_id
62 63 64 |
# File 'lib/zombie_battleground/api/models/match.rb', line 62 def player1_id @player1_id end |
#player2_accepted ⇒ Boolean (readonly)
the Match’s player2_accepted
98 99 100 |
# File 'lib/zombie_battleground/api/models/match.rb', line 98 def player2_accepted @player2_accepted end |
#player2_deck_id ⇒ Integer (readonly)
the Match’s player2_deck_id
122 123 124 |
# File 'lib/zombie_battleground/api/models/match.rb', line 122 def player2_deck_id @player2_deck_id end |
#player2_id ⇒ String (readonly)
the Match’s player2_id
74 75 76 |
# File 'lib/zombie_battleground/api/models/match.rb', line 74 def player2_id @player2_id end |
#random_seed ⇒ Integer (readonly)
the Match’s random_seed
158 159 160 |
# File 'lib/zombie_battleground/api/models/match.rb', line 158 def random_seed @random_seed end |
#status ⇒ String (readonly)
the Match’s status
134 135 136 |
# File 'lib/zombie_battleground/api/models/match.rb', line 134 def status @status end |
#updated_at ⇒ Time (readonly)
the Match’s updated_at time
50 51 52 |
# File 'lib/zombie_battleground/api/models/match.rb', line 50 def updated_at @updated_at end |
#version ⇒ String (readonly)
the Match’s version
146 147 148 |
# File 'lib/zombie_battleground/api/models/match.rb', line 146 def version @version end |
#winner_id ⇒ String (readonly)
the Match’s winner_id
170 171 172 |
# File 'lib/zombie_battleground/api/models/match.rb', line 170 def winner_id @winner_id end |