21 lines
751 B
Ruby
21 lines
751 B
Ruby
client = GameApiClient.new
|
|
turn1 = Turn.find_by(number: 1)
|
|
|
|
if turn1
|
|
puts "Testing with Turn 1 (ID: #{turn1.id})"
|
|
# 1. 現状の渡し方 (Double Nesting?):
|
|
puts "Test 1: Passing whole game_state hash"
|
|
res1 = client.api_calculate_process(turn1.game_state, turn1.orders || {})
|
|
puts "Response 1 Keys: #{res1&.keys}"
|
|
puts "Response 1 Inner Class: #{res1['game_state'].class}" if res1
|
|
|
|
# 2. 内部データのみを渡す場合:
|
|
puts "\nTest 2: Passing inner game_state data"
|
|
inner_state = turn1.game_state['game_state']
|
|
res2 = client.api_calculate_process(inner_state, turn1.orders || {})
|
|
puts "Response 2 Keys: #{res2&.keys}"
|
|
puts "Response 2 Inner Class: #{res2['game_state'].class}" if res2
|
|
else
|
|
puts "Turn 1 not found."
|
|
end
|