Class: ZombieBattleground::Api::Models::Card

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, ValidationHelper
Defined in:
lib/zombie_battleground/api/models/card.rb

Overview

Validator for Card

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card) ⇒ ZombieBattleground::Api::Card

Creates a new Card

Examples:

card = ZombieBattleground::Api::Card.new(parsed_json)
# => ZombieBattleground::Api::Card

Parameters:

  • card (Hash)

    Parsed JSON response



276
277
278
279
280
281
282
# File 'lib/zombie_battleground/api/models/card.rb', line 276

def initialize(card)
  card.each do |key, value|
    next if value.nil? # this is an illegal response, card id 1 is bogus

    instance_variable_set("@#{key}".to_sym, value)
  end
end

Instance Attribute Details

#abilityString (readonly)

the Cards’s ability

Examples:

card.ability #=> ""

Returns:

  • (String)


220
221
222
# File 'lib/zombie_battleground/api/models/card.rb', line 220

def ability
  @ability
end

#block_heightInteger (readonly)

the Cards’s block_height

Examples:

card.block_height #=> 0

Returns:

  • (Integer)


232
233
234
# File 'lib/zombie_battleground/api/models/card.rb', line 232

def block_height
  @block_height
end

#costInteger (readonly)

the Cards’s cost

Examples:

card.cost #=> 1

Returns:

  • (Integer)


208
209
210
# File 'lib/zombie_battleground/api/models/card.rb', line 208

def cost
  @cost
end

#damageInteger (readonly)

the Cards’s damage

Examples:

card.damage #=> 1

Returns:

  • (Integer)


184
185
186
# File 'lib/zombie_battleground/api/models/card.rb', line 184

def damage
  @damage
end

#descriptionString (readonly)

the Cards’s description

Examples:

card.description #=> "<b>Attack:</b> +1 damage to Water zombies"

Returns:

  • (String)


100
101
102
# File 'lib/zombie_battleground/api/models/card.rb', line 100

def description
  @description
end

#flavor_textString (readonly)

the Cards’s flavor_text

Examples:

card.flavor_text #=> "The unfriendly ghost..."

Returns:

  • (String)


112
113
114
# File 'lib/zombie_battleground/api/models/card.rb', line 112

def flavor_text
  @flavor_text
end

#frameString (readonly)

the Cards’s frame

Examples:

card.frame #=> ""

Returns:

  • (String)


172
173
174
# File 'lib/zombie_battleground/api/models/card.rb', line 172

def frame
  @frame
end

#healthInteger (readonly)

the Cards’s health

Examples:

card.health #=> 1

Returns:

  • (Integer)


196
197
198
# File 'lib/zombie_battleground/api/models/card.rb', line 196

def health
  @health
end

#idInteger (readonly)

the Cards’s id

Examples:

card.id #=> 1

Returns:

  • (Integer)


28
29
30
# File 'lib/zombie_battleground/api/models/card.rb', line 28

def id
  @id
end

#image_urlString (readonly)

the Cards’s image_url

Examples:

card.image_url #=> "https://loom.games/img/cards/001.png"

Returns:

  • (String)


244
245
246
# File 'lib/zombie_battleground/api/models/card.rb', line 244

def image_url
  @image_url
end

#kindString (readonly)

the Cards’s kind

Examples:

card.kind #=> "CREATURE"

Returns:

  • (String)


64
65
66
# File 'lib/zombie_battleground/api/models/card.rb', line 64

def kind
  @kind
end

#mould_idString (readonly)

the Cards’s mould_id

Examples:

card.mould_id #=> "1"

Returns:

  • (String)


40
41
42
# File 'lib/zombie_battleground/api/models/card.rb', line 40

def mould_id
  @mould_id
end

#nameString (readonly)

the Cards’s name

Examples:

card.name #=> "Whizpar"

Returns:

  • (String)


88
89
90
# File 'lib/zombie_battleground/api/models/card.rb', line 88

def name
  @name
end

#pictureString (readonly)

the Cards’s picture

Examples:

card.picture #=> "Whizpar"

Returns:

  • (String)


124
125
126
# File 'lib/zombie_battleground/api/models/card.rb', line 124

def picture
  @picture
end

#rankString (readonly)

the Cards’s rank

Examples:

card.rank #=> "MINION"

Returns:

  • (String)


136
137
138
# File 'lib/zombie_battleground/api/models/card.rb', line 136

def rank
  @rank
end

#rarityString (readonly)

the Cards’s rarity

Examples:

card.rarity #=> ""

Returns:

  • (String)


160
161
162
# File 'lib/zombie_battleground/api/models/card.rb', line 160

def rarity
  @rarity
end

#setString (readonly)

the Cards’s set

Examples:

card.set #=> "AIR"

Returns:

  • (String)


76
77
78
# File 'lib/zombie_battleground/api/models/card.rb', line 76

def set
  @set
end

#typeString (readonly)

the Cards’s type

Examples:

card.type #=> "WALKER"

Returns:

  • (String)


148
149
150
# File 'lib/zombie_battleground/api/models/card.rb', line 148

def type
  @type
end

#versionString (readonly)

the Cards’s version

Examples:

card.version #=> "v3"

Returns:

  • (String)


52
53
54
# File 'lib/zombie_battleground/api/models/card.rb', line 52

def version
  @version
end