Class: BattleOn::SendAttack

Inherits:
Object
  • Object
show all
Defined in:
lib/battle_on/send_attack.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game_id, args) ⇒ SendAttack

Returns a new instance of SendAttack.



12
13
14
15
16
# File 'lib/battle_on/send_attack.rb', line 12

def initialize(game_id, args)
  @game_id = game_id
  @x  = args[:x] or raise ArgumentError, "Must pass 'x' attack"
  @y  = args[:y] or raise ArgumentError, "Must pass 'y' attack"
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



6
7
8
# File 'lib/battle_on/send_attack.rb', line 6

def args
  @args
end

#game_idObject (readonly)

Returns the value of attribute game_id.



6
7
8
# File 'lib/battle_on/send_attack.rb', line 6

def game_id
  @game_id
end

#xObject (readonly)

Returns the value of attribute x.



6
7
8
# File 'lib/battle_on/send_attack.rb', line 6

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



6
7
8
# File 'lib/battle_on/send_attack.rb', line 6

def y
  @y
end

Class Method Details

.execute(game_id, args) ⇒ Object



8
9
10
# File 'lib/battle_on/send_attack.rb', line 8

def self.execute(game_id, args)
  new(game_id, args).execute
end

Instance Method Details

#executeObject



18
19
20
# File 'lib/battle_on/send_attack.rb', line 18

def execute
  JSON.parse attack
end