vra-restapi 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,59 @@
1
+ #
2
+ # Author:: Chef Partner Engineering (<partnereng@chef.io>)
3
+ # Copyright:: Copyright (c) 2015 Chef Software, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'spec_helper'
20
+
21
+ describe Vra::Resources do
22
+ let(:client) do
23
+ Vra::Client.new(username: 'user@corp.local',
24
+ password: 'password',
25
+ tenant: 'tenant',
26
+ base_url: 'https://vra.corp.local')
27
+ end
28
+
29
+ let(:resources) { Vra::Resources.new(client) }
30
+
31
+ describe '#all_resources' do
32
+ it 'calls the resources API endpoint' do
33
+ expect(client).to receive(:http_get_paginated_array!)
34
+ .with('/catalog-service/api/consumer/resources')
35
+ .and_return([])
36
+
37
+ resources.all_resources
38
+ end
39
+
40
+ it 'returns an array of resource objects' do
41
+ allow(client).to receive(:http_get_paginated_array!)
42
+ .with('/catalog-service/api/consumer/resources')
43
+ .and_return([ { 'id' => '1' }, { 'id' => '2' } ])
44
+
45
+ items = resources.all_resources
46
+
47
+ expect(items[0]).to be_an_instance_of(Vra::Resource)
48
+ expect(items[1]).to be_an_instance_of(Vra::Resource)
49
+ end
50
+ end
51
+
52
+ describe '#by_id' do
53
+ it 'returns a resource object' do
54
+ expect(Vra::Resource).to receive(:new).with(client, id: '12345')
55
+
56
+ resources.by_id('12345')
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # Author:: Chef Partner Engineering (<partnereng@chef.io>)
3
+ # Copyright:: Copyright (c) 2015 Chef Software, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'vra'
20
+ require 'webmock/rspec'
21
+
22
+ WebMock.disable_net_connect!(allow_localhost: true)
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vra-restapi/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'vra-restapi'
8
+ spec.version = Vra::VERSION
9
+ spec.authors = ['Corey Osman']
10
+ spec.email = ['corey@nwops.io']
11
+ spec.summary = 'Client gem for interacting with VMware vRealize Automation.'
12
+ spec.description = spec.summary
13
+ spec.homepage = 'https://github.com/nwops/vra-restapi'
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'rest-client', '~> 1.8'
22
+ spec.add_dependency 'passwordmasker', '~> 1.2'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.7'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rspec', '~> 3.0'
27
+ spec.add_development_dependency 'webmock', '~> 1.21'
28
+ spec.add_development_dependency 'rubocop', '~> 0.35'
29
+ spec.add_development_dependency 'pry', '~> 0.10'
30
+ end
metadata ADDED
@@ -0,0 +1,201 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vra-restapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.2
5
+ platform: ruby
6
+ authors:
7
+ - Corey Osman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: passwordmasker
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.21'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.21'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '0.35'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '0.35'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '0.10'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '0.10'
125
+ description: Client gem for interacting with VMware vRealize Automation.
126
+ email:
127
+ - corey@nwops.io
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - .gitignore
133
+ - .rubocop.yml
134
+ - .travis.yml
135
+ - CHANGELOG.md
136
+ - Gemfile
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - lib/vra-restapi.rb
141
+ - lib/vra-restapi/catalog.rb
142
+ - lib/vra-restapi/catalog_item.rb
143
+ - lib/vra-restapi/catalog_request.rb
144
+ - lib/vra-restapi/client.rb
145
+ - lib/vra-restapi/exceptions.rb
146
+ - lib/vra-restapi/request.rb
147
+ - lib/vra-restapi/request_parameters.rb
148
+ - lib/vra-restapi/requests.rb
149
+ - lib/vra-restapi/resource.rb
150
+ - lib/vra-restapi/resources.rb
151
+ - lib/vra-restapi/version.rb
152
+ - spec/catalog_item_spec.rb
153
+ - spec/catalog_request_spec.rb
154
+ - spec/catalog_spec.rb
155
+ - spec/client_spec.rb
156
+ - spec/fixtures/resource/non_vm_resource.json
157
+ - spec/fixtures/resource/vm_resource.json
158
+ - spec/fixtures/resource/vm_resource_no_operations.json
159
+ - spec/request_spec.rb
160
+ - spec/requests_spec.rb
161
+ - spec/resource_spec.rb
162
+ - spec/resources_spec.rb
163
+ - spec/spec_helper.rb
164
+ - vra-restapi.gemspec
165
+ homepage: https://github.com/nwops/vra-restapi
166
+ licenses:
167
+ - Apache 2.0
168
+ metadata: {}
169
+ post_install_message:
170
+ rdoc_options: []
171
+ require_paths:
172
+ - lib
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ requirements: []
184
+ rubyforge_project:
185
+ rubygems_version: 2.0.14
186
+ signing_key:
187
+ specification_version: 4
188
+ summary: Client gem for interacting with VMware vRealize Automation.
189
+ test_files:
190
+ - spec/catalog_item_spec.rb
191
+ - spec/catalog_request_spec.rb
192
+ - spec/catalog_spec.rb
193
+ - spec/client_spec.rb
194
+ - spec/fixtures/resource/non_vm_resource.json
195
+ - spec/fixtures/resource/vm_resource.json
196
+ - spec/fixtures/resource/vm_resource_no_operations.json
197
+ - spec/request_spec.rb
198
+ - spec/requests_spec.rb
199
+ - spec/resource_spec.rb
200
+ - spec/resources_spec.rb
201
+ - spec/spec_helper.rb