vagrant_cloud 3.0.1 → 3.0.5

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: 00b96df31d811857d6e1322587604bc91195401913872e3340fa89eb8c0816fd
4
- data.tar.gz: 52da865c61e7d50b5777a2a9ea2cc3bd6d7c22c1a3e2a34bc2bfdd537515b0da
3
+ metadata.gz: 4573b763dfa1cbdfb1070d7b9f5ba9db24f56145ea7ce94cc65ff64748d39bad
4
+ data.tar.gz: 3695499ffb77f98444b8435ae48a36a2ac09041c9ffe1fb07ca1447b7eadb179
5
5
  SHA512:
6
- metadata.gz: 9e6a2b72a501bc694992e9de0b789cba4c38fb8c6f176cd4c2e5ca4bd0fb387db5d2b23ada2307b7c63d6590b4ad3b1a8c8f98c74fbcd4f95ffd9c49cb028604
7
- data.tar.gz: a0e90c8f8adad13d0dccd154cf50407065048a8e773df01c50482bdf79787d744e91d5b2e1a6f431c20c7d37656d894aa82c3fdf3e4f7501da5882bd029dff42
6
+ metadata.gz: 305dd27dcda8c280620e52d0675aff2a6c3252d0b49a06cd23633aae306a8b1d12e9d1b25da8f2c71b9a2898797201dc60ef6f6a4fb8cdf8d5306e4b40cdd945
7
+ data.tar.gz: 8e02785ca219228988b0c77fd07ca06a149c259a263eda3aa70e19f5d9dfa2350af01f7727007c39defe8b392c7809fa0ab339def0113d2acd3dea206b11115c
data/README.md CHANGED
@@ -104,7 +104,7 @@ require "vagrant_cloud"
104
104
 
105
105
  account = VagrantCloud::Account.new(access_token: "MY_TOKEN")
106
106
  org = account.organization(name: "hashicorp")
107
- box = org.boxes.select { |b| b.name == "bionic64" }
107
+ box = org.boxes.detect { |b| b.name == "bionic64" }
108
108
 
109
109
  puts "Box: #{box[:tag]} Description: #{box[:description]}"
110
110
  ```
@@ -18,7 +18,7 @@ module VagrantCloud
18
18
  @organization = organization
19
19
  @versions_loaded = false
20
20
  opts[:username] = organization.username
21
- super(opts)
21
+ super(**opts)
22
22
  if opts[:versions] && !opts[:versions].empty?
23
23
  self.versions= Array(opts[:versions]).map do |version|
24
24
  Box::Version.load(box: self, **version)
@@ -108,8 +108,8 @@ module VagrantCloud
108
108
  #
109
109
  # @return [self]
110
110
  def save
111
- save_versions if dirty?(deep: true)
112
111
  save_box if dirty?
112
+ save_versions if dirty?(deep: true)
113
113
  self
114
114
  end
115
115
 
@@ -160,7 +160,8 @@ module VagrantCloud
160
160
  version: version.version,
161
161
  provider: name,
162
162
  checksum: checksum,
163
- checksum_type: checksum_type
163
+ checksum_type: checksum_type,
164
+ url: url
164
165
  }
165
166
  if exist?
166
167
  result = version.box.organization.account.client.box_version_provider_update(**req_args)
@@ -20,7 +20,7 @@ module VagrantCloud
20
20
  Provider.load(version: self, **provider)
21
21
  end
22
22
  end
23
- super(opts)
23
+ super(**opts)
24
24
  clean!
25
25
  end
26
26
 
@@ -126,7 +126,15 @@ module VagrantCloud
126
126
  # Set a request ID so we can track request/responses
127
127
  request_params[:headers] = {"X-Request-Id" => SecureRandom.uuid}
128
128
 
129
- result = with_connection { |c| c.request(request_params) }
129
+ begin
130
+ result = with_connection { |c| c.request(request_params) }
131
+ rescue Excon::Error::HTTPStatus => err
132
+ raise Error::ClientError::RequestError.new(
133
+ "Vagrant Cloud request failed", err.response.body, err.response.status)
134
+ rescue Excon::Error => err
135
+ raise Error::ClientError, err.message
136
+ end
137
+
130
138
  parse_json(result.body)
131
139
  end
132
140
 
@@ -2,8 +2,8 @@ module VagrantCloud
2
2
  class Error < StandardError
3
3
  class ClientError < Error
4
4
  class RequestError < ClientError
5
- attr_accessor :error_arr
6
5
  attr_accessor :error_code
6
+ attr_accessor :error_arr
7
7
 
8
8
  def initialize(msg, http_body, http_code)
9
9
  message = msg
@@ -22,7 +22,7 @@ module VagrantCloud
22
22
  vagrant_cloud_msg = err.message
23
23
  end
24
24
 
25
- @error_arr = vagrant_cloud_msg
25
+ @error_arr = Array(vagrant_cloud_msg)
26
26
  @error_code = http_code.to_i
27
27
  super(message)
28
28
  end
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.0.1
4
+ version: 3.0.5
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: 2020-10-27 00:00:00.000000000 Z
12
+ date: 2021-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.1.10
42
+ - !ruby/object:Gem::Dependency
43
+ name: rexml
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 3.2.5
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 3.2.5
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: rake
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
142
  - !ruby/object:Gem::Version
129
143
  version: '0'
130
144
  requirements: []
131
- rubygems_version: 3.1.2
145
+ rubygems_version: 3.2.22
132
146
  signing_key:
133
147
  specification_version: 4
134
148
  summary: Vagrant Cloud API Library