cinc 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/cinc/client.rb +10 -3
- data/lib/cinc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b8c996c55f9c96abd24c931e2707a2e7786e1e89460f29fe58eeac98baeac6d
|
|
4
|
+
data.tar.gz: f71bb233a5460c452a344482071e4475c9a55d24314618221b9332c8d6ddbdf1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1118262aac872fd4a6723d541373ad546d714a25c7268101794185dfd1b803d65f5cac87aa8e993b609e1a59d5e1b2b2b7bdfcc9ac5644488716e7a45b2a663d
|
|
7
|
+
data.tar.gz: b2bb73467a5fafbedbd1e3c15cd5b4d9aa8919e72d7d6fdc25afec89e7a28a46f1d2172d067addc722fa6650eec460d3e23c93c420398bd24e2cbd4d956202b6
|
data/CHANGELOG.md
CHANGED
|
@@ -6,5 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.0] - 2020-08-10
|
|
10
|
+
### Changed
|
|
11
|
+
- Separate client initialization and connection
|
|
12
|
+
|
|
13
|
+
## [0.1.0] - 2020-08-08
|
|
9
14
|
### Added
|
|
10
15
|
- Basic client with `get_airbases` method that returns details of all airbases on map
|
data/README.md
CHANGED
data/lib/cinc/client.rb
CHANGED
|
@@ -4,8 +4,13 @@ require 'json'
|
|
|
4
4
|
module Cinc
|
|
5
5
|
class Client
|
|
6
6
|
|
|
7
|
-
def initialize(
|
|
8
|
-
@
|
|
7
|
+
def initialize(host: 'localhost', port: 9001)
|
|
8
|
+
@host = host
|
|
9
|
+
@port = port
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def connect
|
|
13
|
+
@socket = Socket.tcp(@host, @port, connect_timeout: 10)
|
|
9
14
|
rescue StandardError => e
|
|
10
15
|
raise ConnectionError.new(e.message)
|
|
11
16
|
end
|
|
@@ -20,7 +25,9 @@ module Cinc
|
|
|
20
25
|
|
|
21
26
|
def process_command(command)
|
|
22
27
|
@socket.puts command.to_json
|
|
23
|
-
|
|
28
|
+
response = @socket.gets
|
|
29
|
+
raise ConnectionError.new("Connection terminated by server") unless response
|
|
30
|
+
JSON.parse(response)
|
|
24
31
|
rescue StandardError => e
|
|
25
32
|
raise ConnectionError.new(e.message)
|
|
26
33
|
end
|
data/lib/cinc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cinc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeffrey Jones
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-08-
|
|
11
|
+
date: 2020-08-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|