フロントエンドプレイアブル
This commit is contained in:
20
test_api_v2.rb
Normal file
20
test_api_v2.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user