class ZombieBattleground::Api::Models::Match
Validator for Match
Attributes
@!attribute [r] block_height
the Match's block_height
@return [Integer]
@example
match.block_height #=> 497513
@api public
@!attribute [r] created_at
the Match's created_at
time
@return [Time]
@example
match.created_at #=> Time
@api public
@!attribute [r] id the Match's id
@return [Integer]
@example
match.id #=> 1
@api public
@!attribute [r] player1_accepted
the Match's player1_accepted
@return [Boolean]
@example
match.player1_accepted #=> true
@api public
@!attribute [r] player1_deck_id
the Match's player1_deck_id
@return [Integer]
@example
match.player1_deck_id #=> 1
@api public
@!attribute [r] player1_id
the Match's player1_id
@return [String]
@example
match.player1_id #=> "ZombieSlayer_16601"
@api public
@!attribute [r] player2_accepted
the Match's player2_accepted
@return [Boolean]
@example
match.player2_accepted #=> true
@api public
@!attribute [r] player2_deck_id
the Match's player2_deck_id
@return [Integer]
@example
match.player2_deck_id #=> 4
@api public
@!attribute [r] player2_id
the Match's player2_id
@return [String]
@example
match.player2_id #=> "ZombieSlayer_50758"
@api public
@!attribute [r] random_seed
the Match's random_seed
@return [Integer]
@example
match.random_seed #=> 1548242486
@api public
@!attribute [r] status the Match's status
@return [String]
@example
match.status #=> "Ended"
@api public
@!attribute [r] updated_at
the Match's updated_at
time
@return [Time]
@example
match.updated_at #=> Time
@api public
@!attribute [r] version the Match's version
@return [String]
@example
match.version #=> "v3"
@api public
Public Class Methods
Creates a new Match
@param match [Hash] Parsed JSON response
@return [ZombieBattleground::Api::Match]
@example
match = ZombieBattleground::Api::Match.new(parsed_json) # => ZombieBattleground::Api::Match
@api public
# 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