vmware-vra 2.7.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/CHANGELOG.md +5 -0
  4. data/README.md +79 -144
  5. data/Rakefile +0 -11
  6. data/lib/vra/catalog.rb +39 -8
  7. data/lib/vra/catalog_base.rb +62 -0
  8. data/lib/vra/catalog_item.rb +28 -74
  9. data/lib/vra/catalog_source.rb +116 -0
  10. data/lib/vra/catalog_type.rb +56 -0
  11. data/lib/vra/client.rb +62 -54
  12. data/lib/vra/deployment.rb +155 -0
  13. data/lib/vra/deployment_request.rb +117 -0
  14. data/lib/vra/{resources.rb → deployments.rb} +26 -17
  15. data/lib/vra/exceptions.rb +1 -1
  16. data/lib/vra/http.rb +11 -6
  17. data/lib/vra/request.rb +28 -36
  18. data/lib/vra/request_parameters.rb +12 -12
  19. data/lib/vra/resource.rb +32 -203
  20. data/lib/vra/version.rb +2 -2
  21. data/lib/vra.rb +15 -12
  22. data/spec/catalog_item_spec.rb +64 -222
  23. data/spec/catalog_source_spec.rb +178 -0
  24. data/spec/catalog_spec.rb +112 -72
  25. data/spec/catalog_type_spec.rb +114 -0
  26. data/spec/client_spec.rb +271 -226
  27. data/spec/deployment_request_spec.rb +192 -0
  28. data/spec/deployment_spec.rb +227 -0
  29. data/spec/deployments_spec.rb +80 -0
  30. data/spec/fixtures/resource/sample_catalog_item.json +18 -0
  31. data/spec/fixtures/resource/sample_catalog_item_2.json +18 -0
  32. data/spec/fixtures/resource/sample_catalog_source.json +20 -0
  33. data/spec/fixtures/resource/sample_catalog_type.json +49 -0
  34. data/spec/fixtures/resource/sample_dep_actions.json +58 -0
  35. data/spec/fixtures/resource/sample_dep_request.json +19 -0
  36. data/spec/fixtures/resource/sample_dep_resource.json +112 -0
  37. data/spec/fixtures/resource/sample_deployment.json +26 -0
  38. data/spec/fixtures/resource/sample_entitlements.json +25 -0
  39. data/spec/http_spec.rb +63 -61
  40. data/spec/request_spec.rb +62 -68
  41. data/spec/resource_spec.rb +71 -390
  42. data/spec/spec_helper.rb +10 -4
  43. data/vmware-vra.gemspec +0 -1
  44. metadata +40 -30
  45. data/.travis.yml +0 -14
  46. data/lib/vra/catalog_request.rb +0 -137
  47. data/lib/vra/requests.rb +0 -41
  48. data/spec/catalog_request_spec.rb +0 -268
  49. data/spec/requests_spec.rb +0 -60
  50. data/spec/resources_spec.rb +0 -71
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
- #
3
- # Author:: Chef Partner Engineering (<partnereng@chef.io>)
4
- # Copyright:: Copyright (c) 2015 Chef Software, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require "spec_helper"
21
-
22
- describe Vra::Resources do
23
- let(:client) do
24
- Vra::Client.new(username: "user@corp.local",
25
- password: "password",
26
- tenant: "tenant",
27
- base_url: "https://vra.corp.local")
28
- end
29
-
30
- let(:resources) { Vra::Resources.new(client) }
31
-
32
- it "#all" do
33
- allow(client).to receive(:http_get_paginated_array!)
34
- .with("/catalog-service/api/consumer/resources")
35
- .and_return([ { "id" => "1" }, { "id" => "2" } ])
36
-
37
- items = resources.all_resources
38
-
39
- expect(items[0]).to be_an_instance_of(Vra::Resource)
40
- expect(items[1]).to be_an_instance_of(Vra::Resource)
41
- end
42
-
43
- describe "#all_resources" do
44
- it "calls the resources API endpoint" do
45
- expect(client).to receive(:http_get_paginated_array!)
46
- .with("/catalog-service/api/consumer/resources")
47
- .and_return([])
48
-
49
- resources.all_resources
50
- end
51
-
52
- it "returns an array of resource objects" do
53
- allow(client).to receive(:http_get_paginated_array!)
54
- .with("/catalog-service/api/consumer/resources")
55
- .and_return([ { "id" => "1" }, { "id" => "2" } ])
56
-
57
- items = resources.all_resources
58
-
59
- expect(items[0]).to be_an_instance_of(Vra::Resource)
60
- expect(items[1]).to be_an_instance_of(Vra::Resource)
61
- end
62
- end
63
-
64
- describe "#by_id" do
65
- it "returns a resource object" do
66
- expect(Vra::Resource).to receive(:new).with(client, id: "12345")
67
-
68
- resources.by_id("12345")
69
- end
70
- end
71
- end