docker-engine-ruby 0.4.0 → 0.5.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 +8 -0
- data/README.md +4 -2
- data/lib/docker_engine_ruby/client.rb +17 -1
- data/lib/docker_engine_ruby/version.rb +1 -1
- data/rbi/docker_engine_ruby/client.rbi +17 -0
- data/sig/docker_engine_ruby/client.rbs +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52ca02c95ffae865b5b2b52a7737171e99326e721cdc2980c9af02ec8da5cf00
|
|
4
|
+
data.tar.gz: cacdcb4c85c548710eee62b1e0aa6b1558741a8b4aa55caed22bbf3bd4f0e27f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c02c00f7df591a54a8aa1d87f8c6b3b35709b722f41aa74217d7867097b5be43613a2cc5fe3638d337a72c974ab64366cdaf5b840f12527a22ae37537a64240
|
|
7
|
+
data.tar.gz: c8edc019d3636ba434d96def88e597a6419e6ea10257976baa12d7c8c1fb38243b80d3e7329531c3122760a8b452bb8e9c70dcf8b5ecf0af3986dd6162c5da40
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 (2026-02-14)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.4.0...v0.5.0](https://github.com/Hexlet/docker-ruby/compare/v0.4.0...v0.5.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** api update ([a44163c](https://github.com/Hexlet/docker-ruby/commit/a44163cdccd707282795ba0dfccc5c8647bb42ce))
|
|
10
|
+
|
|
3
11
|
## 0.4.0 (2026-02-14)
|
|
4
12
|
|
|
5
13
|
Full Changelog: [v0.3.0...v0.4.0](https://github.com/Hexlet/docker-ruby/compare/v0.3.0...v0.4.0)
|
data/README.md
CHANGED
|
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
17
17
|
<!-- x-release-please-start-version -->
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
gem "docker-engine-ruby", "~> 0.
|
|
20
|
+
gem "docker-engine-ruby", "~> 0.5.0"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
<!-- x-release-please-end -->
|
|
@@ -28,7 +28,9 @@ gem "docker-engine-ruby", "~> 0.4.0"
|
|
|
28
28
|
require "bundler/setup"
|
|
29
29
|
require "docker_engine_ruby"
|
|
30
30
|
|
|
31
|
-
docker = DockerEngineRuby::Client.new
|
|
31
|
+
docker = DockerEngineRuby::Client.new(
|
|
32
|
+
environment: "production_tls" # defaults to "production"
|
|
33
|
+
)
|
|
32
34
|
|
|
33
35
|
create_response = docker.containers.create(name: "sample-container")
|
|
34
36
|
|
|
@@ -15,6 +15,11 @@ module DockerEngineRuby
|
|
|
15
15
|
# Default max retry delay in seconds.
|
|
16
16
|
DEFAULT_MAX_RETRY_DELAY = 8.0
|
|
17
17
|
|
|
18
|
+
# rubocop:disable Style/MutableConstant
|
|
19
|
+
# @type [Hash{Symbol=>String}]
|
|
20
|
+
ENVIRONMENTS = {production: "http://localhost:2375", production_tls: "https://localhost:2376"}
|
|
21
|
+
# rubocop:enable Style/MutableConstant
|
|
22
|
+
|
|
18
23
|
# @return [DockerEngineRuby::Resources::Auth]
|
|
19
24
|
attr_reader :auth
|
|
20
25
|
|
|
@@ -62,6 +67,13 @@ module DockerEngineRuby
|
|
|
62
67
|
|
|
63
68
|
# Creates and returns a new client for interacting with the API.
|
|
64
69
|
#
|
|
70
|
+
# @param environment [:production, :production_tls, nil] Specifies the environment to use for the API.
|
|
71
|
+
#
|
|
72
|
+
# Each environment maps to a different base URL:
|
|
73
|
+
#
|
|
74
|
+
# - `production` corresponds to `http://localhost:2375`
|
|
75
|
+
# - `production_tls` corresponds to `https://localhost:2376`
|
|
76
|
+
#
|
|
65
77
|
# @param base_url [String, nil] Override the default base URL for the API, e.g.,
|
|
66
78
|
# `"https://api.example.com/v2/"`. Defaults to `ENV["DOCKER_BASE_URL"]`
|
|
67
79
|
#
|
|
@@ -73,13 +85,17 @@ module DockerEngineRuby
|
|
|
73
85
|
#
|
|
74
86
|
# @param max_retry_delay [Float]
|
|
75
87
|
def initialize(
|
|
88
|
+
environment: nil,
|
|
76
89
|
base_url: ENV["DOCKER_BASE_URL"],
|
|
77
90
|
max_retries: self.class::DEFAULT_MAX_RETRIES,
|
|
78
91
|
timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
|
|
79
92
|
initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
|
|
80
93
|
max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
|
|
81
94
|
)
|
|
82
|
-
base_url ||=
|
|
95
|
+
base_url ||= DockerEngineRuby::Client::ENVIRONMENTS.fetch(environment&.to_sym || :production) do
|
|
96
|
+
message = "environment must be one of #{DockerEngineRuby::Client::ENVIRONMENTS.keys}, got #{environment}"
|
|
97
|
+
raise ArgumentError.new(message)
|
|
98
|
+
end
|
|
83
99
|
|
|
84
100
|
super(
|
|
85
101
|
base_url: base_url,
|
|
@@ -10,6 +10,15 @@ module DockerEngineRuby
|
|
|
10
10
|
|
|
11
11
|
DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float)
|
|
12
12
|
|
|
13
|
+
ENVIRONMENTS =
|
|
14
|
+
T.let(
|
|
15
|
+
{
|
|
16
|
+
production: "http://localhost:2375",
|
|
17
|
+
production_tls: "https://localhost:2376"
|
|
18
|
+
},
|
|
19
|
+
T::Hash[Symbol, String]
|
|
20
|
+
)
|
|
21
|
+
|
|
13
22
|
sig { returns(DockerEngineRuby::Resources::Auth) }
|
|
14
23
|
attr_reader :auth
|
|
15
24
|
|
|
@@ -58,6 +67,7 @@ module DockerEngineRuby
|
|
|
58
67
|
# Creates and returns a new client for interacting with the API.
|
|
59
68
|
sig do
|
|
60
69
|
params(
|
|
70
|
+
environment: T.nilable(T.any(Symbol, String)),
|
|
61
71
|
base_url: T.nilable(String),
|
|
62
72
|
max_retries: Integer,
|
|
63
73
|
timeout: Float,
|
|
@@ -66,6 +76,13 @@ module DockerEngineRuby
|
|
|
66
76
|
).returns(T.attached_class)
|
|
67
77
|
end
|
|
68
78
|
def self.new(
|
|
79
|
+
# Specifies the environment to use for the API.
|
|
80
|
+
#
|
|
81
|
+
# Each environment maps to a different base URL:
|
|
82
|
+
#
|
|
83
|
+
# - `production` corresponds to `http://localhost:2375`
|
|
84
|
+
# - `production_tls` corresponds to `https://localhost:2376`
|
|
85
|
+
environment: nil,
|
|
69
86
|
# Override the default base URL for the API, e.g.,
|
|
70
87
|
# `"https://api.example.com/v2/"`. Defaults to `ENV["DOCKER_BASE_URL"]`
|
|
71
88
|
base_url: ENV["DOCKER_BASE_URL"],
|
|
@@ -8,6 +8,11 @@ module DockerEngineRuby
|
|
|
8
8
|
|
|
9
9
|
DEFAULT_MAX_RETRY_DELAY: Float
|
|
10
10
|
|
|
11
|
+
ENVIRONMENTS: {
|
|
12
|
+
production: "http://localhost:2375",
|
|
13
|
+
production_tls: "https://localhost:2376"
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
attr_reader auth: DockerEngineRuby::Resources::Auth
|
|
12
17
|
|
|
13
18
|
attr_reader system_: DockerEngineRuby::Resources::System
|
|
@@ -39,6 +44,7 @@ module DockerEngineRuby
|
|
|
39
44
|
attr_reader distribution: DockerEngineRuby::Resources::Distribution
|
|
40
45
|
|
|
41
46
|
def initialize: (
|
|
47
|
+
?environment: :production | :production_tls | nil,
|
|
42
48
|
?base_url: String?,
|
|
43
49
|
?max_retries: Integer,
|
|
44
50
|
?timeout: Float,
|