dockerapi 0.22.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b028f29ad20cb670b4da8ad19f9880d6d7e3ea8c02454e280e373d2bad7c43e
4
- data.tar.gz: c83afd644d8446c7168ec7f37c192fa4d60951f1fbaac96ab6aaa2127e32e678
3
+ metadata.gz: 1676c69bedabf93f4da697ee177428beb48232ba36977a6b2f92cc5f411881ae
4
+ data.tar.gz: 4d3af8188af0d79e451917ee57d0e6a05bcc47a472ee4dff6336e6a2a4ab999d
5
5
  SHA512:
6
- metadata.gz: cf56b8326d015d2440f2099940892fe944c3e86f67ce6af724cf560c5886887a8be8c49a27fc7cb73f980690866c6264c9f3f72cb65cce8d7e723c501ac0852c
7
- data.tar.gz: ddd7511bd0f60b92af38299924972bb747d4c7f94c076713f44fb607757c8b1747050b8bf2bc51cb8e12ddd1b0fd92cdcd1e95e8f79da643cb4cd541851dfe14
6
+ metadata.gz: e1f784635089efd4bb31c0e93002b3c363c856420e827ad4fc790c855fa3095cc281c4cb663d8207f5614651c95c1069eb2cadc4316fc609464d0edae2e8c493
7
+ data.tar.gz: e1826a2e006cddc84b7a09da79b8c6fbbec6d0e0961d5405a0e7e77d8da0808826edc9c7629777c7e91794e45b0a8ed8ff387673f73312f5ed27fa8c4a99b02c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dockerapi (0.22.1)
4
+ dockerapi (1.0.0)
5
5
  base64
6
6
  excon (>= 0.97, < 2)
7
7
 
data/README.md CHANGED
@@ -4,6 +4,7 @@ Interact with Docker API directly from Ruby code. Comprehensive implementation (
4
4
 
5
5
  * [Installation](#installation)
6
6
  * [Usage](#usage)
7
+ * [API version](#api-version)
7
8
  * [Images](#images)
8
9
  * [Containers](#containers)
9
10
  * [Volumes](#volumes)
@@ -52,6 +53,31 @@ If you need more information about the different Docker API endpoints, please se
52
53
 
53
54
  For a more detailed and comprehensive documentation about this gem's API, please see the [documentation page](https://rubydoc.info/gems/dockerapi).
54
55
 
56
+ ### API version
57
+
58
+ The Docker API is backward-compatible, which means we can specify which version of the API we want to use. Doing so is optional in order to take advantage of a specific feature.
59
+
60
+ We can specify the version to be used in 2 ways:
61
+
62
+
63
+ Use a specific version for all new instances
64
+
65
+ ```ruby
66
+ Docker::API.default_api_version="1.43"
67
+ image = Docker::API::Image.new
68
+ image.list.path
69
+ => "/v1.43/images/json"
70
+ ```
71
+
72
+ Change the version used after the instance is created
73
+
74
+ ```ruby
75
+ image = Docker::API::Image.new
76
+ image.api_version="1.43"
77
+ image.list.path
78
+ => "/v1.43/images/json"
79
+ ```
80
+
55
81
  ### Images
56
82
 
57
83
  ```ruby
data/Rakefile CHANGED
@@ -6,5 +6,5 @@ RSpec::Core::RakeTask.new(:spec)
6
6
  task :default => :spec
7
7
 
8
8
  task :version do
9
- p "v#{Docker::API::GEM_VERSION}"
9
+ p "v#{Docker::API::VERSION}"
10
10
  end
data/dockerapi.gemspec CHANGED
@@ -2,7 +2,7 @@ require_relative 'lib/docker/api/version'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "dockerapi"
5
- spec.version = Docker::API::GEM_VERSION
5
+ spec.version = Docker::API::VERSION
6
6
  spec.authors = ["Alysson A. Costa"]
7
7
  spec.email = ["alysson.avila.costa@gmail.com"]
8
8
 
@@ -1,6 +1,8 @@
1
1
  ##
2
2
  # Base class to provide general methods, helpers and implementations accross classes.
3
3
  class Docker::API::Base
4
+ attr_accessor(:api_version)
5
+
4
6
  [:get, :post, :head, :delete, :put].each do | method |
5
7
  define_method(method) { | path, params = {} | self.request(method: method, path: path, params: params) }
6
8
  end
@@ -24,6 +26,7 @@ class Docker::API::Base
24
26
  def initialize connection = nil
25
27
  raise StandardError.new("Expected connection to be a Docker::API::Connection class") if connection != nil && !connection.is_a?(Docker::API::Connection)
26
28
  @connection = connection || Docker::API::Connection.new
29
+ @api_version = Docker::API.default_api_version
27
30
  end
28
31
 
29
32
  private
@@ -91,7 +94,7 @@ class Docker::API::Base
91
94
  # @param path [String]: Base URL string.
92
95
  # @param hash [Hash]: Hash object to be appended to the URL as query parameters.
93
96
  def build_path path, params = {}
94
- path = "/v#{Docker::API::API_VERSION}#{path}"
97
+ path = "/v#{@api_version}#{path}"
95
98
  params.size > 0 ? [path, hash_to_params(params)].join("?") : path
96
99
  end
97
100
 
@@ -1,9 +1,5 @@
1
1
  module Docker
2
2
  module API
3
- GEM_VERSION = "0.22.1"
4
-
5
- API_VERSION = "1.43"
6
-
7
- VERSION = "Gem: #{Docker::API::GEM_VERSION} | API: #{Docker::API::API_VERSION}"
3
+ VERSION = "1.0.0"
8
4
  end
9
5
  end
data/lib/dockerapi.rb CHANGED
@@ -43,6 +43,16 @@ module Docker
43
43
  @@print_response_to_stdout = bool
44
44
  end
45
45
  self.print_response_to_stdout = false
46
+
47
+ ##
48
+ # This variable controls the default Docker API version.
49
+ def self.default_api_version
50
+ @@default_api_version
51
+ end
52
+ def self.default_api_version=(s)
53
+ @@default_api_version = s
54
+ end
55
+ self.default_api_version = "1.43"
46
56
 
47
57
  end
48
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alysson A. Costa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-26 00:00:00.000000000 Z
11
+ date: 2025-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64