ops_manager_ui_drivers 1.7.3 → 1.8.0

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
  SHA1:
3
- metadata.gz: cfa93e80ccd3f2959ee23416b6bb74190e1dba46
4
- data.tar.gz: cd31e18c63069464eb9152dc034e4fc329f72447
3
+ metadata.gz: 3df40222f057340c8bbe521bbcd6c84a324cd808
4
+ data.tar.gz: 4ca61f7c0f4db629b4a1f5ec3785eacfb0a889bd
5
5
  SHA512:
6
- metadata.gz: b937b3eb0587d735dd28f60e1c234f8e82e079ee3a7308e99367079061ad18617c54847c11d94d4cae693a77093d9d9ba6f1493bfa9d18f28842c0783d63ef85
7
- data.tar.gz: 90e981080e794ec75015af99101dc2886a37fa4a34011f259c0212aad0cdf1edcc245cfb00d7e4eea67a85a2e3cc73d397ae1a9b8420b19dea9e6f9dee228ef0
6
+ metadata.gz: b9a359d44f40389e8a635c585b9531de9669d767bf9d3401f3a04bcee7bc9c970ae285e9ccd189469713d4d89f52f7f0f330e2c32647f99ff1f1c82effadb708
7
+ data.tar.gz: bbf04e4e9ddac2aab995941886a8dc3b190bff168f2527c31d9b8c9775b2fdefe76371766fc1be7f0415a7890834e638d258790c86fc0d7736635dd96b6ec84c
@@ -21,15 +21,19 @@ module OpsManagerUiDrivers
21
21
  end
22
22
 
23
23
  def api_1_4(host:, username:, password:)
24
- Version14::Api.new(host: host, user: username, password: password)
24
+ Version14::Api.new(host_uri: host, username: username, password: password)
25
25
  end
26
26
 
27
27
  def api_1_5(host:, username:, password:)
28
- Version15::Api.new(host: host, user: username, password: password)
28
+ Version15::Api.new(host_uri: host, username: username, password: password)
29
29
  end
30
30
 
31
31
  def api_1_6(host:, username:, password:)
32
- Version16::Api.new(host: host, user: username, password: password)
32
+ Version16::Api.new(host_uri: host, username: username, password: password)
33
+ end
34
+
35
+ def api_rc(host:, username:, password:)
36
+ Version17::Api.new(host_uri: host, username: username, password: password)
33
37
  end
34
38
 
35
39
  private
@@ -1,3 +1,3 @@
1
1
  module OpsManagerUiDrivers
2
- VERSION = '1.7.3'
2
+ VERSION = '1.8.0'
3
3
  end
@@ -3,9 +3,9 @@ require 'net/https'
3
3
  module OpsManagerUiDrivers
4
4
  module Version14
5
5
  class Api
6
- def initialize(host: nil, user: nil, password: nil)
7
- @host = host
8
- @user = user
6
+ def initialize(host_uri:, username:, password:)
7
+ @host_uri = URI.parse(host_uri) # we expect "proto://host(:port)"
8
+ @username = username
9
9
  @password = password
10
10
  end
11
11
 
@@ -23,20 +23,24 @@ module OpsManagerUiDrivers
23
23
  private
24
24
 
25
25
  def http
26
- uri = URI(@host)
27
- Net::HTTP.new(uri.host, uri.port).tap do |http|
28
- http.use_ssl = true
26
+ Net::HTTP.new(@host_uri.host, @host_uri.port).tap do |http|
27
+ http.use_ssl = @host_uri.is_a?(URI::HTTPS)
29
28
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
30
29
  http.read_timeout = 1800
31
30
  end
32
31
  end
33
32
 
34
33
  def get(endpoint)
35
- uri = URI("#{@host}/api/#{endpoint}")
36
- Net::HTTP::Get.new(uri.request_uri).tap do |get|
37
- get.basic_auth(@user, @password)
34
+ Net::HTTP::Get.new(api_uri(endpoint).request_uri).tap do |get|
35
+ get.basic_auth(@username, @password)
38
36
  end
39
37
  end
38
+
39
+ def api_uri(endpoint)
40
+ URI.parse(
41
+ URI.join(@host_uri.to_s, File.join('api', endpoint)).to_s
42
+ )
43
+ end
40
44
  end
41
45
  end
42
46
  end
@@ -0,0 +1,8 @@
1
+ require 'ops_manager_ui_drivers/version14/api'
2
+
3
+ module OpsManagerUiDrivers
4
+ module Version15
5
+ class Api < Version14::Api
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'ops_manager_ui_drivers/version15/api'
2
+
3
+ module OpsManagerUiDrivers
4
+ module Version16
5
+ class Api < Version15::Api
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,22 @@
1
+ require 'ops_manager_ui_drivers/version16/api'
2
+
3
+ module OpsManagerUiDrivers
4
+ module Version17
5
+ class Api < Version16::Api
6
+ def set_feature_flag(flag_name, value)
7
+ feature_flag_path = File.join('feature_flags', flag_name)
8
+
9
+ http.request(put(feature_flag_path, enabled: value))
10
+ end
11
+
12
+ private
13
+
14
+ def put(endpoint, form_data)
15
+ Net::HTTP::Put.new(api_uri(endpoint).request_uri).tap do |put_request|
16
+ put_request.basic_auth(@username, @password)
17
+ put_request.set_form_data(form_data)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.9'
26
26
  spec.add_development_dependency 'codeclimate-test-reporter'
27
+ spec.add_development_dependency 'pry'
27
28
  spec.add_development_dependency 'rake', '~> 10.0'
28
29
  spec.add_development_dependency 'rubocop'
29
30
  spec.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_manager_ui_drivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-12 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -156,7 +170,7 @@ files:
156
170
  - lib/ops_manager_ui_drivers.rb
157
171
  - lib/ops_manager_ui_drivers/page_helpers.rb
158
172
  - lib/ops_manager_ui_drivers/version.rb
159
- - lib/ops_manager_ui_drivers/version14/api_1_4.rb
173
+ - lib/ops_manager_ui_drivers/version14/api.rb
160
174
  - lib/ops_manager_ui_drivers/version14/availability_zones.rb
161
175
  - lib/ops_manager_ui_drivers/version14/available_products.rb
162
176
  - lib/ops_manager_ui_drivers/version14/iaas_configuration.rb
@@ -175,7 +189,7 @@ files:
175
189
  - lib/ops_manager_ui_drivers/version14/setup.rb
176
190
  - lib/ops_manager_ui_drivers/version14/state_change_progress.rb
177
191
  - lib/ops_manager_ui_drivers/version14/web_ui.rb
178
- - lib/ops_manager_ui_drivers/version15/api_1_5.rb
192
+ - lib/ops_manager_ui_drivers/version15/api.rb
179
193
  - lib/ops_manager_ui_drivers/version15/available_products.rb
180
194
  - lib/ops_manager_ui_drivers/version15/job_availability_zone_mapping_helper.rb
181
195
  - lib/ops_manager_ui_drivers/version15/job_network_mapping_helper.rb
@@ -198,7 +212,7 @@ files:
198
212
  - lib/ops_manager_ui_drivers/version15/setup.rb
199
213
  - lib/ops_manager_ui_drivers/version15/state_change_progress.rb
200
214
  - lib/ops_manager_ui_drivers/version15/web_ui.rb
201
- - lib/ops_manager_ui_drivers/version16/api_1_6.rb
215
+ - lib/ops_manager_ui_drivers/version16/api.rb
202
216
  - lib/ops_manager_ui_drivers/version16/available_products.rb
203
217
  - lib/ops_manager_ui_drivers/version16/bosh_product_sections/advanced_infrastructure_config.rb
204
218
  - lib/ops_manager_ui_drivers/version16/bosh_product_sections/availability_zones.rb
@@ -221,6 +235,7 @@ files:
221
235
  - lib/ops_manager_ui_drivers/version16/setup.rb
222
236
  - lib/ops_manager_ui_drivers/version16/state_change_progress.rb
223
237
  - lib/ops_manager_ui_drivers/version16/web_ui.rb
238
+ - lib/ops_manager_ui_drivers/version17/api.rb
224
239
  - lib/ops_manager_ui_drivers/version17/available_products.rb
225
240
  - lib/ops_manager_ui_drivers/version17/bosh_product_sections/advanced_infrastructure_config.rb
226
241
  - lib/ops_manager_ui_drivers/version17/bosh_product_sections/availability_zones.rb
@@ -1,42 +0,0 @@
1
- require 'net/https'
2
-
3
- module OpsManagerUiDrivers
4
- module Version15
5
- class Api
6
- def initialize(host: nil, user: nil, password: nil)
7
- @host = host
8
- @user = user
9
- @password = password
10
- end
11
-
12
- def export_installation
13
- tmpfile = Tempfile.new('installation.zip')
14
- http.request(get('installation_asset_collection')) do |response|
15
- response.read_body do |chunk|
16
- tmpfile.write(chunk)
17
- end
18
- end
19
- tmpfile.close
20
- tmpfile
21
- end
22
-
23
- private
24
-
25
- def http
26
- uri = URI(@host)
27
- Net::HTTP.new(uri.host, uri.port).tap do |http|
28
- http.use_ssl = true
29
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
30
- http.read_timeout = 1800
31
- end
32
- end
33
-
34
- def get(endpoint)
35
- uri = URI("#{@host}/api/#{endpoint}")
36
- Net::HTTP::Get.new(uri.request_uri).tap do |get|
37
- get.basic_auth(@user, @password)
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,42 +0,0 @@
1
- require 'net/https'
2
-
3
- module OpsManagerUiDrivers
4
- module Version16
5
- class Api
6
- def initialize(host: nil, user: nil, password: nil)
7
- @host = host
8
- @user = user
9
- @password = password
10
- end
11
-
12
- def export_installation
13
- tmpfile = Tempfile.new('installation.zip')
14
- http.request(get('installation_asset_collection')) do |response|
15
- response.read_body do |chunk|
16
- tmpfile.write(chunk)
17
- end
18
- end
19
- tmpfile.close
20
- tmpfile
21
- end
22
-
23
- private
24
-
25
- def http
26
- uri = URI(@host)
27
- Net::HTTP.new(uri.host, uri.port).tap do |http|
28
- http.use_ssl = true
29
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
30
- http.read_timeout = 1800
31
- end
32
- end
33
-
34
- def get(endpoint)
35
- uri = URI("#{@host}/api/#{endpoint}")
36
- Net::HTTP::Get.new(uri.request_uri).tap do |get|
37
- get.basic_auth(@user, @password)
38
- end
39
- end
40
- end
41
- end
42
- end