vagrant_cloud 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/vagrant_cloud/account.rb +1 -1
- data/lib/vagrant_cloud/box.rb +3 -3
- data/lib/vagrant_cloud/client.rb +1 -0
- data/lib/vagrant_cloud/provider.rb +10 -4
- data/lib/vagrant_cloud/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fb644aa4c9adb9ab23859aabb4cf0ab6644822aa22732c8be4f4dff4dfc03d9d
|
4
|
+
data.tar.gz: c2b3875c5d8423fce062e0a5b1e1dbc58871aa07eedc5ab5cd88ae323f7bf007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fe5bab079a06e2ac5df5a6c572f3015cd4e428622aae819826fd456be0d663cab8ba70574f11d4a6fcd0e33547dd60d54c667aa7c9460a335d6ecc790c535ca
|
7
|
+
data.tar.gz: edfd6d3934542bdf22fdf228736ba069198097fae2ab91cec5724efdc5fb9bf5b5ca2a2b26dfe48285d5a2a824273fc5d95e935ed3806fd0a142a722d80daffd
|
data/lib/vagrant_cloud/box.rb
CHANGED
@@ -3,7 +3,7 @@ module VagrantCloud
|
|
3
3
|
attr_accessor :account
|
4
4
|
attr_accessor :name
|
5
5
|
|
6
|
-
# @param [
|
6
|
+
# @param [VagrantCloud::Account] account
|
7
7
|
# @param [String] name
|
8
8
|
# @param [Hash] data
|
9
9
|
# @param [String] description
|
@@ -118,7 +118,7 @@ module VagrantCloud
|
|
118
118
|
|
119
119
|
# @return [Array<Version>]
|
120
120
|
def versions
|
121
|
-
version_list = data['versions'].map { |data| VagrantCloud::Version.new(self, data['number'], data) }
|
121
|
+
version_list = data['versions'].map { |data| VagrantCloud::Version.new(self, data['number'], data, nil, @client.access_token, @client.url_base) }
|
122
122
|
version_list.sort_by { |version| Gem::Version.new(version.number) }
|
123
123
|
end
|
124
124
|
|
@@ -130,7 +130,7 @@ module VagrantCloud
|
|
130
130
|
# @param [Hash] data
|
131
131
|
# @return [Version]
|
132
132
|
def get_version(number, data = nil)
|
133
|
-
VagrantCloud::Version.new(self, number, data)
|
133
|
+
VagrantCloud::Version.new(self, number, data, nil, @client.access_token, @client.url_base)
|
134
134
|
end
|
135
135
|
|
136
136
|
# @param [String] name
|
data/lib/vagrant_cloud/client.rb
CHANGED
@@ -5,6 +5,7 @@ module VagrantCloud
|
|
5
5
|
# Base Vagrant Cloud API URL
|
6
6
|
URL_BASE = 'https://vagrantcloud.com/api/v1'.freeze
|
7
7
|
attr_accessor :access_token
|
8
|
+
attr_accessor :url_base
|
8
9
|
|
9
10
|
# @param [String] access_token - token used to authenticate API requests
|
10
11
|
# @param [String] url_base - URL used to make API requests
|
@@ -7,13 +7,15 @@ module VagrantCloud
|
|
7
7
|
# @param [String] name
|
8
8
|
# @param [Hash] data
|
9
9
|
# @param [String] access_token
|
10
|
-
def initialize(version, name, data = nil, url = nil, username = nil, box_name = nil, access_token = nil, custom_server = nil)
|
10
|
+
def initialize(version, name, data = nil, url = nil, username = nil, box_name = nil, access_token = nil, custom_server = nil, checksum = nil, checksum_type = nil) # rubocop:disable LineLength
|
11
11
|
@version = version
|
12
12
|
@name = name
|
13
13
|
@data = data
|
14
14
|
@username = username
|
15
15
|
@box_name = box_name
|
16
16
|
@url = url
|
17
|
+
@checksum = checksum
|
18
|
+
@checksum_type = checksum_type
|
17
19
|
@client = Client.new(access_token, custom_server)
|
18
20
|
end
|
19
21
|
|
@@ -49,14 +51,16 @@ module VagrantCloud
|
|
49
51
|
# @param [String] box_name
|
50
52
|
# @param [String] version_number
|
51
53
|
def create_provider(name = nil, url = nil, username = nil, box_name = nil, version_number = nil)
|
52
|
-
update_data = !(username && version_number &&
|
54
|
+
update_data = !(username && version_number && box_name)
|
53
55
|
name ||= @name
|
54
56
|
url ||= @url
|
55
57
|
username ||= @username
|
56
58
|
box_name ||= @box_name
|
57
59
|
version_number ||= @version
|
60
|
+
checksum = @checksum
|
61
|
+
checksum_type = @checksum_type
|
58
62
|
|
59
|
-
params = { name: name, url: url
|
63
|
+
params = { name: name, url: url, checksum: checksum, checksum_type: checksum_type }.compact
|
60
64
|
data = @client.request('post', create_provider_path(username, box_name, version_number), provider: params)
|
61
65
|
|
62
66
|
@data = data if update_data
|
@@ -75,8 +79,10 @@ module VagrantCloud
|
|
75
79
|
username ||= @username
|
76
80
|
box_name ||= @box_name
|
77
81
|
version_number ||= @version
|
82
|
+
checksum = @checksum
|
83
|
+
checksum_type = @checksum_type
|
78
84
|
|
79
|
-
params = { url: url }
|
85
|
+
params = { url: url, checksum: checksum, checksum_type: checksum_type }.compact
|
80
86
|
data = @client.request('put',
|
81
87
|
provider_path(username, box_name, version_number, provider_name),
|
82
88
|
provider: params)
|
@@ -37,7 +37,7 @@ module VagrantCloud
|
|
37
37
|
|
38
38
|
# @return [Array<Provider>]
|
39
39
|
def providers
|
40
|
-
data['providers'].map { |data| Provider.new(self, data['name'], data) }
|
40
|
+
data['providers'].map { |data| Provider.new(self, data['name'], data, nil, nil, nil, @client.access_token, @client.url_base) }
|
41
41
|
end
|
42
42
|
|
43
43
|
# @return [String]
|
@@ -145,7 +145,7 @@ module VagrantCloud
|
|
145
145
|
# @param [Hash] data
|
146
146
|
# @return [Provider]
|
147
147
|
def get_provider(name, data = nil)
|
148
|
-
Provider.new(self, name, data)
|
148
|
+
Provider.new(self, name, data, nil, nil, nil, @client.access_token, @client.url_base)
|
149
149
|
end
|
150
150
|
|
151
151
|
# @param [String] name
|
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: 2.0.
|
4
|
+
version: 2.0.3
|
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: 2019-
|
12
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.7.8
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Vagrant Cloud API Library
|