Class: ZombieBattleground::Api::Models::Deck
- Inherits:
-
Object
- Object
- ZombieBattleground::Api::Models::Deck
- Includes:
- ActiveModel::Validations, ValidationHelper
- Defined in:
- lib/zombie_battleground/api/models/deck.rb
Overview
Validator for Deck
Instance Attribute Summary collapse
-
#block_height ⇒ Integer
readonly
the Deck’s block_height.
-
#cards ⇒ Array<ZombieBattleground::Api::Models::SimpleCard>
readonly
the Deck’s cards.
-
#created_at ⇒ Time
readonly
the Deck’s created_at time.
-
#deck_id ⇒ Integer
readonly
the Deck’s deck_id.
-
#hero_id ⇒ Integer
readonly
the Deck’s hero_id.
-
#id ⇒ Integer
readonly
Deck’s id.
-
#is_deleted ⇒ Boolean
readonly
the Deck’s is_deleted.
-
#name ⇒ String
readonly
the Deck’s name.
-
#primary_skill_id ⇒ Integer
readonly
the Deck’s primary_skill_id.
-
#secondary_skill_id ⇒ Integer
readonly
the Deck’s secondary_skill_id.
-
#sender_address ⇒ String
readonly
the Deck’s sender_address.
-
#updated_at ⇒ Time
readonly
the Deck’s updated_at time.
-
#user_id ⇒ String
readonly
the Deck’s user_id.
-
#version ⇒ String
readonly
the Deck’s version.
Instance Method Summary collapse
-
#initialize(deck) ⇒ ZombieBattleground::Api::Deck
constructor
Creates a new Deck.
Constructor Details
#initialize(deck) ⇒ ZombieBattleground::Api::Deck
Creates a new Deck
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 213 def initialize(deck) deck.each do |key, value| next if value.nil? # this is an illegal response, deck id 1 is bogus if key == 'cards' instance_variable_set( "@#{key}".to_sym, value.map { |card| ZombieBattleground::Api::Models::SimpleCard.new(card) } ) elsif %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 Deck’s block_height
172 173 174 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 172 def block_height @block_height end |
#cards ⇒ Array<ZombieBattleground::Api::Models::SimpleCard> (readonly)
the Deck’s cards
112 113 114 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 112 def cards @cards end |
#created_at ⇒ Time (readonly)
the Deck’s created_at time
40 41 42 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 40 def created_at @created_at end |
#deck_id ⇒ Integer (readonly)
the Deck’s deck_id
76 77 78 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 76 def deck_id @deck_id end |
#hero_id ⇒ Integer (readonly)
the Deck’s hero_id
100 101 102 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 100 def hero_id @hero_id end |
#id ⇒ Integer (readonly)
Deck’s id
28 29 30 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 28 def id @id end |
#is_deleted ⇒ Boolean (readonly)
the Deck’s is_deleted
184 185 186 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 184 def is_deleted @is_deleted end |
#name ⇒ String (readonly)
the Deck’s name
88 89 90 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 88 def name @name end |
#primary_skill_id ⇒ Integer (readonly)
the Deck’s primary_skill_id
124 125 126 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 124 def primary_skill_id @primary_skill_id end |
#secondary_skill_id ⇒ Integer (readonly)
the Deck’s secondary_skill_id
136 137 138 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 136 def secondary_skill_id @secondary_skill_id end |
#sender_address ⇒ String (readonly)
the Deck’s sender_address
160 161 162 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 160 def sender_address @sender_address end |
#updated_at ⇒ Time (readonly)
the Deck’s updated_at time
52 53 54 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 52 def updated_at @updated_at end |
#user_id ⇒ String (readonly)
the Deck’s user_id
64 65 66 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 64 def user_id @user_id end |
#version ⇒ String (readonly)
the Deck’s version
148 149 150 |
# File 'lib/zombie_battleground/api/models/deck.rb', line 148 def version @version end |