vagrant_cloud 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vagrant_cloud/client.rb +21 -12
- 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: 06ac337d41c05fa0ab3f4dba19eb4b48369b7b21e87adea9beaf22c24d7a06ec
|
4
|
+
data.tar.gz: 20c9e7e4c6c6a045a34a5509e05e626a159069d76993d3f70bdf2f333a219083
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c4fd65d40092ff9161d5330afda571efc2d852b23aedf7f8327d803eb2e096792999ebb3f69dd3cbce4663d5c6b79db121531737258084e18c634f626d25d35
|
7
|
+
data.tar.gz: 69eb59e4a61257533baf2707b998b29a6f88f8b37a4c54f6dea8daca3f19e0c93d479d68ae42a277f1ee3c972622625b380fbd7f5db9bfd8e212a583fa706118
|
data/lib/vagrant_cloud/client.rb
CHANGED
@@ -49,7 +49,7 @@ module VagrantCloud
|
|
49
49
|
remote_url = URI.parse(url_base)
|
50
50
|
@url_base = "#{remote_url.scheme}://#{remote_url.host}"
|
51
51
|
@path_base = remote_url.path
|
52
|
-
if @path_base == API_V1_PATH || @path_base == API_V2_PATH
|
52
|
+
if @path_base.empty? || @path_base == API_V1_PATH || @path_base == API_V2_PATH
|
53
53
|
@path_base = nil
|
54
54
|
end
|
55
55
|
@access_token = access_token.dup.freeze if access_token
|
@@ -98,19 +98,28 @@ module VagrantCloud
|
|
98
98
|
# @param [Hash] params Parameters to send with request
|
99
99
|
# @return [Hash]
|
100
100
|
def request(path:, method: :get, params: {}, api_version: 2)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
101
|
+
# Apply any path modifications that are required
|
102
|
+
catch(:done) do
|
103
|
+
# If a base path is defined, and the provided path
|
104
|
+
# is already properly prefixed with it, do nothing.
|
105
|
+
throw :done if !path_base.nil? && path.start_with?(path_base)
|
106
|
+
|
107
|
+
# If the path does not include an API version
|
108
|
+
# prefix, add it now.
|
109
|
+
if !path.start_with?(API_V1_PATH) && !path.start_with?(API_V2_PATH)
|
110
|
+
case api_version
|
111
|
+
when 1
|
112
|
+
start_path = API_V1_PATH
|
113
|
+
when 2
|
114
|
+
start_path = API_V2_PATH
|
115
|
+
else
|
116
|
+
raise ArgumentError, "Unsupported API version provided"
|
117
|
+
end
|
110
118
|
end
|
111
|
-
|
112
|
-
path = [start_path, path].compact.join("/").gsub(/\/{2,}/, "/")
|
119
|
+
|
120
|
+
path = [path_base, start_path, path].compact.join("/").gsub(/\/{2,}/, "/")
|
113
121
|
end
|
122
|
+
|
114
123
|
method = method.to_s.downcase.to_sym
|
115
124
|
|
116
125
|
# Build base request parameters
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HashiCorp
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-01-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|