フロントエンドプレイアブル
This commit is contained in:
67
verify_all_methods.rb
Normal file
67
verify_all_methods.rb
Normal file
@@ -0,0 +1,67 @@
|
||||
require_relative 'app/services/game_api_client'
|
||||
require 'pp'
|
||||
|
||||
# Mock Rails.logger for standalone script
|
||||
class Rails
|
||||
def self.logger
|
||||
@logger ||= Logger.new(STDOUT)
|
||||
end
|
||||
end
|
||||
require 'logger'
|
||||
|
||||
client = GameApiClient.new
|
||||
|
||||
puts "--- 1. api_game_initial_state ---"
|
||||
initial_state_full = client.api_game_initial_state
|
||||
if initial_state_full
|
||||
game_state = initial_state_full["game_state"]
|
||||
puts "Success: Game ID #{game_state['game_id']}"
|
||||
else
|
||||
puts "Failed"
|
||||
exit
|
||||
end
|
||||
|
||||
puts "\n--- 2. api_calculate_possible_orders ---"
|
||||
orders_poss = client.api_calculate_possible_orders(game_state, "FRANCE")
|
||||
puts "Success: Power #{orders_poss['power']}" if orders_poss
|
||||
|
||||
puts "\n--- 3. api_calculate_auto_orders ---"
|
||||
auto_orders = client.api_calculate_auto_orders(game_state, "FRANCE")
|
||||
if auto_orders
|
||||
puts "Success: Generated #{auto_orders['orders'].size} orders"
|
||||
orders_for_process = { "FRANCE" => auto_orders['orders'] }
|
||||
else
|
||||
puts "Failed"
|
||||
end
|
||||
|
||||
puts "\n--- 4. api_calculate_validate ---"
|
||||
validation = client.api_calculate_validate(game_state, orders_for_process)
|
||||
puts "Success: Validated orders for #{validation['validated_orders'].keys.join(', ')}" if validation
|
||||
|
||||
puts "\n--- 5. api_calculate_process ---"
|
||||
processed = client.api_calculate_process(game_state, orders_for_process)
|
||||
if processed
|
||||
puts "Success: New phase #{processed['game_state']['phase']}"
|
||||
else
|
||||
puts "Failed"
|
||||
end
|
||||
|
||||
puts "\n--- 6. api_render ---"
|
||||
svg = client.api_render(game_state, orders: orders_for_process)
|
||||
if svg
|
||||
if svg.is_a?(String) && (svg.include?("<svg") || svg.include?("<?xml"))
|
||||
puts "Success: SVG generated (Length: #{svg.length})"
|
||||
else
|
||||
puts "Failed: Does not look like SVG. Content: #{svg[0..50].inspect}"
|
||||
end
|
||||
else
|
||||
puts "Failed: Returned nil"
|
||||
end
|
||||
|
||||
puts "\n--- 7. api_maps ---"
|
||||
maps = client.api_maps
|
||||
puts "Success: Maps #{maps['maps'].join(', ')}" if maps
|
||||
|
||||
puts "\n--- 8. api_maps_data ---"
|
||||
map_data = client.api_maps_data("standard")
|
||||
puts "Success: Map standard has #{map_data['powers'].size} powers" if map_data
|
||||
Reference in New Issue
Block a user