Skip to content

Commit

Permalink
Merge pull request #21 from hostari/require-all-fleet-app-modules
Browse files Browse the repository at this point in the history
Require all fleet app modules
  • Loading branch information
Weltinio authored Sep 22, 2022
2 parents 0cba2ae + c174c33 commit 72f2296
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: fleet_app_client
version: 0.1.9
version: 0.2.0

authors:
- Pauline De Polonia <[email protected]>
Expand Down
24 changes: 24 additions & 0 deletions spec/fleet_app/server_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,28 @@ describe FleetApp::Server do
result.should be_a(FleetApp::ErrorResult)
end
end
describe ".install_oxide" do
it "returns an API result" do
server_id = "1234"
root_path = "https://fleet.hostari.com"
queue_name = "sample.host"
WebMock.stub(:post, "#{root_path}/api/v1/rust/servers/#{server_id}/install_oxide?queue_name=#{queue_name}&username=#{server_id}")
.with(body: "", headers: {"X-Auth-Token" => ""})
.to_return(status: 200, body: File.read("spec/support/rust/servers/install_oxide.json"))
result = FleetApp::Server.install_oxide(queue_name, "rust", server_id, environment: "production", username: server_id)
result.should be_a(FleetApp::ApiResult)
end
end
describe ".update" do
it "returns an API result" do
server_id = "1234"
root_path = "https://fleet.hostari.com"
queue_name = "sample.host"
WebMock.stub(:post, "#{root_path}/api/v1/rust/servers/#{server_id}/update?queue_name=#{queue_name}&username=#{server_id}")
.with(body: "", headers: {"X-Auth-Token" => ""})
.to_return(status: 200, body: File.read("spec/support/rust/servers/update.json"))
result = FleetApp::Server.update(queue_name, "rust", server_id, environment: "production", username: server_id)
result.should be_a(FleetApp::ApiResult)
end
end
end
4 changes: 4 additions & 0 deletions spec/support/rust/servers/install_oxide.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "echo 'foobar'",
"status_code": 200
}
4 changes: 4 additions & 0 deletions spec/support/rust/servers/update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "echo 'foobar'",
"status_code": 200
}
18 changes: 2 additions & 16 deletions src/fleet_app_client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,9 @@ require "json"
require "http/client"

class FleetAppClient
VERSION = "0.1.9"
VERSION = "0.2.0"
HOST = "fleet.hostari.com"
SANDBOX_HOST = "sandbox-#{HOST}"
end

require "./fleet_app/brooce_command/create.cr"
require "./fleet_app/api_path.cr"
require "./fleet_app/api_result.cr"
require "./fleet_app/client_wrapper.cr"
require "./fleet_app/client.cr"
require "./fleet_app/create.cr"
require "./fleet_app/delete.cr"
require "./fleet_app/error_result.cr"
require "./fleet_app/error.cr"
require "./fleet_app/game.cr"
require "./fleet_app/get_details.cr"
require "./fleet_app/get_game_id.cr"
require "./fleet_app/restart.cr"
require "./fleet_app/start.cr"
require "./fleet_app/stop.cr"
require "./fleet_app/**"

0 comments on commit 72f2296

Please sign in to comment.