module StockFighter::ApiMixin::GameMasterApi
Private Class Methods
create_partified_module()
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 37 def self.create_partified_module Module.new do include HTTParty base_uri 'https://www.stockfighter.io/gm' format :json end end
Public Instance Methods
list_levels()
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 6 def list_levels raise NotImplementedError game_master_http.get '/levels' end
restart_instance(instance)
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 16 def restart_instance instance game_master_http.post "/instances/#{instance}/restart" end
resume_instance(instance)
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 24 def resume_instance instance game_master_http.post "/instances/#{instance}/resume" end
show_instance(instance)
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 28 def show_instance instance game_master_http.get "/instances/#{instance}" end
start_current_level()
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 12 def start_current_level game_master_http.post '/levels/first_steps' end
stop_instance(instance)
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 20 def stop_instance instance game_master_http.post "/instances/#{instance}/stop" end
Private Instance Methods
game_master_http()
click to toggle source
# File lib/stock_fighter/api_mixin/game_master_api.rb, line 33 def game_master_http @game_master_http_delegator ||= GameMasterApi.create_partified_module end