vagrant_cloud 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vagrant_cloud/client.rb +15 -2
  3. metadata +2 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e324926c5c32c84fd0c0506035b0dadc552e4f6c
4
- data.tar.gz: 493f832cc1c117c5634dd674ec0a95100003b552
3
+ metadata.gz: b3fe589f6de0c2adb068af34c80e7e78740fc3ab
4
+ data.tar.gz: 6894acccfd45d46a3adcfbeb2ff38fca58e24d2b
5
5
  SHA512:
6
- metadata.gz: 435e8819762b21c375438e577a2a315afc356936212eb7a87e80eb6eb8c019827b0dcbf7044f4fd1f5ceff42c3245b5947ed5c8a74146db4b913d9f195d6fbfc
7
- data.tar.gz: 76e35098ecf224f7df999d235be1f0687e062916c163efd87b9264d473bf95b950e54704ca8e3072988e1c2282dc7f6ce9c8279305095c78a911376e080e3b3f
6
+ metadata.gz: 86f7284a726434fcdde1d7dc860912a0c8cfdb8d6fb73181672ce07ec98e2a40028547c36f59fbaa3945c79139c302e610bd27d0a2df68619c1652ca888a0206
7
+ data.tar.gz: 1d6615c95f7b4c1864bb220e18c42c71d675468e635975765ec2038ace6abf136dc2983f5b02a4569b2a8d36c7fa2320458fc96df22c0c839e6d646b59f7e3f0
@@ -50,11 +50,24 @@ module VagrantCloud
50
50
  begin
51
51
  result = RestClient::Request.execute(request_params)
52
52
 
53
- parsed_result = JSON.parse(result)
54
- parsed_result
53
+ parse_json(result)
55
54
  rescue RestClient::ExceptionWithResponse => e
56
55
  raise ClientError.new(e.message, e.http_body, e.http_code)
57
56
  end
58
57
  end
58
+
59
+ protected
60
+
61
+ # Parse string of JSON
62
+ #
63
+ # @param [String] string JSON encoded string
64
+ # @return [Object]
65
+ # @note This is included to provide expected behavior on
66
+ # Ruby 2.3. Once it has reached EOL this can be removed.
67
+ def parse_json(string)
68
+ JSON.parse(string)
69
+ rescue JSON::ParserError
70
+ raise if string != 'null'
71
+ end
59
72
  end
60
73
  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: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - HashiCorp
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-16 00:00:00.000000000 Z
12
+ date: 2018-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: json
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: 2.1.0
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: 2.1.0
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: rest-client
30
16
  requirement: !ruby/object:Gem::Requirement